Skip to content

Conversation

@mikebranc
Copy link
Contributor

@mikebranc mikebranc commented Sep 30, 2025

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:

  • chat messages
  • function calls/outputs
  • reasoning
  • OpenAI tools (web search, remote MCPs, etc)

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:

Error occurred during execution: add_llm_span: 1 validation error for LlmSpan
input
  Value error, LLM span input must be a Message, a list of Messages, a dict, a list of dicts, or a string. [type=value_error, input_value=[{'role': 'user', 'conten...efriend a baby otter.'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.11/v/value_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

@mikebranc mikebranc requested a review from a team as a code owner September 30, 2025 22:15
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 83.05085% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.70%. Comparing base (18aef69) to head (c475761).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/galileo/openai.py 83.05% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
- Coverage   83.76%   83.70%   -0.07%     
==========================================
  Files          56       56              
  Lines        3961     4117     +156     
==========================================
+ Hits         3318     3446     +128     
- Misses        643      671      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mikebranc mikebranc force-pushed the feat/add-responses-api-to-openai-sdk branch from cd7241f to e9f456d Compare October 1, 2025 14:01
@nachiket-galileo
Copy link
Contributor

@mikebranc Please get a review and approval from @savula15 on this

@mikebranc
Copy link
Contributor Author

@mikebranc Please get a review and approval from @savula15 on this

Will do!

@mikebranc mikebranc force-pushed the feat/add-responses-api-to-openai-sdk branch from e9f456d to c475761 Compare October 1, 2025 15:23
@mikebranc mikebranc force-pushed the feat/add-responses-api-to-openai-sdk branch from 0cb5d64 to c558d07 Compare October 6, 2025 17:02
@mikebranc mikebranc changed the title feat: Add matching support for responses API feat: Add support for responses API Oct 6, 2025
@mikebranc mikebranc changed the title feat: Add support for responses API (WIP) feat: Add support for responses API Oct 6, 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.

3 participants