feat(websearch): add provider-native hosted search tools and local search providers - #33
Conversation
Deploying crabcode with
|
| Latest commit: |
10fe613
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4ddaac1e.crabcode.pages.dev |
| Branch Preview URL: | https://feat-configurable-websearch.crabcode.pages.dev |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…arch providers Add `websearch.native` config to enable provider-executed search tools (web search, x_search) alongside local search adapters. Introduces `ToolTransport` enum to distinguish client vs provider-native tools in the aisdk layer. - New `hosted_search` module with tool definitions for OpenAI, xAI, Anthropic, and OpenRouter - Provider-native tools are passed through as-is in request bodies (Anthropic beta header, OpenAI Responses, OpenRouter plugins) - `native.web` substitutes local websearch when provider supports it; `native.x` is a complement (xAI x_search) - Add Parallel and Tako as local websearch providers - Update Anthropic/OpenAI/OpenAI-compatible providers to route `ProviderNative` and `OpenRouterPlugin` transports - Filter hosted search SSE events from client tool accumulator in OpenAI provider - Update config docs with native search, cost tables, and provider table
8bab3a8 to
9abb2b1
Compare
Add `ChunkType::ProviderToolCall` to represent server-side tool lifecycle (hosted search, x_search, file_search) without entering the client tool-execute loop. - Parse Anthropic `server_tool_use` / `web_search_tool_result` SSE events - Parse OpenAI hosted search SSE events (web_search, x_search, file_search, custom_tool_call) - Forward `ProviderToolCall` through subagent and response streams - Convert provider tool payloads into UI ToolCalls / ToolResult events in `client.rs` - Upsert tool call parts in app to handle running→completed transitions with same id - Skip provider-executed parts when replaying message history to API
|
Also added /v1/responses for the xai provider when using grok models. Since it's the only path to display x_search in toolcall cards. |
- It was sending /v1/v1/responses so it was crashing - Map `@openrouter/ai-sdk-provider` npm package to `ProviderKind::OpenAICompatible` - Add test verifying OpenRouter routes through the OpenAI-compatible chat completions path
… preview for provider-executed search Hosted search completed events sometimes omit sources or wipe the query to ""; this caused the TUI to show stub previews and lose the original search arguments. - Add `hosted_search_args_are_hollow` to detect empty/blank search args - Add `hosted_search_output_preview` that formats sources from args when output is missing - Prefer running tool_call args over hollow result args in both app.rs and chat.rs - Change provider-executed tool result status from "completed" to "ok" so TUI renders output_preview - Make `SearchItem` and `format_results` in websearch.rs pub(crate) for reuse - Add tests for preview formatting and hollow args detection
|
Fixed a bug with openrouter as well. It was sending to /v1/v1/responses, lol. Never tried openrouter before so... Also u need a credit card to use native websearch on openrouter. |
PR Review:
|
TLDR
Lets models use provider-hosted web search (OpenAI, Anthropic, xAI, OpenRouter) via
websearch.native, instead of only local search adapters — plus Parallel & Tako as new local providers.websearch.x: nativeadds X/Twitter search (xAI only).Add
websearch.nativeconfig to enable provider-executed search tools (web search, x_search) alongside local search adapters. IntroducesToolTransportenum to distinguish client vs provider-native tools in the aisdk layer.hosted_searchmodule with tool definitions for OpenAI, xAI, Anthropic, and OpenRouternative.websubstitutes local websearch when provider supports it;native.xis a complement (xAI x_search)ProviderNativeandOpenRouterPlugintransports