-
Notifications
You must be signed in to change notification settings - Fork 17
Updating examples with conversation history #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates examples and documentation to implement conversation history best practices, specifically ensuring user messages are only added to conversation history after guardrails pass. The changes also remove deprecated stage_name configuration that is no longer used.
Key changes:
- All examples now pass user input inline without mutating message history first
- Message history is only updated after guardrail validation succeeds
- Documentation added to explain this pattern and why it prevents blocked messages from polluting context
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_runtime.py | Added tests to verify stage_name parameter is rejected in configuration |
| src/guardrails/runtime.py | Removed stage_name from ConfigBundle attributes and stopped passing it to run_guardrails |
| examples/internal_examples/custom_context.py | Updated to pass messages inline and only append after guardrails pass |
| examples/implementation_code/streaming/streaming_completions.py | Updated with inline message passing pattern and response accumulation |
| examples/implementation_code/blocking/blocking_completions.py | Updated with inline message passing pattern |
| examples/hallucination_detection/run_hallucination_detection.py | Updated with inline message passing pattern |
| examples/basic/structured_outputs_example.py | Updated to use previous_response_id for conversation history management |
| examples/basic/pii_mask_example.py | Updated with inline message passing pattern and moved system message to initial messages list |
| examples/basic/multiturn_chat_with_alignment.py | Updated with inline message passing for both initial calls and tool result calls |
| examples/basic/azure_implementation.py | Updated with inline message passing pattern |
| docs/quickstart.md | Added new section explaining multi-turn conversation best practices |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
examples/implementation_code/streaming/streaming_completions.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
gabor-openai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thank you
quickstart.mdto explain thisstage_namebeing passed in through the config (dead code no longer used)