diff --git a/python/README.md b/python/README.md index 596d296..60b5c6a 100644 --- a/python/README.md +++ b/python/README.md @@ -22,7 +22,7 @@ pip install "context-compiler-example-integrations" That installs the shared core dependency only: -- `context-compiler>=0.8.3` +- `context-compiler>=0.9.0dev13` Add extras only for the examples you want to inspect locally: diff --git a/python/examples/prompt_construction/litellm/README.md b/python/examples/prompt_construction/litellm/README.md index a85c92f..0cfeca2 100644 --- a/python/examples/prompt_construction/litellm/README.md +++ b/python/examples/prompt_construction/litellm/README.md @@ -8,6 +8,12 @@ with LiteLLM: - `basic.py`: compiler-only flow (no directive drafter) - `with_directive_drafter.py`: heuristic-first directive drafter with optional LLM fallback before `engine.step(...)` +Both flows use the current compiler API: create an `Engine`, pass the latest +input to `engine.step(...)`, and handle the returned decision object. The host +reads fields such as `decision.kind` and `decision.message`; it does not use +retired decision helper functions or derive authoritative state from model +output. + ## What the user sees - Compiler-only flow: @@ -54,7 +60,7 @@ pip install "context-compiler-example-integrations[litellm]" export OPENAI_API_KEY=... ``` -These examples require `context-compiler>=0.8.3`. +These examples require `context-compiler>=0.9.0dev13`. For `with_directive_drafter.py`: @@ -62,7 +68,7 @@ For `with_directive_drafter.py`: pip install "context-compiler-example-integrations[all]" ``` -That variant requires `context-compiler-directive-drafter>=0.1.2`. +That variant requires `context-compiler-directive-drafter>=0.2.0dev2`. ## Quickstart (copy/paste) @@ -174,7 +180,11 @@ In the related schema-selection example: - Conflict behavior (both): - `use docker` then `prohibit docker` -> conflict error. - Replacement precondition (both): - - `use podman instead of docker` without prior `use docker` -> replacement error. + - A replacement requires the source policy to exist first. + - `use podman instead of docker` without prior `use docker` returns an error + decision with failure `REPLACEMENT_SOURCE_MISSING`. + - Any repairs attached to that decision are advisory; they do not authorize + a state change. - Directive-adjacent abstain (`with_directive_drafter.py`): - `change premise concise replies` is classified as `unknown`, not rewritten, and handled by an engine error prompt. - Host-side request shaping (`python/examples/schema_selection/litellm_response_format/response_format.py`): diff --git a/python/reference_integrations/litellm_proxy/README.md b/python/reference_integrations/litellm_proxy/README.md index 0bf1f86..39d374b 100644 --- a/python/reference_integrations/litellm_proxy/README.md +++ b/python/reference_integrations/litellm_proxy/README.md @@ -26,6 +26,9 @@ Available hook files: - In stateless mode, no continuity is preserved across requests. - If directive application fails, the proxy does not call the downstream model and LiteLLM surfaces the rejection as an HTTP 400 response. +- Replacements require an existing source policy. A missing source produces an + error decision with failure `REPLACEMENT_SOURCE_MISSING`; repairs on that + decision are advisory and do not authorize a state change. - If result is `passthrough`, the proxy forwards the request normally. - If result is `update`, the proxy injects compiler state as a system message and then calls the model. @@ -105,7 +108,7 @@ For `context_compiler_precall_hook_with_directive_drafter.py`: pip install "context-compiler-example-integrations[all]" ``` -That variant requires `context-compiler-directive-drafter>=0.1.2`. +That variant requires `context-compiler-directive-drafter>=0.2.0dev2`. For the opt-in runtime smoke test, install the proxy runtime extras: diff --git a/python/reference_integrations/openwebui_pipe/README.md b/python/reference_integrations/openwebui_pipe/README.md index 76f975c..d45b6b4 100644 --- a/python/reference_integrations/openwebui_pipe/README.md +++ b/python/reference_integrations/openwebui_pipe/README.md @@ -12,6 +12,9 @@ without Directive Drafter preprocessing. `[[cc_state]]` system message in the forwarded request. - Conflicting or invalid updates are rejected for the current request and do not create resumable continuation state. +- A replacement is valid only when its source policy already exists. If the + source is missing, `engine.step(...)` returns an error decision with failure + `REPLACEMENT_SOURCE_MISSING`; any attached repairs are advisory. - The pipe handles exact `show state` locally. The pipe treats near matches such as `show state please` as normal chat input. @@ -53,7 +56,7 @@ Open WebUI is a separate runtime and must already be installed/configured separa Open WebUI also needs at least one real backend model/provider configured (for example Ollama or OpenAI) so `BASE_MODEL_ID` resolves to an actual model. Note: The `PROVIDER` environment contract used in LiteLLM examples/demos does not apply to OpenWebUI. OpenWebUI manages providers via its own connection settings and model IDs. -These examples require `context-compiler>=0.8.3`. +These examples require `context-compiler>=0.9.0dev13`. ### Configuration @@ -65,7 +68,7 @@ These examples require `context-compiler>=0.8.3`. If using `open_webui_pipe_with_directive_drafter.py`: - Install directive-drafter support if needed: - `pip install "context-compiler>=0.8.3" "context-compiler-directive-drafter>=0.1.2"` + `pip install "context-compiler>=0.9.0dev13" "context-compiler-directive-drafter>=0.2.0dev2"` - Set `PREPROCESSOR_PROMPT_PROFILE=default` for heuristic-first behavior - Optionally set `PREPROCESSOR_MODEL_ID` to use a separate fallback drafting model - If `PREPROCESSOR_MODEL_ID` is unset, fallback uses `BASE_MODEL_ID` @@ -82,8 +85,8 @@ If frontmatter dependency installs are disabled, offline, or unavailable: 1. Install the package manually: -- Minimal pipe: `pip install "context-compiler>=0.8.3"` -- Directive Drafter pipe: `pip install "context-compiler>=0.8.3" "context-compiler-directive-drafter>=0.1.2"` +- Minimal pipe: `pip install "context-compiler>=0.9.0dev13"` +- Directive Drafter pipe: `pip install "context-compiler>=0.9.0dev13" "context-compiler-directive-drafter>=0.2.0dev2"` 1. Import and enable the function in Open WebUI, then configure valves. @@ -226,7 +229,7 @@ These examples support both sync (`0.8.x`) and async (`0.9.x`) user lookup. - `PREPROCESSOR_MODEL_ID must not match the selected pipe model id`: choose a real backend model id, not the pipe model id itself. - `PREPROCESSOR_MODEL_ID is invalid or not configured in Open WebUI`: the fallback route hit a missing model; fix the configured fallback model or unset it to reuse `BASE_MODEL_ID`. - `ALLOW_MISSING_BASE_MODEL_FOR_DEBUG=true`: directive-only updates still run locally, but passthrough returns a deterministic debug message instead of calling a downstream model. -- imports fail after function upload: install `context-compiler>=0.8.3` in the Open WebUI runtime, and add `context-compiler-directive-drafter>=0.1.2` only for the Directive Drafter pipe, because the copied function runs from a temp/cached location. +- imports fail after function upload: install `context-compiler>=0.9.0dev13` in the Open WebUI runtime, and add `context-compiler-directive-drafter>=0.2.0dev2` only for the Directive Drafter pipe, because the copied function runs from a temp/cached location. ## Fallback notes diff --git a/python/reference_integrations/openwebui_pipe/open_webui_pipe.py b/python/reference_integrations/openwebui_pipe/open_webui_pipe.py index 6ad6197..42f45d8 100644 --- a/python/reference_integrations/openwebui_pipe/open_webui_pipe.py +++ b/python/reference_integrations/openwebui_pipe/open_webui_pipe.py @@ -3,7 +3,7 @@ author: rlippmann author_url: https://github.com/rlippmann/context-compiler-example-integrations version: 0.9.4 -requirements: context-compiler>=0.8.3 +requirements: context-compiler>=0.9.0dev13 Minimal Open WebUI Pipe integration for Context Compiler. diff --git a/python/reference_integrations/openwebui_pipe/open_webui_pipe_with_directive_drafter.py b/python/reference_integrations/openwebui_pipe/open_webui_pipe_with_directive_drafter.py index fc7e761..e4e404a 100644 --- a/python/reference_integrations/openwebui_pipe/open_webui_pipe_with_directive_drafter.py +++ b/python/reference_integrations/openwebui_pipe/open_webui_pipe_with_directive_drafter.py @@ -3,7 +3,7 @@ author: rlippmann author_url: https://github.com/rlippmann/context-compiler-example-integrations version: 0.9.4 -requirements: context-compiler>=0.8.3, context-compiler-directive-drafter>=0.1.2 +requirements: context-compiler>=0.9.0dev13, context-compiler-directive-drafter>=0.2.0dev2 Open WebUI integration with Context Compiler directive drafter.