v2026.6.4
All Bundles
Bundle Ollama local LLM client. Runs models (Llama, Mistral, Phi, etc.) locally via the Ollama server. Supports streaming completions, chat sessions, embeddings, and model management. Compile with -lib ollama.

Model

Ollama model operation

Inherits: EndPoint

Example

chat := Chat->New("llama3");
chat->Send("How many people like in San Pablo, CA?")->PrintLine();
chat->Send("How of the population identify as Latino??")->PrintLine();
chat->Send("Thanks, what are the major landmarks?")->PrintLine();
chat->Send("Goodbye?")->PrintLine();

Operations

Copy # function

Copy a model

function : Copy(src:String, dest:String) ~ Bool

Parameters

NameTypeDescription
srcStringsource name of the model to copy
destStringdestination name of the model to copy

Return

TypeDescription
Booltrue if successful, false otherwise

Example

if(Model->Copy("llama3", "llama3-backup")) {
  "Model copied."->PrintLine();
};

Create # function

Create a model from a Modelfile description

function : Create(name:String, modelfile:String) ~ Bool

Parameters

NameTypeDescription
nameStringname of the model to create
modelfileStringcontents of the Modelfile

Return

TypeDescription
Booltrue if successful, false otherwise

Example

modelfile := "FROM llama3\nSYSTEM \"You are a helpful assistant.\"";
if(Model->Create("my-assistant", modelfile)) {
  "Custom model created."->PrintLine();
};

Delete # function

Delete a model and its data.

function : Delete(name:String) ~ Bool

Parameters

NameTypeDescription
nameStringname of the model to delete

Return

TypeDescription
Booltrue if successful, false otherwise

Example

if(Model->Delete("llama3")) {
  "Model deleted."->PrintLine();
};

Embeddings # function

Generate embeddings from a model

function : Embeddings(model:String, prompt:String) ~ Float[]

Parameters

NameTypeDescription
modelStringname of model to generate embeddings from
promptStringtext to generate embeddings for

Return

TypeDescription
Floatembedding vector as Float array

Example

embeddings := Model->Embeddings("nomic-embed-text", "The sky is blue.");
if(embeddings <> Nil) {
  "Dimensions: {$embeddings->Size()}"->PrintLine();
};

GetDetails #

Get the model details

method : public : GetDetails() ~ ModelDetails

Return

TypeDescription
ModelDetailsmodel details

GetPulled #

Get the model pulled

method : public : GetPulled() ~ ModelPulled

Return

TypeDescription
ModelPulledmodel pulled

List # function

List the models available

function : List() ~ Vector<Model>

Return

TypeDescription
Vector<Model>list of models available

Example

models := Model->List();
if(models <> Nil) {
  each(m in models) {
    m->GetPulled()->GetName()->PrintLine();
  };
};

Pull # function

Download a model from the ollama library

function : Pull(name:String) ~ Bool

Parameters

NameTypeDescription
nameStringname of the model to pull

Return

TypeDescription
Booltrue if successful, false otherwise

Example

if(Model->Pull("llama3")) {
  "Model downloaded successfully."->PrintLine();
};

Show # function

Show information about a model

function : Show(name:String) ~ Model

Parameters

NameTypeDescription
nameStringname of the model to show

Return

TypeDescription
Modelmodel

Example

info := Model->Show("llama3");
if(info <> Nil) {
  info->GetPulled()->GetName()->PrintLine();
  info->GetDetails()->ToString()->PrintLine();
};

ToString #

String representation of the instance

method : public : ToString() ~ String

Return

TypeDescription
Stringstring representation of the instance