feat(llm): talk to OpenAI-compatible servers such as Strata
A base URL that ends in /v1 now selects the OpenAI-compatible API: chat goes to /chat/completions and embeddings to /embeddings. The conversion lives in src/jarvis/llm.py only, so the reply engine and every other caller keep their Ollama-shaped messages and responses. - Requests drop private engine keys, send tool-call arguments as JSON strings, map num_predict to max_tokens and the thinking switch to chat_template_kwargs.enable_thinking, and leave out num_ctx and keep_alive. - Responses come back with message.content, tool calls with dict arguments and an id, and message.thinking from reasoning_content. - Streaming, the warm-up (one-token chat completion), the intent judge and the dictation clean-up use the same path. A server without an embedding model fails open to the text paths. - Specs and docs/llm_contexts.md describe the transport; roadmap records M3 step 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,7 +38,7 @@ Regardless of strategy, these tools are **always** included:
|
||||
|
||||
### Embedding Strategy
|
||||
|
||||
1. Embed the user query using `get_embedding()` (calls Ollama `/api/embeddings` with the configured embed model).
|
||||
1. Embed the user query using `get_embedding()` (calls Ollama `/api/embeddings` with the configured embed model, or `/embeddings` when `ollama_base_url` ends in `/v1`; no embedding means the strategy falls back as below).
|
||||
2. For each tool (excluding always-included), build a summary string from the tool name (camelCase split) and description, then embed it.
|
||||
3. Compute cosine similarity between the query embedding and each tool embedding.
|
||||
4. Select tools using a **relative threshold**: keep tools whose similarity >= `top_score * _RELATIVE_THRESHOLD` (0.97 — nomic-embed-text has a high baseline similarity, so a loose threshold lets the entire catalogue through).
|
||||
|
||||
Reference in New Issue
Block a user