Bundle
Ollama local LLM client. Runs models (Llama, Mistral, Phi, Qwen, etc.) locally via the Ollama server. Supports text generation, chat sessions with tool calling, structured (JSON schema) output, thinking models, images, batch 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.
Tool
Tool definition for function calling in chat.
Example
params := JsonParser->TextToElement("{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\"}},\"required\":[\"location\"]}");
tool := Tool->New("get_weather", "Get the weather for a location", params);Operations
GetName #
Get the function name
method : public : GetName() ~ StringReturn
| Type | Description |
|---|---|
| String | function name |
New # constructor
Constructor
New(name:String, description:String, parameters:JsonElement)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | function name |
| description | String | function description |
| parameters | JsonElement | JSON schema for parameters |
New # constructor
Constructor from a function definition, the form the other AI client libraries use
New(func:FunctionType)Parameters
| Name | Type | Description |
|---|---|---|
| func | FunctionType | function definition |
ToJson #
Converts tool to JSON for the request.
method : public : ToJson() ~ JsonElementReturn
| Type | Description |
|---|---|
| JsonElement | JSON element |