text-translate/MODULE.md
flemming-it 7c989f3d91
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 1s
docs: add MODULE.md + MODULE.de.md inline docs
Same shape as text-extract's docs commit. Audit-grade model-
provenance fields documented next to each output so the
operator sees the contract without leaving the Store sheet.

Signed-off-by: flemming-it <sf@flemming.it>
2026-05-25 14:06:04 +02:00

94 lines
3.5 KiB
Markdown

# text.translate
Ollama-backed translation between languages. 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 | Ollama-shaped `/api/chat` endpoint URL. |
| `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 Ollama model (when reachable). |
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
```yaml
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
```yaml
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
```bash
cargo build --release --target wasm32-wasip2
# Output: target/wasm32-wasip2/release/text_translate.wasm
```