[feature] adds web_search and fetch_url tool calls
This commit is contained in:
@@ -37,8 +37,9 @@ Notes:
|
||||
|
||||
Event order:
|
||||
1. Exactly one `meta`
|
||||
2. Zero or more `delta`
|
||||
3. Exactly one terminal event: `done` or `error`
|
||||
2. Zero or more `tool_call`
|
||||
3. Zero or more `delta`
|
||||
4. Exactly one terminal event: `done` or `error`
|
||||
|
||||
### `meta`
|
||||
|
||||
@@ -60,6 +61,23 @@ Event order:
|
||||
|
||||
`text` may contain partial words, punctuation, or whitespace.
|
||||
|
||||
### `tool_call`
|
||||
|
||||
```json
|
||||
{
|
||||
"toolCallId": "call_123",
|
||||
"name": "web_search",
|
||||
"status": "completed",
|
||||
"summary": "Performed web search for 'latest CPI release'.",
|
||||
"args": { "query": "latest CPI release" },
|
||||
"startedAt": "2026-03-02T10:00:00.000Z",
|
||||
"completedAt": "2026-03-02T10:00:00.820Z",
|
||||
"durationMs": 820,
|
||||
"error": null,
|
||||
"resultPreview": "{\"ok\":true,...}"
|
||||
}
|
||||
```
|
||||
|
||||
### `done`
|
||||
|
||||
```json
|
||||
@@ -84,10 +102,15 @@ Event order:
|
||||
|
||||
## Provider Streaming Behavior
|
||||
|
||||
- `openai`: streamed via OpenAI chat completion chunks; emits `delta` from `choices[0].delta.content`.
|
||||
- `xai`: uses OpenAI-compatible API, same chunk extraction as OpenAI.
|
||||
- `openai`: backend may execute internal tool calls (`web_search`, `fetch_url`) before producing final text.
|
||||
- `xai`: same tool-enabled behavior as OpenAI.
|
||||
- `anthropic`: streamed via event stream; emits `delta` from `content_block_delta` with `text_delta`.
|
||||
|
||||
Tool-enabled streaming notes (`openai`/`xai`):
|
||||
- Stream still emits standard `meta`, `delta`, `done|error` events.
|
||||
- Stream may emit `tool_call` events before final assistant text.
|
||||
- `delta` may arrive as one consolidated chunk after tool execution, rather than many token-level chunks.
|
||||
|
||||
## Persistence + Consistency Model
|
||||
|
||||
Backend database remains source of truth.
|
||||
|
||||
Reference in New Issue
Block a user