refactor: simplify LiteLLM DirectiveDrafter example boundary - #65
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor the LiteLLM prompt-construction DirectiveDrafter example to consume the current
DirectiveDrafterpublic boundary instead of duplicating drafter behavior in the example.This PR updates the example to:
DirectiveDrafter.draft_directive(...)DraftResultvariants explicitlyengine.premiseandengine.policiesWhy
The example had drifted away from the intended consumer boundary and was still re-implementing pieces of drafter behavior locally. That made the example misleading as documentation and also masked live behavior issues during end-to-end testing.
This change keeps the example focused on the provider/drafter/compiler handoff and updates the tests to verify the public API seam instead of internal helper behavior.
Example metadata
Checklist
Notes
Focused validation run for the changed files:
uv run --no-sync pytest python/tests/test_litellm_with_directive_drafter.pyuv run --no-sync ruff check python/examples/prompt_construction/litellm/with_directive_drafter.py python/tests/test_litellm_with_directive_drafter.pyuv run --no-sync mypy python/examples/prompt_construction/litellm/with_directive_drafter.py python/tests/test_litellm_with_directive_drafter.pyLive testing against local Ollama on Monday, August 10, 2026 exposed that the example still over-applies drafted directives on some ordinary conversational turns. This PR keeps the boundary cleanup and test refactor in place, but the live test results indicate there is still follow-up behavior work to do in the example flow.