Treatment chat
ml/remote/llm::chat
Configuration
⬡ llm: ml/remote/llm::RemoteLlm
Inputs
⇥ prompt: Stream<string>
Outputs
↦ error: Stream<string>
↦ failed: Stream<void>
↦ response: Stream<string>
Send prompts to a remote LLM and receive complete responses.
For each string received on prompt, sends a single-turn chat request to the
configured provider and emits the full response text on response. If the
request fails, failed and error are emitted instead.
ℹ️ load is not required — the provider is initialised when the program starts.
Use stream instead if you want token-by-token output.
graph LR
T("chat()")
P["🟩 🟩 …"] -->|prompt| T
T -->|response| R["🟩 🟩 …"]
T -->|failed| F["🟩 🟩 …"]
T -->|error| E["🟩 🟩 …"]
style P fill:#ffff,stroke:#ffff
style R fill:#ffff,stroke:#ffff
style F fill:#ffff,stroke:#ffff
style E fill:#ffff,stroke:#ffff
use ml/remote/llm::RemoteLlm
use ml/remote/llm::chat
treatment example()
model llm: RemoteLlm(backend = "mistral", api_key = "...", model = "mistral-small-latest")
input prompt: Stream<string>
output response: Stream<string>
{
chat[llm=llm]()
Self.prompt -> chat.prompt,response -> Self.response
}