text-summarize/MODULE.de.md
flemming-it 4a04abf4f0
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s
sign-bundle / sign (push) Has been cancelled
feat: selectable wire format — ollama (default), openai (vLLM etc.), anthropic
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>
2026-08-20 16:33:11 +02:00

3.8 KiB

text.summarize

LLM-basierte treue Zusammenfassung (Ollama, vLLM, jeder OpenAI-kompatible Server oder Anthropic). Sendet Quelltext an einen konfigurierten LLM-Endpunkt mit einem Treue-vor-Kreativität- System-Prompt und liefert die Zusammenfassung plus audit-taugliche Modell-Herkunfts-Felder.

Capability

  • text.summarize@0.1.0

Eingaben

Name Typ Beschreibung
text text Quelltext.
style text Optionaler Stil-Hinweis (z.B. one paragraph, three bullet points, a tweet). Default: one paragraph.
language text Optionaler Ziel-Sprache (z.B. German, ja-JP). Leer = Quellsprache.
endpoint text Chat-Endpunkt passend zum gewählten api (Ollama /api/chat, OpenAI-kompatibel /v1/chat/completions — vLLM u. a., Anthropic /v1/messages).
api text Optionales Wire-Format: ollama (Default), openai, anthropic.
model text Modell-ID am Endpunkt.
api_key text Optionaler Bearer-Token für Cloud-Endpunkte.

Ausgaben

Name Typ Beschreibung
summary text Die Zusammenfassung.
style text Echo des Stil-Inputs.
language text Echo des Sprach-Inputs.
model_endpoint text URL, gegen die zusammengefasst wurde.
model_name text Modell-ID wie an die LLM-API gesendet.
model_digest text SHA-256-Digest des bedienten Modells — nur bei Ollama, sonst leer.

Treue vor Kreativität

Der System-Prompt ist so getrimmt, dass die Zusammenfassung aus dem Quelltext herleitbar bleibt — keine Spekulation, kein mitgedachter Kontext, keine „kreativen" Umformulierungen, die abdriften. Geeignet für Compliance-Flows, in denen eine halluzinierte Zusammenfassung schlimmer ist als eine ausführliche. Das Modell behält die Freiheit, die das vom Operator gewählte LLM ihm gibt; dieses Modul ist der Prompt

  • Audit-Rahmen, kein fine-tuned Modell.

Berechtigungen

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

Analog text.translate — lokales Ollama per Default, Cloud per Operator-Policy zuschaltbar.

Grenzen in v0.1.0

  • Single-Shot. Sehr lange Quelltexte (> 32k Tokens je nach Modell) brauchen einen vorgeschalteten Chunker; v0.1.0 macht noch keine automatische Chunked-Summarise+Reduce- Pipeline.
  • Keine strukturierte Ausgabe. summary ist Freitext. JSON-formatierte Zusammenfassungen ({ key_points: [], conclusions: [] }) sind ein v0.2.0-Kandidat.

Beispiel-Flow

name: extract-summarise
inputs:
  document: bytes
steps:
  - id: extract
    use: text.extract@^0
    with:
      document: $inputs.document
  - id: summarise
    use: text.summarize@^0
    with:
      text: $extract.extracted.pages[*].text
      style: "three bullet points"
      endpoint: "http://localhost:11434/api/chat"
      model: "qwen2.5:14b"
outputs:
  summary: $summarise.summary
  audit_model: $summarise.model_digest

Build

cargo build --release --target wasm32-wasip2
# Ausgabe: target/wasm32-wasip2/release/text_summarize.wasm