@voicethere/agent 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/llm/agent/config.d.ts +51 -0
- package/dist/llm/agent/config.d.ts.map +1 -1
- package/dist/llm/agent/config.js +61 -0
- package/dist/llm/agent/config.js.map +1 -1
- package/dist/llm/agent/create-llm-agent.d.ts.map +1 -1
- package/dist/llm/agent/create-llm-agent.js +109 -4
- package/dist/llm/agent/create-llm-agent.js.map +1 -1
- package/dist/llm/agent/hooks.d.ts +23 -0
- package/dist/llm/agent/hooks.d.ts.map +1 -1
- package/dist/llm/agent/link-extractor.d.ts +43 -0
- package/dist/llm/agent/link-extractor.d.ts.map +1 -0
- package/dist/llm/agent/link-extractor.js +184 -0
- package/dist/llm/agent/link-extractor.js.map +1 -0
- package/dist/llm/anthropic-provider.d.ts.map +1 -1
- package/dist/llm/anthropic-provider.js +3 -0
- package/dist/llm/anthropic-provider.js.map +1 -1
- package/dist/llm/catalog.d.ts.map +1 -1
- package/dist/llm/catalog.js +5 -3
- package/dist/llm/catalog.js.map +1 -1
- package/dist/llm/gemini-provider.d.ts.map +1 -1
- package/dist/llm/gemini-provider.js +10 -1
- package/dist/llm/gemini-provider.js.map +1 -1
- package/dist/llm/index.d.ts +4 -2
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +1 -0
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/openai-provider.d.ts.map +1 -1
- package/dist/llm/openai-provider.js +3 -0
- package/dist/llm/openai-provider.js.map +1 -1
- package/dist/llm/types.d.ts +2 -0
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js.map +1 -1
- package/dist/templates/llm-agent/agent.js +374 -75
- package/dist/templates/llm-docs-rag/agent.js +59923 -0
- package/dist/templates/llm-mcp-service/agent.js +374 -75
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +25 -0
- package/dist/templates/registry.js.map +1 -1
- package/eject/llm/loop.ts +134 -5
- package/package.json +1 -1
- package/schema/voicethere.llm.schema.json +27 -0
- package/templates/README.md +1 -0
- package/templates/llm-agent/README.md +27 -1
- package/templates/llm-agent/voicethere.llm.json +1 -1
- package/templates/llm-docs-rag/README.md +50 -0
- package/templates/llm-docs-rag/agent.ts +27 -0
- package/templates/llm-docs-rag/hooks.ts +21 -0
- package/templates/llm-docs-rag/md.d.ts +4 -0
- package/templates/llm-docs-rag/prompt.md +17 -0
- package/templates/llm-docs-rag/tools.ts +5 -0
- package/templates/llm-docs-rag/voicethere.llm.json +52 -0
- package/templates/llm-mcp-service/README.md +27 -1
- package/templates/llm-mcp-service/voicethere.llm.json +1 -1
|
@@ -42,7 +42,7 @@ The rest of this file is the `llm-agent` README, which applies here too.
|
|
|
42
42
|
|
|
43
43
|
## Set the API key
|
|
44
44
|
|
|
45
|
-
The template starts on OpenRouter with the model `
|
|
45
|
+
The template starts on OpenRouter with the model `anthropic/claude-haiku-5.5`. Create a key at openrouter.ai, add it as a project secret named `AGENT_OPENROUTER_API_KEY`, then deploy. For production, pick the model from OpenRouter's list yourself, checking cost, latency and tool support. The key is read by name from `apiKeySecret` in `voicethere.llm.json`; it is never stored in the file. Only project secrets whose names start with `AGENT_` reach the agent.
|
|
46
46
|
|
|
47
47
|
## Filler phrases
|
|
48
48
|
|
|
@@ -69,6 +69,32 @@ The `fillers` block in `voicethere.llm.json` lists short sentences the agent spe
|
|
|
69
69
|
|
|
70
70
|
`speech.coalesceMs` (0 to 1000, default 150) sets how long the agent holds a finished sentence to join it with the next one. Sentences that complete within the window are spoken as one utterance, so a reply the model returns at once has no gap between its sentences. The buffer is also spoken when the stream ends, at 400 characters, or when a tool call starts. Chat `assistant_delta` messages are not delayed. `0` speaks every sentence on its own.
|
|
71
71
|
|
|
72
|
+
## Always search first
|
|
73
|
+
|
|
74
|
+
Small models often answer from memory instead of calling a tool, even when the prompt says to call it. Set `"toolChoice": "required-first-round"` in `voicethere.llm.json` and the first LLM call of every turn must call a tool. The model sees the result before it says anything about the question. The calls after the tool result are free again, so the model can answer or call another tool. Small talk ("thanks") also triggers a tool call, so use this for assistants whose answers should always come from a tool, like a docs search.
|
|
75
|
+
|
|
76
|
+
## Links in replies
|
|
77
|
+
|
|
78
|
+
A URL in the model's reply is never spoken. The agent takes it out of the text before TTS, so `speak`, `assistant_delta` and `assistant_done` carry the sentence without it, and sends each https URL once as its own message:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"type": "assistant_content",
|
|
83
|
+
"turnId": "…",
|
|
84
|
+
"content": { "kind": "link", "url": "https://…", "label": "pricing page" }
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
It arrives before that turn's `assistant_done`, with the same `turnId`. Voice turns add `"spoken": true` and `inReplyTo`, like the text messages. A markdown link `[pricing page](https://…)` keeps its label in the spoken sentence and sends it as `label`. A short lead-in such as "Docs:" before the link is dropped with it. `http://` links are removed from speech and never sent. Clients should ignore `content.kind` values they do not know.
|
|
89
|
+
|
|
90
|
+
Config `links`:
|
|
91
|
+
|
|
92
|
+
- `mode`: `extract` (default) or `off` (the text stays as the model wrote it, URL included).
|
|
93
|
+
- `requireToolSource` (default `false`): send only URLs that appear in a tool result of the same turn. Use it with a docs search tool so the model cannot link to a page it made up. Other URLs are still removed from speech.
|
|
94
|
+
- `maxPerTurn` (1 to 10, default 3).
|
|
95
|
+
|
|
96
|
+
Hooks and tools can send their own link with `ctx.sendContent({ kind: "link", url, label })`. It takes https only, skips a URL already sent in the turn, and returns whether it sent. The turn summary reports `linksSent` and `linksDropped`.
|
|
97
|
+
|
|
72
98
|
## Prompt guidance for phone calls
|
|
73
99
|
|
|
74
100
|
The template prompt ends with a "Voice call" section. In your own agent you can append the same text with `CALL_AGENT_PROMPT_GUIDANCE` from `@voicethere/agent/llm`:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "./node_modules/@voicethere/agent/schema/voicethere.llm.schema.json",
|
|
3
3
|
"version": 1,
|
|
4
4
|
"provider": "openrouter",
|
|
5
|
-
"model": "
|
|
5
|
+
"model": "anthropic/claude-haiku-5.5",
|
|
6
6
|
"apiKeySecret": "AGENT_OPENROUTER_API_KEY",
|
|
7
7
|
"maxOutputTokens": 300,
|
|
8
8
|
"greeting": {
|