text-translate/MODULE.md
flemming-it 4d6acab6a1
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s
sign-bundle / sign (push) Failing after 1m48s
feat: api accepts 'vllm' as a first-class value
'openai' reads as the cloud company — an operator running
self-hosted vLLM should be able to write what they mean. The new
value speaks the identical OpenAI wire (a guard test asserts the
emitted request stays byte-identical to api: openai, so the alias
can never drift into a dialect) but yields vLLM-specific error
hints (vllm serve, port 8000) instead of generic OpenAI prose.
Manifest + docs name the value in DE and EN.

Signed-off-by: flemming-it <sf@flemming.it>
2026-08-20 17:13:42 +02:00

3.8 KiB

text.translate

LLM-backed translation between languages (Ollama, vLLM, any OpenAI-compatible server, or Anthropic). Sends source text to a configured LLM endpoint with a translation system prompt and emits the translated text plus audit-grade model-provenance fields.

Capability

  • text.translate@0.1.0

Inputs

Name Type Description
text text Source text to translate.
target_language text Target language in plain English (e.g. German, French, ja-JP).
source_language text Optional source-language hint. Empty = let the model auto-detect.
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), vllm, openai, anthropic (vllm = the OpenAI wire with vLLM-specific hints).
model text Model identifier the endpoint serves (e.g. qwen2.5:14b).
api_key text Optional bearer token for cloud-hosted endpoints.

Outputs

Name Type Description
translation text The translated text.
source_language text Echo of the input value (or detected language when auto).
target_language text Echo of the input value.
model_endpoint text URL the translation was generated against.
model_name text Model identifier as supplied to the LLM API.
model_digest text SHA-256 digest of the served model — Ollama only, empty elsewhere.

The three model_* outputs are the audit primitive: every translation in the flow log can be matched to the exact model hash that produced it, even months later.

Permissions

permissions:
  - "net: localhost"
  - "net: 127.0.0.1"
  - "net: api.openai.com"
  - "net: api.anthropic.com"

The default policy allows local Ollama and the two major hosted providers. Operators with a private LLM endpoint add their hostname to the operator-policy ceiling; the module's permissions are enforced against that ceiling at install time.

Built for regulated environments

The Ollama endpoint defaults to a local daemon — source text never leaves the host. Cloud providers are opt-in via the endpoint URL + operator policy. The model_digest field is the cryptographic root-of-trust for translation provenance: two outputs with the same digest came from the same model weights, period.

Limits in v0.1.0

  • Single-shot translation. Long-document chunked translation with overlap-stitching is the v0.2.0 plan.
  • No glossary / terminology-list support. Operators currently rely on the model's general knowledge; a glossary input is on the v0.2.0 roadmap.

Example flow

name: translate-to-german
inputs:
  source: text
steps:
  - id: translate
    use: text.translate@^0
    with:
      text: $inputs.source
      target_language: "German"
      endpoint: "http://localhost:11434/api/chat"
      model: "qwen2.5:14b"
outputs:
  translation: $translate.translation
  audit_model: $translate.model_digest

Build

cargo build --release --target wasm32-wasip2
# Output: target/wasm32-wasip2/release/text_translate.wasm