Web Search
Spice provides web search functionality through OpenAI's hosted tools, enabling access to recent information and relevant context.
The websearch tool (backed by Perplexity) is no longer supported and was deprecated in spiceai/spiceai#9910. Use OpenAI's hosted web search tool as described below.
Web Search Through OpenAI Hosted Tools
Spice supports web search using OpenAI's hosted web search tool when using OpenAI's Responses API. Sample Spicepod configuration:
models:
- from: openai:gpt-4o-mini # Or any other model supported by OpenAI's Responses API
name: openai_model
params:
openai_api_key: ${secrets:OPENAI_API_KEY}
tools: auto
responses_api: enabled # Required for using web search
openai_responses_tools: web_search # Allowlist the web search tool via OpenAI's Responses API
Sample Usage (with the above configuration)
Start Spice with spice run. Then, execute the following command, which makes a request to the /v1/responses endpoint.
curl -s -H "Content-Type: application/json" -X POST "http://localhost:8090/v1/responses" -d '{"model": "openai_model", "input": "what is the latest news today? use the web search tool"}' | jq -r '.output[] | select(.type=="message") | .content[] | select(.type=="output_text") | .text'
To invoke this model, use spice chat --responses for an interactive REPL or the OpenAI-compatible /v1/responses HTTP endpoint in the runtime. To learn more about configuring models provided by OpenAI, view the reference.
