chore: remove broken googleSearch grounding and /v1/search endpoint
This commit is contained in:
@@ -313,7 +313,17 @@ pub fn modify_request(body: &[u8], tool_ctx: Option<&ToolContext>) -> Option<Vec
|
||||
// ── 4. Inject includeThoughts to capture thinking text ───────────────
|
||||
// Without this flag, Google only reports thinking token counts
|
||||
// but doesn't send the thinking text in SSE parts.
|
||||
//
|
||||
// Also inject thinkingLevel if client specified reasoning_effort.
|
||||
// Gemini 3 uses thinkingLevel ("low"/"medium"/"high"/"minimal")
|
||||
// instead of Gemini 2.5's thinkingBudget (integer).
|
||||
{
|
||||
// Get reasoning_effort from generation params if available
|
||||
let reasoning_effort = tool_ctx
|
||||
.as_ref()
|
||||
.and_then(|ctx| ctx.generation_params.as_ref())
|
||||
.and_then(|gp| gp.reasoning_effort.clone());
|
||||
|
||||
// Ensure request.generationConfig.thinkingConfig.includeThoughts = true
|
||||
let request = json.get_mut("request").and_then(|v| v.as_object_mut());
|
||||
if let Some(req) = request {
|
||||
@@ -329,6 +339,10 @@ pub fn modify_request(body: &[u8], tool_ctx: Option<&ToolContext>) -> Option<Vec
|
||||
tc.insert("includeThoughts".to_string(), Value::Bool(true));
|
||||
changes.push("inject includeThoughts".to_string());
|
||||
}
|
||||
if let Some(ref effort) = reasoning_effort {
|
||||
tc.insert("thinkingLevel".to_string(), Value::String(effort.clone()));
|
||||
changes.push(format!("inject thinkingLevel={effort}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -346,6 +360,10 @@ pub fn modify_request(body: &[u8], tool_ctx: Option<&ToolContext>) -> Option<Vec
|
||||
tc.insert("includeThoughts".to_string(), Value::Bool(true));
|
||||
changes.push("inject includeThoughts (top-level)".to_string());
|
||||
}
|
||||
if let Some(ref effort) = reasoning_effort {
|
||||
tc.insert("thinkingLevel".to_string(), Value::String(effort.clone()));
|
||||
changes.push(format!("inject thinkingLevel={effort} (top-level)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,6 +417,14 @@ pub fn modify_request(body: &[u8], tool_ctx: Option<&ToolContext>) -> Option<Vec
|
||||
gc.insert("presencePenalty".to_string(), serde_json::json!(pp));
|
||||
injected.push(format!("presencePenalty={pp}"));
|
||||
}
|
||||
if let Some(ref mime) = gp.response_mime_type {
|
||||
gc.insert("responseMimeType".to_string(), serde_json::json!(mime));
|
||||
injected.push(format!("responseMimeType={mime}"));
|
||||
}
|
||||
if let Some(ref schema) = gp.response_schema {
|
||||
gc.insert("responseSchema".to_string(), schema.clone());
|
||||
injected.push("responseSchema=<schema>".to_string());
|
||||
}
|
||||
|
||||
if !injected.is_empty() {
|
||||
changes.push(format!("inject generationConfig: {}", injected.join(", ")));
|
||||
@@ -428,6 +454,8 @@ pub fn modify_request(body: &[u8], tool_ctx: Option<&ToolContext>) -> Option<Vec
|
||||
changes.join(", ")
|
||||
);
|
||||
|
||||
|
||||
|
||||
Some(modified_bytes)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user