fix: Ensures final output tool is available when using vector tool search (#3701)
This commit is contained in:
@@ -372,7 +372,7 @@ impl Agent {
|
||||
|| tool_call.name == ROUTER_LLM_SEARCH_TOOL_NAME
|
||||
{
|
||||
let selector = self.router_tool_selector.lock().await.clone();
|
||||
let selected_tools = match selector.as_ref() {
|
||||
let mut selected_tools = match selector.as_ref() {
|
||||
Some(selector) => match selector.select_tools(tool_call.arguments.clone()).await {
|
||||
Ok(tools) => tools,
|
||||
Err(e) => {
|
||||
@@ -394,6 +394,19 @@ impl Agent {
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
// Append final_output tool if present (for structured output recipes, [Issue #3700](https://github.com/block/goose/issues/3700)
|
||||
if let Some(final_output_tool) = self.final_output_tool.lock().await.as_ref() {
|
||||
let tool = final_output_tool.tool();
|
||||
let tool_content = Content::text(format!(
|
||||
"Tool: {}\nDescription: {}\nSchema: {}",
|
||||
tool.name,
|
||||
tool.description.unwrap_or_default(),
|
||||
serde_json::to_string_pretty(&tool.input_schema).unwrap_or_default()
|
||||
));
|
||||
selected_tools.push(tool_content);
|
||||
}
|
||||
|
||||
ToolCallResult::from(Ok(selected_tools))
|
||||
} else {
|
||||
// Clone the result to ensure no references to extension_manager are returned
|
||||
|
||||
Reference in New Issue
Block a user