PrompterOllama¶
processing extra: prompter-ollama
Send the text of each message to a model served by Ollama, and transmit the answer sentence by sentence while the model writes it. Needs a running Ollama server.
- Node type:
PrompterOllama- Input:
ObjectPayload- Output:
ObjectPayload- Extra:
prompter-ollama
$ pip install "juturna-nodes[prompter-ollama]"
The node README describes the model to download, the input and output messages, and the limits of the node.
Choosing a model¶
Any model served by Ollama works: pull it and set model_name, nothing else
changes in the pipeline. Larger models answer more reliably and take longer
and more memory per answer. The default is qwen2.5:1.5b.
The default prompt asks for numbers as words because the TTS lexicon has no
entries for digits: SynthesizerSherpa skips them. The model still writes
digits now and then.
|
Download |
License |
|---|---|---|
|
398 MB |
Apache-2.0 |
|
806 MB |
Gemma Terms of Use |
|
986 MB |
Apache-2.0 |
|
2.0 GB |
Llama 3.2 Community License |
|
4.7 GB |
Apache-2.0 |
Sizes and licenses are those listed by the Ollama registry. Check the license of the model you pick before shipping it in a product.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Base address of the Ollama server |
|
|
|
Model to chat with, as listed by |
|
|
short voice-assistant prompt |
System message sent before every question; empty for none |
|
|
|
How long Ollama keeps the model loaded after a request ( |
|
|
|
Let models that support it reason before answering |
|
|
|
Seconds to wait for the connection and between two pieces of the answer, the first one included; it does not bound the whole answer |
|
|
|
Transmit the answer one sentence at a time; if |
Input message¶
Field |
Use |
|---|---|
|
The question, required. Leading and trailing spaces are removed; an empty or missing text is ignored |
meta is not read. TranscriberSherpa produces this format.
A new question interrupts the answer in progress. Once the question reaches
the node, no further sentence of the old answer is transmitted, the request is
closed when the next piece of the answer arrives, and the questions still
waiting are skipped. The sentences already transmitted are not called back: the nodes
downstream (for instance SynthesizerSherpa and SpeakerSink) still process
them.
Output message¶
One message per sentence of the answer, or a single message with the whole
answer if stream is false.
Field |
Content |
|---|---|
|
The question sent to the model |
|
One sentence of the answer, trimmed |
|
The |
|
Position of the sentence in the answer, from 0 |
|
|
|
The |
A sentence ends at ., !, ? or … followed by whitespace, or at a newline;
a piece shorter than 20 characters is joined to the next one. The rest of the
answer is transmitted when the model is done, with final set, even if it is
empty.
Each message keeps the version and the timers of the input message, and adds
a <node name> timer with the seconds from the arrival of the question to
that sentence: on the first sentence it is the time to the first sentence.
If the request fails (server down, timeout, HTTP error, an error reported in
the stream, connection closed before the end), the error is logged and counted
in the node health under source_failures. The sentences already
transmitted stay, the unfinished one is dropped, and no message is marked
final. An answer interrupted by a new question or by stopping the node has
no final message either. Stopping the node also drops the questions still
waiting: they are not answered after a restart.
License¶
Runtime: Ollama, MIT. The node only calls its HTTP API.
Weights: the license depends on the model you pull and set in
model_name. The defaultqwen2.5:1.5bis Apache-2.0: the license layer of that tag in the Ollama registry is the Apache License 2.0 text, the Ollama library page says all sizes except 3B and 72B are Apache 2.0 (those two are under the Qwen license), and the Qwen/Qwen2.5-1.5B-Instruct model card declaresapache-2.0with an Apache 2.0LICENSEfile.requests: Apache-2.0 (the license of requests on PyPI), to call the Ollama API.
Pipeline usage¶
{
"name": "llm",
"type": "PrompterOllama",
"configuration": { "model_name": "qwen2.5:1.5b" }
}
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
endpoint = "http://localhost:11434"
model_name = "qwen2.5:1.5b"
system_prompt = "You are a voice assistant. Answer in one or two short sentences, in plain words, without lists or markdown. Write numbers as words, never as digits."
keep_alive = "5m"
think = false
timeout = 60.0
stream = true
[meta]
Reference¶
- class PrompterOllama(
- endpoint: str,
- model_name: str,
- system_prompt: str,
- keep_alive: str,
- think: bool,
- timeout: float,
- stream: bool,
- **kwargs,
Ask a model served by Ollama, one request per message