Skip to content

feat: Add "instructions" support to responses API#2205

Merged
ashwinb merged 1 commit into
ogx-ai:mainfrom
derekhiggins:instructions
May 20, 2025
Merged

feat: Add "instructions" support to responses API#2205
ashwinb merged 1 commit into
ogx-ai:mainfrom
derekhiggins:instructions

Conversation

@derekhiggins
Copy link
Copy Markdown
Contributor

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

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>
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label 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)
Copy link
Copy Markdown
Contributor

@ashwinb ashwinb May 19, 2025

Choose a reason for hiding this comment

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

nit: why prepend? why not start messages with instruction first and append later?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 ashwinb merged commit 3339844 into ogx-ai:main May 20, 2025
24 checks passed
@derekhiggins derekhiggins deleted the instructions branch December 9, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants