diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index b15773a..5ae4ea3 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -276,7 +276,16 @@ removed constructor API or backend schema remains in production code. ## Stage 4: Migrate Maintained Definitions, Application Examples, And Testdata -Status: Pending. Depends on Stage 3. +Status: Complete. Maintained and fixture prompt/profile definitions now use +PromptKit's keyed format, and application examples select ordered native +sources with framework backend data in separate files. The two fixture +versions sharing one prompt ID are in one document so their directory remains +a strict composition group. The old imported backend fragment contained no +application defaults; it was removed after its framework data moved rather +than introducing an unrelated defaults fragment. All four application configs +validate; both maintained render scripts, the composed-overlay render, the +inheritance render without credentials, and offline renders for each maintained +and fixture prompt/version pass. Files: maintained prompt/profile YAML under `examples/` and `testdata/promptkit-v0.9/`; their application configs and scripts; new diff --git a/examples/config-fragments/sources.yml b/examples/config-fragments/sources.yml index 36e3b22..ce06586 100644 --- a/examples/config-fragments/sources.yml +++ b/examples/config-fragments/sources.yml @@ -1,3 +1,5 @@ -prompt_dir: ./examples/prompts -profile_dir: ./examples/profiles +promptkit_sources: + - directory: ./examples/prompts + - directory: ./examples/profiles + - file: ./examples/framework/backends.yml schema_dir: ./examples/schemas diff --git a/examples/config.composed.yml b/examples/config.composed.yml index 279fc26..d3f2741 100644 --- a/examples/config.composed.yml +++ b/examples/config.composed.yml @@ -2,7 +2,6 @@ configkit: imports: - path: config-fragments/sources.yml - - path: config-fragments/backend.yml server: addr: :8080 diff --git a/examples/config.full.yml b/examples/config.full.yml index 826f5af..57769c7 100644 --- a/examples/config.full.yml +++ b/examples/config.full.yml @@ -1,16 +1,9 @@ -prompt_dir: ./examples/prompts -profile_dir: ./examples/profiles +promptkit_sources: + - directory: ./examples/prompts + - directory: ./examples/profiles + - file: ./examples/framework/backends.yml schema_dir: ./examples/schemas -backends: - local-gpu: - endpoint: http://localhost:11434/v1 - api_key_env: LOCAL_GPU_API_KEY - extra_params: - provider_option: enabled - concurrency_limit: 2 - queue_capacity: 0 - server: addr: 127.0.0.1:8080 artifact_root: . diff --git a/examples/config.inheritance.yml b/examples/config.inheritance.yml index f6453c1..d246a07 100644 --- a/examples/config.inheritance.yml +++ b/examples/config.inheritance.yml @@ -1,18 +1,6 @@ # Application paths are relative to the repository invocation directory. -prompt_dir: ./examples/prompts -profile_dir: ./examples/profiles +promptkit_sources: + - directory: ./examples/prompts + - directory: ./examples/profiles + - file: ./examples/framework/inheritance.yml schema_dir: ./examples/schemas - -backends: - local-base: - endpoint: http://localhost:11434/v1 - api_key_env: LOCAL_GPU_API_KEY - concurrency_limit: 2 - queue_capacity: 4 - extra_params: - provider_option: true - local-gpu: - extends: local-base - queue_capacity: 0 - extra_params: - provider_option: false diff --git a/examples/config.yml b/examples/config.yml index 353b2cc..dccb6fc 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -1,5 +1,7 @@ -prompt_dir: ./examples/prompts -profile_dir: ./examples/profiles +promptkit_sources: + - directory: ./examples/prompts + - directory: ./examples/profiles + - file: ./examples/framework/backends.yml schema_dir: ./examples/schemas server: diff --git a/examples/config-fragments/backend.yml b/examples/framework/backends.yml similarity index 50% rename from examples/config-fragments/backend.yml rename to examples/framework/backends.yml index 3f3e4e7..3701acd 100644 --- a/examples/config-fragments/backend.yml +++ b/examples/framework/backends.yml @@ -2,3 +2,7 @@ backends: local-gpu: endpoint: http://localhost:11434/v1 api_key_env: LOCAL_GPU_API_KEY + extra_params: + provider_option: enabled + concurrency_limit: 2 + queue_capacity: 0 diff --git a/examples/framework/inheritance.yml b/examples/framework/inheritance.yml new file mode 100644 index 0000000..78da0c3 --- /dev/null +++ b/examples/framework/inheritance.yml @@ -0,0 +1,13 @@ +backends: + local-base: + endpoint: http://localhost:11434/v1 + api_key_env: LOCAL_GPU_API_KEY + concurrency_limit: 2 + queue_capacity: 4 + extra_params: + provider_option: true + local-gpu: + extends: local-base + queue_capacity: 0 + extra_params: + provider_option: false diff --git a/examples/profiles/local-fast.yaml b/examples/profiles/local-fast.yaml index 80aeb45..c6e8f18 100644 --- a/examples/profiles/local-fast.yaml +++ b/examples/profiles/local-fast.yaml @@ -1,7 +1,8 @@ -id: local-fast -endpoint: http://localhost:8000/v1 -model: gpt-4o-mini -temperature: 0.2 -max_tokens: 500 -top_p: 1.0 -timeout_seconds: 90 +profiles: + local-fast: + endpoint: http://localhost:8000/v1 + model: gpt-4o-mini + temperature: 0.2 + max_tokens: 500 + top_p: 1.0 + timeout_seconds: 90 diff --git a/examples/profiles/local-gpu.yml b/examples/profiles/local-gpu.yml index af1ccd2..f4f8c18 100644 --- a/examples/profiles/local-gpu.yml +++ b/examples/profiles/local-gpu.yml @@ -1,4 +1,5 @@ -id: local-gpu -backend: local-gpu -model: local-model -reasoning_effort: low +profiles: + local-gpu: + backend: local-gpu + model: local-model + reasoning_effort: low diff --git a/examples/profiles/local-quality.yaml b/examples/profiles/local-quality.yaml index d3e70ff..9b3eceb 100644 --- a/examples/profiles/local-quality.yaml +++ b/examples/profiles/local-quality.yaml @@ -1,8 +1,9 @@ -id: local-quality -endpoint: http://localhost:8000/v1 -model: gpt-4.1 -temperature: 0.0 -max_tokens: 1200 -top_p: 1.0 -timeout_seconds: 180 -api_key_env: SCRIPTORIUM_API_KEY +profiles: + local-quality: + endpoint: http://localhost:8000/v1 + model: gpt-4.1 + temperature: 0.0 + max_tokens: 1200 + top_p: 1.0 + timeout_seconds: 180 + api_key_env: SCRIPTORIUM_API_KEY diff --git a/examples/prompts/dnd.session_recap.yaml b/examples/prompts/dnd.session_recap.yaml index ede6e14..d3f9623 100644 --- a/examples/prompts/dnd.session_recap.yaml +++ b/examples/prompts/dnd.session_recap.yaml @@ -1,22 +1,23 @@ -id: dnd.session_recap -version: "1.0.0" -default_profile: local-quality -description: Example D&D session recap prompt definition for demonstration only. -inputs: - - name: transcript - required: true - content_type: text/markdown - description: Session source content - - name: glossary - required: false - content_type: text/yaml - description: Optional glossary context -messages: - - role: system - content_file: ./dnd.session_recap.system.md - - role: user - content_file: ./dnd.session_recap.user.md -output: - format: markdown - validation_mode: basic - repair_attempts: 0 +prompts: + dnd.session_recap: + "1.0.0": + default_profile: local-quality + description: Example D&D session recap prompt definition for demonstration only. + inputs: + - name: transcript + required: true + content_type: text/markdown + description: Session source content + - name: glossary + required: false + content_type: text/yaml + description: Optional glossary context + messages: + - role: system + content_file: ./dnd.session_recap.system.md + - role: user + content_file: ./dnd.session_recap.user.md + output: + format: markdown + validation_mode: basic + repair_attempts: 0 diff --git a/examples/prompts/generic.markdown_summary.yaml b/examples/prompts/generic.markdown_summary.yaml index be95e53..a78c22e 100644 --- a/examples/prompts/generic.markdown_summary.yaml +++ b/examples/prompts/generic.markdown_summary.yaml @@ -1,22 +1,23 @@ -id: generic.markdown_summary -version: "1.0.0" -default_profile: local-fast -description: Generic markdown summary from transcript and glossary. -inputs: - - name: transcript - required: true - content_type: text/markdown - description: Source transcript content - - name: glossary - required: false - content_type: text/yaml - description: Optional glossary context -messages: - - role: system - content_file: ./generic.markdown_summary.system.md - - role: user - content_file: ./generic.markdown_summary.user.md -output: - format: markdown - validation_mode: basic - repair_attempts: 0 +prompts: + generic.markdown_summary: + "1.0.0": + default_profile: local-fast + description: Generic markdown summary from transcript and glossary. + inputs: + - name: transcript + required: true + content_type: text/markdown + description: Source transcript content + - name: glossary + required: false + content_type: text/yaml + description: Optional glossary context + messages: + - role: system + content_file: ./generic.markdown_summary.system.md + - role: user + content_file: ./generic.markdown_summary.user.md + output: + format: markdown + validation_mode: basic + repair_attempts: 0 diff --git a/examples/prompts/generic.structured_events.yaml b/examples/prompts/generic.structured_events.yaml index 213c32b..c055e27 100644 --- a/examples/prompts/generic.structured_events.yaml +++ b/examples/prompts/generic.structured_events.yaml @@ -1,23 +1,24 @@ -id: generic.structured_events -version: "1.0.0" -default_profile: local-quality -description: Produce structured event JSON from a transcript. -inputs: - - name: transcript - required: true - content_type: text/markdown - description: Source transcript content - - name: glossary - required: false - content_type: text/yaml - description: Optional glossary context -messages: - - role: system - content_file: ./generic.structured_events.system.md - - role: user - content_file: ./generic.structured_events.user.md -output: - format: json - validation_mode: json_schema - schema_path: structured_events.schema.json - repair_attempts: 0 +prompts: + generic.structured_events: + "1.0.0": + default_profile: local-quality + description: Produce structured event JSON from a transcript. + inputs: + - name: transcript + required: true + content_type: text/markdown + description: Source transcript content + - name: glossary + required: false + content_type: text/yaml + description: Optional glossary context + messages: + - role: system + content_file: ./generic.structured_events.system.md + - role: user + content_file: ./generic.structured_events.user.md + output: + format: json + validation_mode: json_schema + schema_path: structured_events.schema.json + repair_attempts: 0 diff --git a/testdata/promptkit-v0.9/config.yml b/testdata/promptkit-v0.9/config.yml index 9c0fbf6..0d14acc 100644 --- a/testdata/promptkit-v0.9/config.yml +++ b/testdata/promptkit-v0.9/config.yml @@ -1,12 +1,5 @@ -prompt_dir: ./testdata/promptkit-v0.9/prompts -profile_dir: ./testdata/promptkit-v0.9/profiles +promptkit_sources: + - directory: ./testdata/promptkit-v0.9/prompts + - directory: ./testdata/promptkit-v0.9/profiles + - file: ./testdata/promptkit-v0.9/framework/backends.yml schema_dir: ./testdata/promptkit-v0.9/schemas -backends: - fixture-custom: - endpoint: http://127.0.0.1:11434/v1 - api_key_env: FIXTURE_BACKEND_API_KEY - extra_params: - backend_option: - enabled: true - concurrency_limit: 2 - queue_capacity: 0 diff --git a/testdata/promptkit-v0.9/framework/backends.yml b/testdata/promptkit-v0.9/framework/backends.yml new file mode 100644 index 0000000..5fceb38 --- /dev/null +++ b/testdata/promptkit-v0.9/framework/backends.yml @@ -0,0 +1,9 @@ +backends: + fixture-custom: + endpoint: http://127.0.0.1:11434/v1 + api_key_env: FIXTURE_BACKEND_API_KEY + extra_params: + backend_option: + enabled: true + concurrency_limit: 2 + queue_capacity: 0 diff --git a/testdata/promptkit-v0.9/profiles/custom-base.yaml b/testdata/promptkit-v0.9/profiles/custom-base.yaml index 66c219c..09f5477 100644 --- a/testdata/promptkit-v0.9/profiles/custom-base.yaml +++ b/testdata/promptkit-v0.9/profiles/custom-base.yaml @@ -1,16 +1,17 @@ -id: custom-base -backend: fixture-custom -model: fixture-base-model -temperature: 0.25 -max_tokens: 640 -top_p: 0.9 -timeout_seconds: 45 -service_tier: flex -reasoning_effort: medium -api_key_env: FIXTURE_PROFILE_API_KEY -extra_params: - routing: - order: - - primary - - fallback - allow_fallback: true +profiles: + custom-base: + backend: fixture-custom + model: fixture-base-model + temperature: 0.25 + max_tokens: 640 + top_p: 0.9 + timeout_seconds: 45 + service_tier: flex + reasoning_effort: medium + api_key_env: FIXTURE_PROFILE_API_KEY + extra_params: + routing: + order: + - primary + - fallback + allow_fallback: true diff --git a/testdata/promptkit-v0.9/profiles/custom-derived.yml b/testdata/promptkit-v0.9/profiles/custom-derived.yml index 7d60463..4bd016b 100644 --- a/testdata/promptkit-v0.9/profiles/custom-derived.yml +++ b/testdata/promptkit-v0.9/profiles/custom-derived.yml @@ -1,4 +1,5 @@ -id: custom-derived -base_profile: custom-base -model: fixture-derived-model -reasoning_effort: high +profiles: + custom-derived: + extends: custom-base + model: fixture-derived-model + reasoning_effort: high diff --git a/testdata/promptkit-v0.9/profiles/endpoint-only.yaml b/testdata/promptkit-v0.9/profiles/endpoint-only.yaml index 0586652..849537c 100644 --- a/testdata/promptkit-v0.9/profiles/endpoint-only.yaml +++ b/testdata/promptkit-v0.9/profiles/endpoint-only.yaml @@ -1,10 +1,11 @@ -id: endpoint-only -endpoint: http://127.0.0.1:8000/v1 -model: fixture-endpoint-model -temperature: 0.1 -max_tokens: 128 -top_p: 0.75 -timeout_seconds: 30 -extra_params: - endpoint_option: - nested: true +profiles: + endpoint-only: + endpoint: http://127.0.0.1:8000/v1 + model: fixture-endpoint-model + temperature: 0.1 + max_tokens: 128 + top_p: 0.75 + timeout_seconds: 30 + extra_params: + endpoint_option: + nested: true diff --git a/testdata/promptkit-v0.9/prompts/complete-v1.yaml b/testdata/promptkit-v0.9/prompts/complete-v1.yaml index d27c9ae..be3549b 100644 --- a/testdata/promptkit-v0.9/prompts/complete-v1.yaml +++ b/testdata/promptkit-v0.9/prompts/complete-v1.yaml @@ -1,31 +1,41 @@ -id: compat.complete -version: "1.0.0" -description: Exercise the complete Promptkit v0.9 prompt-definition surface. -default_profile: custom-derived -session_id: 'fixture-{{.topic}}' -inputs: - - name: source - required: true - content_type: text/markdown - description: Source material rendered by a file-backed message. - - name: context - required: false - content_type: text/plain - description: Optional caller context. -messages: - - role: developer - content: 'Use the topic {{.topic}}.' - cache_control: - type: ephemeral - ttl: 1h - - role: system - content_file: ./messages/complete.system.md - - role: user - content_file: ./messages/complete.user.md - - role: assistant - content: Return one JSON object. -output: - format: json - validation_mode: json_schema - schema_path: complete.schema.json - repair_attempts: 2 +prompts: + compat.complete: + "1.0.0": + description: Exercise the complete Promptkit v0.9 prompt-definition surface. + default_profile: custom-derived + session_id: 'fixture-{{.topic}}' + inputs: + - name: source + required: true + content_type: text/markdown + description: Source material rendered by a file-backed message. + - name: context + required: false + content_type: text/plain + description: Optional caller context. + messages: + - role: developer + content: 'Use the topic {{.topic}}.' + cache_control: + type: ephemeral + ttl: 1h + - role: system + content_file: ./messages/complete.system.md + - role: user + content_file: ./messages/complete.user.md + - role: assistant + content: Return one JSON object. + output: + format: json + validation_mode: json_schema + schema_path: complete.schema.json + repair_attempts: 2 + "2.0.0": + default_profile: endpoint-only + messages: + - role: user + content: Version two has no declared inputs. + output: + format: text + validation_mode: basic + repair_attempts: 1 diff --git a/testdata/promptkit-v0.9/prompts/complete-v2.yml b/testdata/promptkit-v0.9/prompts/complete-v2.yml deleted file mode 100644 index 6af9c16..0000000 --- a/testdata/promptkit-v0.9/prompts/complete-v2.yml +++ /dev/null @@ -1,10 +0,0 @@ -id: compat.complete -version: "2.0.0" -default_profile: endpoint-only -messages: - - role: user - content: Version two has no declared inputs. -output: - format: text - validation_mode: basic - repair_attempts: 1 diff --git a/testdata/promptkit-v0.9/prompts/json.yaml b/testdata/promptkit-v0.9/prompts/json.yaml index 1fbbc1f..b4d8584 100644 --- a/testdata/promptkit-v0.9/prompts/json.yaml +++ b/testdata/promptkit-v0.9/prompts/json.yaml @@ -1,10 +1,11 @@ -id: compat.json -version: "1.0.0" -default_profile: endpoint-only -messages: - - role: user - content: Return JSON. -output: - format: json - validation_mode: json - repair_attempts: 0 +prompts: + compat.json: + "1.0.0": + default_profile: endpoint-only + messages: + - role: user + content: Return JSON. + output: + format: json + validation_mode: json + repair_attempts: 0 diff --git a/testdata/promptkit-v0.9/prompts/none.yaml b/testdata/promptkit-v0.9/prompts/none.yaml index 79aae45..c979d80 100644 --- a/testdata/promptkit-v0.9/prompts/none.yaml +++ b/testdata/promptkit-v0.9/prompts/none.yaml @@ -1,10 +1,11 @@ -id: compat.none -version: "1.0.0" -default_profile: endpoint-only -messages: - - role: user - content: Return text. -output: - format: text - validation_mode: none - repair_attempts: 0 +prompts: + compat.none: + "1.0.0": + default_profile: endpoint-only + messages: + - role: user + content: Return text. + output: + format: text + validation_mode: none + repair_attempts: 0