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.
EndPoint
Ollama enabled endpoint class
Operations
GetHost # function
Gets the Ollama server host URL. Defaults to http://localhost:11434.
function : GetHost() ~ StringReturn
| Type | Description |
|---|---|
| String | host URL |
GetLastError # function
Get the last error
function : GetLastError() ~ StringReturn
| Type | Description |
|---|---|
| String | last error |
ParseResponse # function
Parse a response body. Nil, with the last error set, when the body is not JSON. Every request in this library used to inline this and the error check that follows; one of the ten copies had its else-if bound to the wrong if, so an {"error": ...} reply -- the shape Ollama actually sends -- was swallowed and a non-JSON body dereferenced Nil.
function : ParseResponse(body:String) ~ JsonElementParameters
| Name | Type | Description |
|---|---|---|
| body | String | response text |
Return
| Type | Description |
|---|---|
| JsonElement | parsed element, or Nil |
ReportError # function
Record the error a response carries, or that it carried nothing usable.
function : ReportError(json:JsonElement) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| json | JsonElement | parsed response that lacked the expected field |