Skip to main content

Web Search & Tool Retrieval

Web search allows model completions to query search indexes dynamically to retrieve real-time facts before generating answers.


1. How Web Search Works

GoingMerry supports integrating web search endpoints directly into local reasoning runs. When a user prompt requires real-time facts:

  1. The model compiles a search query.
  2. The orchestrator calls your configured search endpoint (such as Tavily, Bing Search, or SearXNG).
  3. The context results are injected back into the prompt context for generation.

2. Setting Up Search Tools

To configure search capability, define a web search function tool in your /api/chat request:

curl Example

curl http://localhost:11434/api/chat -d '{
"model": "gemma4",
"messages": [
{ "role": "user", "content": "Who won the latest Formula 1 race?" }
],
"stream": false,
"tools": [
{
"type": "function",
"function": {
"name": "web_search",
"description": "Search the web for real-time information",
"parameters": {
"type": "object",
"properties": {
"query": { "type": "string" }
},
"required": ["query"]
}
}
}
]
}'

You can handle this call by executing the web search in your application code, returning the fetched links and text snippets.