Compare commits

...

1 Commits

Author SHA1 Message Date
pakrym-oai
8285546465 Cached search 2026-01-05 16:43:17 -08:00
2 changed files with 11 additions and 5 deletions

View File

@@ -193,10 +193,8 @@ pub(crate) mod tools {
Function(ResponsesApiTool),
#[serde(rename = "local_shell")]
LocalShell {},
// TODO: Understand why we get an error on web_search although the API docs say it's supported.
// https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses#:~:text=%7B%20type%3A%20%22web_search%22%20%7D%2C
#[serde(rename = "web_search")]
WebSearch {},
WebSearch(WebSearchTool),
#[serde(rename = "custom")]
Freeform(FreeformTool),
}
@@ -206,7 +204,7 @@ pub(crate) mod tools {
match self {
ToolSpec::Function(tool) => tool.name.as_str(),
ToolSpec::LocalShell {} => "local_shell",
ToolSpec::WebSearch {} => "web_search",
ToolSpec::WebSearch(_) => "web_search",
ToolSpec::Freeform(tool) => tool.name.as_str(),
}
}
@@ -236,6 +234,11 @@ pub(crate) mod tools {
pub(crate) strict: bool,
pub(crate) parameters: JsonSchema,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct WebSearchTool {
pub(crate) external_web_access: bool,
}
}
pub struct ResponseStream {

View File

@@ -1,5 +1,6 @@
use crate::client_common::tools::ResponsesApiTool;
use crate::client_common::tools::ToolSpec;
use crate::client_common::tools::WebSearchTool;
use crate::features::Feature;
use crate::features::Features;
use crate::models_manager::model_family::ModelFamily;
@@ -1094,7 +1095,9 @@ pub(crate) fn build_specs(
}
if config.web_search_request {
builder.push_spec(ToolSpec::WebSearch {});
builder.push_spec(ToolSpec::WebSearch(WebSearchTool {
external_web_access: false,
}));
}
if config.include_view_image_tool {