Skip to content

Conversation

@steven10a
Copy link
Collaborator

  • Adding guidance to dev's on conversation history best practices. I.e, don't store user message until guardrails have passed
  • Updated all examples with this best practice
  • Added a brief section in the quickstart.md to explain this
  • Removed stage_name being passed in through the config (dead code no longer used)

Copilot AI review requested due to automatic review settings October 20, 2025 16:56
Copy link

Copilot AI left a 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.

@steven10a steven10a requested a review from Copilot October 20, 2025 17:06
Copy link

Copilot AI left a 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 gabor-openai self-requested a review October 20, 2025 18:01
Copy link
Collaborator

@gabor-openai gabor-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you

@gabor-openai gabor-openai merged commit 77456ce into main Oct 20, 2025
3 checks passed
@gabor-openai gabor-openai deleted the dev/steven/clear_messages branch October 20, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants