v2026.10.0
All Bundles
Bundle

Ollama local LLM client. Runs models (Llama, Mistral, Phi, etc.) locally via the Ollama server. Supports chat sessions, embeddings, and model management. Every request completes before returning -- responses are not streamed, so a long generation produces nothing until it finishes. Compile with -lib ollama.

Completion

Ollama model interactions

Inherits: EndPoint

Example

prompt := "What number is this?";
file := System.IO.Filesystem.File->New("../gemini/thirteen.png");
Completion->Generate("llava", prompt, file)->PrintLine();

Operations

Generate # function

Generates a response from the model given an input with options

function : Generate(model:String, prompt:String, options:Options) ~ String

Parameters

NameTypeDescription
modelStringmodel name (i.e. llama3, llava)
promptStringprompt
optionsOptionsgeneration options (temperature, top_p, etc.)

Return

TypeDescription
Stringquery response

Example

opts := Options->New()->SetTemperature(0.3)->SetTopP(0.85);
response := Completion->Generate("llama3", "Summarize quantum entanglement briefly.", opts);
response->PrintLine();

Generate # function

Generates a response from the model given an input

function : Generate(model:String, prompt:String, format:String) ~ String

Parameters

NameTypeDescription
modelStringmodel name (i.e. llama3, llava)
promptStringprompt
formatStringoutput format

Return

TypeDescription
Stringquery response

Generate # function

Generates a response from the model given an input

function : Generate(model:String, prompt:String, format:String, options:Options) ~ String

Parameters

NameTypeDescription
modelStringmodel name (i.e. llama3, llava)
promptStringprompt
formatStringoutput format
optionsOptionsgeneration options (temperature, top_p, etc.)

Return

TypeDescription
Stringquery response

Generate # function

Generates a response from the model given an input

function : Generate(model:String, prompt:String, image:File) ~ String

Parameters

NameTypeDescription
modelStringmodel name (i.e. llama3, llava)
promptStringprompt
imageFileimage file

Return

TypeDescription
Stringquery response

Example

image := System.IO.Filesystem.File->New("photo.png");
response := Completion->Generate("llava", "Describe what you see in this image.", image);
response->PrintLine();

Generate # function

Generates a response from the model given an input

function : Generate(model:String, prompt:String, images:File[]) ~ String

Parameters

NameTypeDescription
modelStringmodel name (i.e. llama3, llava)
promptStringprompt
imagesFile[]image images

Return

TypeDescription
Stringquery response

ParseGenerateResponse # function

The response handling behind every Generate overload, as a function of the body text so it can be tested without a server.

function : ParseGenerateResponse(body:String) ~ String

Parameters

NameTypeDescription
bodyStringresponse text from /api/generate

Return

TypeDescription
Stringthe generated text, or Nil with the last error set