feat: OpenAI and Anthropic wire-format adapters via new api input
New optional input api: ollama|openai|anthropic (default ollama — existing flows unchanged). - openai: OpenAI Chat Completions format (/v1/chat/completions), Bearer auth — targets vLLM and compatible self-hosted servers. - anthropic: Messages API (/v1/messages), x-api-key + anthropic-version headers, top-level system field, mandatory max_tokens (fixed 4096). - Audit outputs unchanged: model_endpoint/model_name always set; model_digest stays Ollama-only (no digest API on openai/anthropic, field is left empty rather than fabricated). - api_key is only ever placed in auth headers; never in outputs, errors, or audit events (verified against the event log). - No streaming, no tool calls. Bump module + capability version to 0.2.0. Wire-format unit tests for request serialization and response parsing against fixed JSON fixtures; live smoke green on the ollama path and on the openai path against an OpenAI-compatible local endpoint. Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
parent
b5389fce45
commit
305ab1cecd
9 changed files with 662 additions and 136 deletions
10
README.md
10
README.md
|
|
@ -1,14 +1,16 @@
|
|||
# llm-chat
|
||||
|
||||
F∆I module providing the `llm.chat` capability — a generic
|
||||
Ollama-compatible LLM chat adapter.
|
||||
LLM chat adapter speaking Ollama (default), OpenAI Chat
|
||||
Completions (OpenAI, vLLM, compatible servers), and the
|
||||
Anthropic Messages API, selected via the optional `api` input.
|
||||
|
||||
## Capability
|
||||
|
||||
| Field | Value |
|
||||
|-------|-------|
|
||||
| Capability | `llm.chat@0.1.0` |
|
||||
| Inputs | `prompt: text`, `endpoint: text`, `model: text`, `api_key: text` (opt), `system_prompt: text` (opt) |
|
||||
| Capability | `llm.chat@0.2.0` |
|
||||
| Inputs | `prompt: text`, `endpoint: text`, `model: text`, `api_key: text` (opt), `system_prompt: text` (opt), `api: text` (opt: `ollama`\|`openai`\|`anthropic`) |
|
||||
| Outputs | `response: text`, `model_endpoint: text`, `model_name: text`, `model_digest: text` |
|
||||
| Permissions | `net: localhost`, `net: 127.0.0.1`, `net: api.openai.com`, `net: api.anthropic.com` |
|
||||
| Status (in store index) | `alpha` |
|
||||
|
|
@ -41,7 +43,7 @@ cargo build --release --target wasm32-wasip2
|
|||
## Test
|
||||
|
||||
```bash
|
||||
cargo test # 11 tests, all host-side
|
||||
cargo test # wire-format unit tests, all host-side
|
||||
cargo build --release --target wasm32-wasip2
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue