Gemini googleSearch grounding tool is dropped when running prompts via invoke / OpenAI-compat proxy
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- typescript
Rechercherichtung
Beginne damit, das Problem über prompt invoke und /v1/proxy/chat/completions mit dem Gemini googleSearch-Tool zu reproduzieren, und vergleiche anschließend die Anfrage mit dem nativen braintrustproxy.com generateContent-Pfad. Verfolge das Proxy-Routing und die Erkennung des Anfrageformats, die von diesen Einstiegspunkten verwendet werden. Als erledigt gilt die Aufgabe, wenn das Tool für Gemini-Anfragen weitergeleitet wird und groundingMetadata über den unterstützten Braintrust-Flow erzeugt werden kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
A Braintrust prompt configured with Gemini's search-grounding tool (tools: [{ "googleSearch": {} }]) does not perform grounding when the prompt is run through Braintrust (prompt invoke, experiments, or the /v1/proxy/chat/completions endpoint). The tool is silently dropped — the logged LLM span shows tools: null — so the model answers from training data only, and groundingMetadata is never produced.
This looks like the request-side root cause of braintrustdata/braintrust-sdk-javascript#1700 (grounding metadata not captured): grounding never actually runs via the OpenAI-compatible proxy path, so there is no metadata to capture.
Environment
braintrustJS SDK: 3.15.0- Model:
gemini-2.5-pro/gemini-2.5-flash - Prompt
prompt_data.tools:"[{\"googleSearch\":{}}]"
Reproduction
- Create a prompt for
gemini-2.5-prowhose tools array is the Gemini grounding tool[{ "googleSearch": {} }]. - Run it via the prompt
invokeAPI (or as an experiment task viainvoke()). - Inspect the logged LLM span.
Observed: span request metadata has tools: null; the model responds without searching; fields that require fresh web data come back empty. No groundingMetadata.
Direct proxy evidence
The OpenAI-compatible proxy rejects/drops the Gemini-native grounding tool:
# (A) googleSearch on the OpenAI-compat endpoint -> gateway error
curl https://api.braintrust.dev/v1/proxy/chat/completions \
-H "Authorization: Bearer $BT" -H "Content-Type: application/json" \
-d '{"model":"gemini-2.5-flash","messages":[{"role":"user","content":"latest news?"}],"tools":[{"googleSearch":{}}]}'
# -> "Braintrust gateway error: Unable to detect request source format"
# (B) {"type":"web_search"} -> same gateway error
# (C) a normal function tool (e.g. google_web_search) -> returned as finish_reason=tool_calls,
# never executed, so no grounding actually happens
The same grounding tool works through the native Google passthrough endpoint — but only on braintrustproxy.com, not api.braintrust.dev:
curl https://braintrustproxy.com/v1/proxy/google/models/gemini-2.5-flash:generateContent \
-H "Authorization: Bearer $BT" -H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"latest news?"}]}],"tools":[{"googleSearch":{}}]}'
# -> candidates[0].groundingMetadata present (webSearchQueries + groundingChunks)
For comparison, the same path on api.braintrust.dev returns HTTP 405 "Method POST not supported".
Expected
Running a prompt with the Gemini googleSearch grounding tool through Braintrust (invoke / experiments / playground) should forward it to Gemini so grounding actually runs — e.g. by routing gemini + googleSearch to the native generateContent request — instead of dropping the tool on the OpenAI-compatible path.
Workaround
Bypass invoke and call the native passthrough (https://braintrustproxy.com/v1/proxy/google/models/{model}:generateContent) with the native tools: [{ "googleSearch": {} }] body. Grounding runs and uses the Braintrust-configured Google key.
Related
- braintrustdata/braintrust-sdk-javascript#1700 — Google GenAI grounding metadata not captured (this issue is the request-side cause).
- Vorherrschende Sprache
- TypeScript
- Sterne
- 29
- Forks
- 21
- Ø Merge
- 1 T. 13 Std.
- Gemergte PRs (30 T.)
- 67
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus braintrustdata/braintrust-sdk-javascript
-
Pi Coding Agent instrumentation double-counts tokens and estimated cost in trace rollups (AgentSession.prompt carries summed LLM usage)Evtl. vergeben @sharonadhitya hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
braintrustdata/braintrust-sdk-javascript#2659 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
pi-coding-agent: Pi 1.4 system messages dropped, so LLM spans have no system prompt or toolsEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
braintrustdata/braintrust-sdk-javascript#2662 ·
Maintainer antworten meist innerhalb von 1 Tag
-
AI SDK tool spans don't respect `toModelOutput`Evtl. vergeben @AbhiPrasad hat das vor 3 Tagen übernommen. Offentypescript
braintrustdata/braintrust-sdk-javascript#2651 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
High TypeScript checking cost from generated Zod 3 schemasEvtl. vergeben @lforst hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
braintrustdata/braintrust-sdk-javascript#2624 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bot] Instrument Luma AI (17,324 weekly downloads)Evtl. vergeben @karthiksenv hat das vor 10 Tagen übernommen. Offentypescript
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
braintrustdata/braintrust-sdk-javascript#2578 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in braintrustdata/braintrust-sdk-javascript
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 70/100
microsoft/playwright#43640 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
grasshopper-protocol/grsshppr#172 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Tencent/teamai-cli#1397 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
DouyinFE/semi-design#3641 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag