On this page
Overview
Provides the first-class Arcane Ollama client without direct access to localhost:11434.
- Artifact
Ollama.js· esm - Classification
public first party - Availability
Native bridge - Normalization
Principal methods preserve provider-native envelopes; readiness/text/unload helpers normalize.
Import and lifecycle
import * as module from '/arcane/modules/Ollama.js';
Import creates and freezes a singleton, installs non-writable globalThis.arcaneOllama once, and dispatches arcane-ollama-ready. Calls resolve globalThis.Arcane.ollama at call time and never access localhost directly.
Application-facing behavior: Ollama, singleton/default ollama; 24 methods; installs globalThis.arcaneOllama, emits arcane-ollama-ready.
Protocol and host implementation
Arcane.ollama through Core + per-realm globalThis.arcaneEvents authority This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
OLLAMA_EVENT_TYPES | variable · value | variable OLLAMA_EVENT_TYPES | — |
OLLAMA_REASONS | variable · value | variable OLLAMA_REASONS | — |
Ollama | class | class Ollama | — |
ollama | class · value | variable ollama | — |
default | default · value | variable default | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
Ollama.version | method | version() | — |
Ollama.models | method | models() | — |
Ollama.list | method | list() | — |
Ollama.running | method | running() | — |
Ollama.show | method | show(model,options) | model,options |
Ollama.generate | method | generate(request,options) | request,options |
Ollama.chat | method | chat(request,options) | request,options |
Ollama.embed | method | embed(request) | request |
Ollama.pull | method | pull(model,options,streamOptions) | model,options,streamOptions |
Ollama.push | method | push(model,options,streamOptions) | model,options,streamOptions |
Ollama.create | method | create(request,options) | request,options |
Ollama.copy | method | copy(source,destination) | source,destination |
Ollama.delete | method | delete(model) | model |
Ollama.selection | method | selection() | — |
Ollama.select | method | select(preference) | preference |
Ollama.settings | method | settings() | — |
Ollama.saveSettings | method | saveSettings(settings) | settings |
Ollama.createBrain | method | createBrain(definition) | definition |
Ollama.serviceSettings | method | serviceSettings() | — |
Ollama.saveServiceSettings | method | saveServiceSettings(settings) | settings |
Ollama.readiness | async method | async readiness() | — |
Ollama.generateText | async method | async generateText(request,options) | request,options |
Ollama.chatText | async method | async chatText(request,options) | request,options |
Ollama.unload | method | unload(model) | model |
Ollama.PUBLISH_OLLAMA_READY | method | [PUBLISH_OLLAMA_READY]() | — |
Parameter meanings and results
Raw version/models/list/running/show/generate/chat/embed/pull/push/create/copy/delete/selection/select/settings/saveSettings/createBrain/serviceSettings/saveServiceSettings wrappers preserve arguments/results. Application pull() and copy() calls always reject in the pinned Core contract. readiness() returns frozen {ready,version,errorCode}; generateText()/chatText() return strings; unload(model) generates with keep_alive:0.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- Global arcane-ollama-ready with {ollama}.
Direct coded failures
ARCANE_OLLAMA_UNAVAILABLE
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- ARCANE_OLLAMA_UNAVAILABLE when the bridge is absent.
- Provider/Core errors are preserved by raw wrappers; readiness() contains them as errorCode.
Availability and capabilities
Native bridge. Principal methods preserve provider-native envelopes; readiness/text/unload helpers normalize.
ai.inference covers chat/embed/generate and Kempo suppresses raw calls; ai.models.read covers diagnostics/reads with app restrictions; ai.models.manage covers admitted lifecycle/selection writes, but never makes application pull() or copy() available; ai.settings.manage covers Settings-only settings APIs.
Contract example
import ollama from '/arcane/modules/Ollama.js';
async function chatWithAdmittedOllamaAfterUserChoice(){
const status = await Arcane.localAI.status();
const model = status.models.ollama.find(item => item.runnable === true);
if (!model) throw new Error('No admitted runnable model.');
const response = await ollama.chat({
model:model.id,
messages:[{role:'user',content:'Reply with one word.'}]
});
console.log(response.message?.content);
}