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.
Completion
Ollama model interactions
Inherits: EndPoint
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
function : Generate(model:String, prompt:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (i.e. llama3, llava) |
| prompt | String | prompt |
Return
| Type | Description |
|---|---|
| String | query response |
Example
response := Completion->Generate("llama3", "What is the capital of France?");
response->PrintLine();Generate # function
Generates a response from the model given an input with options
function : Generate(model:String, prompt:String, options:Options) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (i.e. llama3, llava) |
| prompt | String | prompt |
| options | Options | generation options (temperature, top_p, etc.) |
Return
| Type | Description |
|---|---|
| String | query 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) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (i.e. llama3, llava) |
| prompt | String | prompt |
| format | String | output format |
Return
| Type | Description |
|---|---|
| String | query response |
Generate # function
Generates a response from the model given an input
function : Generate(model:String, prompt:String, format:String, options:Options) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (i.e. llama3, llava) |
| prompt | String | prompt |
| format | String | output format |
| options | Options | generation options (temperature, top_p, etc.) |
Return
| Type | Description |
|---|---|
| String | query response |
Generate # function
Generates a response from the model given an input
function : Generate(model:String, prompt:String, image:File) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| model | String | model name (i.e. llama3, llava) |
| prompt | String | prompt |
| image | File | image file |
Return
| Type | Description |
|---|---|
| String | query response |
Example
image := System.IO.Filesystem.File->New("photo.png");
response := Completion->Generate("llava", "Describe what you see in this image.", image);
response->PrintLine();