All checks were successful
CI / Linux x86_64 (Forgejo) (push) Successful in 1m57s
Generic Ollama-compatible LLM chat adapter. The lower-level
counterpart to orchestrator-llm: orchestrator-llm wraps the LLM
in a planning prompt that emits a structured F∆I Plan; this
module is the plain-prompt adapter that flows compose for
summarisation, translation, free-form Q&A, etc.
Capability surface:
Inputs:
prompt : text
endpoint : text (Ollama /api/chat URL)
model : text
api_key : text (optional bearer token)
system_prompt : text (optional)
Outputs:
response : text (assistant reply)
model_endpoint : text (audit correlation)
model_name : text (audit correlation)
model_digest : text (Ollama /api/show probe; empty
for non-Ollama or transient failures)
Permissions: net to localhost / 127.0.0.1 / api.openai.com /
api.anthropic.com.
The audit-field trio (endpoint + name + digest) closes the same
forensic gap that orchestrator-llm v0.3.1 closed for plan
generation: any historical chat invocation can be traced to the
exact model that produced it.
Implementation reuses the same defensive Ollama client pattern
from orchestrator-llm — derive_show_url + extract_show_digest
+ best-effort probe_model_digest. Duplication accepted at the
two-module mark; a shared crate refactor lands once a third
module needs the same plumbing.
12 host-side tests cover prompt building, Ollama-shaped
response parsing, URL transform, digest extraction (top-level
+ nested), end-to-end success, end-to-end probe-failure
swallow, end-to-end skip-for-non-Ollama, and the missing-input
guards.
Wasm artifact: 294 KB. Verified to build with v1.0 fai:platform
imports baked in.
Bootstrapped via 'fai new module llm.chat' (workspace v0.10.13)
which now produces an SDK-based template directly.
Signed-off-by: flemming-it <sf@flemming.it>
54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
schema_version: 1
|
|
name: llm-chat
|
|
version: 0.1.0
|
|
|
|
# Capability provided by this module.
|
|
provides:
|
|
- capability: llm.chat
|
|
version: 0.1.0
|
|
|
|
# Inputs the invoke function accepts.
|
|
inputs:
|
|
# The user-facing prompt text.
|
|
prompt: text
|
|
# Ollama-shaped /api/chat endpoint, e.g.
|
|
# "http://localhost:11434/api/chat".
|
|
endpoint: text
|
|
# Model identifier as registered with the endpoint, e.g.
|
|
# "qwen2.5:14b" or "llama3.1:8b".
|
|
model: text
|
|
# Optional bearer token for cloud-hosted endpoints. Empty
|
|
# string means no Authorization header is sent.
|
|
api_key: text
|
|
# Optional system prompt. Empty string omits the system
|
|
# message and lets the model use its built-in default.
|
|
system_prompt: text
|
|
|
|
# Outputs produced.
|
|
outputs:
|
|
# The assistant's plain-text reply.
|
|
response: text
|
|
# The endpoint the response was generated against. Used for
|
|
# audit correlation.
|
|
model_endpoint: text
|
|
# The model identifier as supplied to the LLM API.
|
|
model_name: text
|
|
# SHA-256 digest of the served Ollama model, when reachable.
|
|
# Empty for non-Ollama endpoints (OpenAI / Anthropic do not
|
|
# expose a digest API). Together with model_endpoint and
|
|
# model_name this answers the audit question "which exact
|
|
# model produced this response?"
|
|
model_digest: text
|
|
|
|
# Permissions required.
|
|
#
|
|
# The module makes outbound HTTP to the configured endpoint.
|
|
# Default declarations cover loopback (Ollama) and the common
|
|
# cloud providers. Operators with different endpoints fork
|
|
# module.yaml in Phase 0.5; operator-config-driven permission
|
|
# overrides arrive in Phase 1+.
|
|
permissions:
|
|
- "net: localhost"
|
|
- "net: 127.0.0.1"
|
|
- "net: api.openai.com"
|
|
- "net: api.anthropic.com"
|