feat: selectable wire format — ollama (default), openai (vLLM etc.), anthropic
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s
sign-bundle / sign (push) Has been cancelled

Port the multi-API client from llm.chat (llm.rs kept in lockstep):
the optional api input selects the dialect, default stays the
unchanged v0.1.x Ollama behavior. openai covers vLLM, LM Studio,
LiteLLM and cloud OpenAI; api-specific error hints; api_key sent
as Bearer (ollama/openai) or x-api-key (anthropic). model_digest
stays an Ollama-only best-effort probe and is documented as such.

Proven end-to-end against a hermetic OpenAI-wire fake (request
shape validated, response parsed) via a hub flow run.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-08-20 16:33:11 +02:00
parent 19886a7072
commit 4a04abf4f0
6 changed files with 559 additions and 90 deletions

View file

@ -1,6 +1,6 @@
# text.summarize
Ollama-backed faithful summarisation. Sends source text to a
LLM-backed faithful summarisation. Sends source text to a
configured LLM endpoint with a fidelity-over-creativity system
prompt and emits the summary plus audit-grade
model-provenance fields.
@ -16,7 +16,8 @@ model-provenance fields.
| `text` | text | Source text to summarise. |
| `style` | text | Optional style hint (e.g. `one paragraph`, `three bullet points`, `a tweet`). Default: `one paragraph`. |
| `language` | text | Optional output-language hint (e.g. `German`, `ja-JP`). Empty = same as source. |
| `endpoint` | text | Ollama-shaped `/api/chat` endpoint URL. |
| `endpoint` | text | Chat endpoint URL matching the selected `api` (Ollama `/api/chat`, OpenAI-compatible `/v1/chat/completions` — vLLM etc., Anthropic `/v1/messages`). |
| `api` | text | Optional wire format: `ollama` (default), `openai`, `anthropic`. |
| `model` | text | Model identifier the endpoint serves. |
| `api_key` | text | Optional bearer token for cloud-hosted endpoints. |
@ -29,7 +30,7 @@ model-provenance fields.
| `language` | text | Echo of the input language. |
| `model_endpoint` | text | URL the summary was generated against. |
| `model_name` | text | Model identifier as supplied to the LLM API. |
| `model_digest` | text | SHA-256 digest of the served Ollama model (when reachable). |
| `model_digest` | text | SHA-256 digest of the served model — Ollama only, empty elsewhere. |
## Fidelity over creativity