(WIP) feat: Add support for responses API #342
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.
This PR adds support for the OpenAI responses API. We also fix a bug in both the completions and responses API which prevents a list of messages being sent as an input to Galileo.
PR Status
This branch was used for a demo and is still a work in progress. There are some tests written, but this code should be reviewed and tested. There is a lot of new functionality introduced by the responses API so we likely will want to make updates to Galileo core and our UI to better show things like reasoning
Shortcut: https://app.shortcut.com/galileo/story/29671/python-sdk-add-support-for-the-new-openai-responses-api-in-the-client-wrapper
Responses API support
This PR adds support for the responses API. Currently, OpenAI Responses API requests made via the SDK wrapper aren't logged at all. This includes support for logging the following:
More info on the migration to the Responses API: https://platform.openai.com/docs/guides/migrate-to-responses
Bug Fix
In addition to adding support for responses, we also resolve the following bug.
When users sent in message lists, we would get the following error:
To resolve this we format each message as a Galileo Message source
UI Display Updates
In order for messages to show up properly in the UI, we also have wrapped our response in
{'messages' : []}. Additionally, as traces are added, we add the cumulative input and output up to that point so they display properly.Example Traces
Look at the following example traces to see how they are showing up in Galileo. If you can't see these, ping me on slack and I'll get you added to the project in dev.
Responses API
Responses API Simple call
Responses API multiple messages with tool/function calls
Deep Research
MCP calls with reasoning
Web Search with reasoning
Completions API
Completions API Simple call
Completions API multiple messages with tool/function calls
Note that the tool calling example is based on the OpenAI docs example: https://platform.openai.com/docs/guides/function-calling