Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Gemini googleSearch grounding tool is dropped when running prompts via invoke / OpenAI-compat proxy

Abierto
#2,085 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
ai, api, backend

Línea de trabajo

Empieza reproduciendo el problema mediante prompt invoke y /v1/proxy/chat/completions con la herramienta googleSearch de Gemini; después, compara la solicitud con la ruta nativa braintrustproxy.com generateContent. Rastrea el enrutamiento del proxy y la detección del formato de solicitud utilizados por estos puntos de entrada. Se considera completado cuando la herramienta se reenvía para las solicitudes de Gemini y groundingMetadata puede generarse mediante el flujo de Braintrust compatible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

  • braintrust JS SDK: 3.15.0
  • Model: gemini-2.5-pro / gemini-2.5-flash
  • Prompt prompt_data.tools: "[{\"googleSearch\":{}}]"

Reproduction

  1. Create a prompt for gemini-2.5-pro whose tools array is the Gemini grounding tool [{ "googleSearch": {} }].
  2. Run it via the prompt invoke API (or as an experiment task via invoke()).
  3. 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).
Lenguaje dominante
TypeScript
Estrellas
28
Forks
15
Merge medio
1 d 20 h
PR fusionados (30 d)
70

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de braintrustdata/braintrust-sdk-javascript

Todos los issues de braintrustdata/braintrust-sdk-javascript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.