Skip to content

Allow previous_response_id to be passed to input guardrails #591

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

Closed
wants to merge 1 commit into from

Conversation

rm-openai
Copy link
Collaborator

@rm-openai rm-openai commented Apr 24, 2025

Input guardrails are expected to run on the full input, so passing the previous_response_id along. For back-compat, introducing a new signature for the guardrail. Using a dataclass for the inputs so we can extend in the future easily.

@rm-openai rm-openai requested a review from pakrym-oai April 24, 2025 17:46
@pakrym-oai
Copy link
Contributor

pakrym-oai commented Apr 24, 2025

Did you consider adding a field to RunContextWrapper instead?

@rm-openai
Copy link
Collaborator Author

rm-openai commented Apr 24, 2025

@pakrym-oai yes. Decided not to, because RunContextWrapper is the same across multiple LLM calls in a single run (and hence the previous response ID changes)

@rm-openai
Copy link
Collaborator Author

After offline discussion: previous_response_id is spreading all over, and we should do this better. Workaround for end-users for now, is to add the ID to the context and use it in guardrails.

@rm-openai rm-openai closed this Apr 24, 2025
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.

2 participants