feat: support extra field in chatcompletion tool_calls for gemini openai compat#6184
Conversation
There was a problem hiding this comment.
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
|
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 :) |
c4586c6 to
7f0d13b
Compare
DOsinga
left a comment
There was a problem hiding this comment.
I think we can undo the import changes and maybe remove the comments that are trivial (my pet peeve) and then get it in. thanks for doing this!
crates/goose/src/providers/openai.rs
Outdated
| @@ -1,3 +1,15 @@ | |||
| use anyhow::Result; | |||
There was a problem hiding this comment.
this is just reshuffling the order, yes?
DOsinga
left a comment
There was a problem hiding this comment.
sorry for the very slow service. would still love to get this in, but I can also fork it and get it over the finish line myself given how slow we've been
…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>
579b1e0 to
a84acae
Compare
🤖 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>
a84acae to
6853ce5
Compare
* origin/main: feat: support extra field in chatcompletion tool_calls for gemini openai compat (#6184)
…provenance * origin/main: (68 commits) Upgraded npm packages for latest security updates (#7183) docs: reasoning effort levels for Codex provider (#6798) Fix speech local (#7181) chore: add .gooseignore to .gitignore (#6826) Improve error message logging from electron (#7130) chore(deps): bump jsonwebtoken from 9.3.1 to 10.3.0 (#6924) docs: standalone mcp apps and apps extension (#6791) workflow: auto-update cli-commands on release (#6755) feat(apps): Integrate AppRenderer from @mcp-ui/client SDK (#7013) fix(MCP): decode resource content (#7155) feat: reasoning_content in API for reasoning models (#6322) Fix/configure add provider custom headers (#7157) fix: handle keyring fallback as success (#7177) Update process-wrap to 9.0.3 (9.0.2 is yanked) (#7176) feat: support extra field in chatcompletion tool_calls for gemini openai compat (#6184) fix: replace panic with proper error handling in get_tokenizer (#7175) Lifei/smoke test for developer (#7174) fix text editor view broken (#7167) docs: White label guide (#6857) Add PATH detection back to developer extension (#7161) ... # Conflicts: # .github/workflows/nightly.yml
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)