[feature] adds web_search and fetch_url tool calls

This commit is contained in:
2026-03-02 16:13:34 -08:00
parent c47646a48c
commit d5b06ce22a
12 changed files with 951 additions and 48 deletions

View File

@@ -112,6 +112,12 @@ Behavior notes:
- For `chatId` calls, server stores only *new* non-assistant messages from provided history to avoid duplicates.
- Server persists final assistant output and call metadata (`LlmCall`) in DB.
- Server updates chat-level model metadata on each call: `lastUsedProvider`/`lastUsedModel`; first successful/failed call also initializes `initiatedProvider`/`initiatedModel` if unset.
- For `openai` and `xai`, backend enables tool use during chat completion with an internal system instruction.
- Available tool calls for chat: `web_search` and `fetch_url`.
- `web_search` uses Exa and returns ranked results with per-result summaries/snippets.
- `fetch_url` fetches a URL and returns plaintext page content (HTML converted to text server-side).
- When a tool call is executed, backend stores a chat `Message` with `role: "tool"` and tool metadata (`metadata.kind = "tool_call"`), then stores the assistant output.
- `anthropic` currently runs without server-managed tool calls.
## Searches
@@ -171,7 +177,8 @@ Search run notes:
"createdAt": "...",
"role": "system|user|assistant|tool",
"content": "...",
"name": null
"name": null,
"metadata": null
}
```