ollama
@providerprotocol/ai / ollama
ollama
Section titled “ollama”Ollama provider for UPP (Unified Provider Protocol)
This module exports the Ollama provider for local model inference. Ollama runs models locally, eliminating the need for API keys and external network calls. Ideal for development and privacy-sensitive applications.
Remarks
Section titled “Remarks”Prerequisites:
- Install Ollama from https://ollama.ai
- Pull a model:
ollama pull llama3.2 - Ensure Ollama is running:
ollama serve
Example
Section titled “Example”import { ollama } from '@providerprotocol/ai/ollama';import { llm } from '@providerprotocol/ai';
// Create an LLM instance with a local modelconst model = llm({ model: ollama('llama3.2'), params: { num_predict: 500 }});
// Generate a responseconst turn = await model.generate('Write a haiku about coding.');console.log(turn.response.text);