feat: Add "instructions" support to responses API#2205
Merged
Conversation
Add support for "instructions" to the responses API. Instructions provide a way to swap out system (or developer) messages in new responses. Signed-off-by: Derek Higgins <derekh@redhat.com>
ashwinb
reviewed
May 19, 2025
|
|
||
| input = await self._prepend_previous_response(input, previous_response_id) | ||
| messages = await _convert_response_input_to_chat_messages(input) | ||
| await self._prepend_instructions(messages, instructions) |
Contributor
There was a problem hiding this comment.
nit: why prepend? why not start messages with instruction first and append later?
Contributor
Author
There was a problem hiding this comment.
messages comes out of _convert_response_input_to_chat_messages, to start it with instructions I would need to pass instructions into _convert_response_input_to_chat_messages and start it in there, I can do this it just didn't seem relevant to the functions purpose.
ashwinb
approved these changes
May 20, 2025
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.
What does this PR do?
Add support for "instructions" to the responses API. Instructions provide a way to swap out system (or developer) messages in new responses.
Test Plan
unit tests added