-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: support extra field in chatcompletion tool_calls for gemini openai compat #6184
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for arbitrary extra fields in OpenAI-compatible chat completion tool calls to handle provider-specific metadata like Gemini's thought_signature and Databricks' thoughtSignature. This fixes 400 errors when using tools with gemini-3 models through Databricks.
- Adds an
extrafield with#[serde(flatten)]toDeltaToolCallto capture non-standard fields - Updates message formatting to include metadata fields in outgoing tool call requests
- Extracts and preserves extra fields from responses in both streaming and non-streaming paths
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/goose/src/providers/openai.rs |
Reorganizes imports (moved to top of file) |
crates/goose/src/providers/formats/openai.rs |
Adds extra field to DeltaToolCall, updates format_messages to include metadata in tool calls, extracts extra fields in response_to_message and streaming handler, adds comprehensive tests |
crates/goose/src/providers/formats/databricks.rs |
Updates format_messages to include metadata in tool calls (mirrors OpenAI changes), adds tests for metadata handling |
f7c815b to
e66647c
Compare
e66647c to
c4586c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
|
we just merged: #6035 which does something similar - can you check whether that covers your intentions? it feels like it is doing both more (handling the thought signatures) and also less (doesn't store all meta information) |
|
@DOsinga I tried with #6035 but it didn't seem to resolve scenarios in which the goose provider is parsing responses as OpenAI-compatible responses using |
|
I can validate that in the latest release 1.18.0 this issue is still present, so please share a fix ASAP. We want to use this dirt cheap and fast Gemini 3 flash model :) |
…tc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Brandon Kvarda <brandon.kvarda@databricks.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Brandon Kvarda <brandon.kvarda@databricks.com>
c4586c6 to
7f0d13b
Compare
Summary
Various model providers have started including additional fields in in tool_calls of openai-compatible(ish) chatcompletion responses, for example gemini's
thought_signatureand databricks'thoughtSignature. This change adds anextraMap field inDeltaToolCallFunctionto support arbitrary additional fields. Then added inclusion of these additional fields in databricksformat_messageswhich fixes400: content block is missing a thought_signatureerrors when trying to use tools w/ gemini-3 in databricks.Type of Change
AI Assistance
Testing
Added unit tests and tested manually with
databricks-gemini-3-proanddatabricks-gemini-3-flashScreenshots/Demos (for UX changes)