/** * Ollama LLM Provider * * Implements LLMProvider interface for local Ollama models. * Extends OpenAICompatibleProvider for shared functionality. * * @example * ```typescript * const provider = createOllamaProvider({ * model: 'llama3.2', * baseUrl: 'http://localhost:11434' * }); * ``` * * @remarks * - Requires Ollama to be running locally * - Default model is llama3.2 (supports tool calling) * - Extended thinking is not supported (Claude-specific feature) */ import type { ChatOptions } from './types.js'; import { ProviderError } from '../errors.js'; import { OpenAICompatibleProvider } from './openai-compatible.js'; /** * Configuration for OllamaProvider */ export interface OllamaProviderConfig { /** Base URL for Ollama server (default: http://localhost:11434) */ baseUrl?: string; /** Default model to use (default: llama3.1) */ model?: string; /** Default max tokens (default: 4096) */ maxTokens?: number; /** Request timeout in milliseconds (default: 120000) */ timeout?: number; /** Keep alive duration for model in memory (default: '5m') */ keepAlive?: string; /** Optional token estimator (e.g., tiktoken) for debug payload */ estimateTokens?: (text: string) => number; } /** * Ollama LLM Provider * * Provides streaming chat completion using local Ollama models. * Supports tool calling with compatible models (llama3.1, mistral, etc.) */ export declare class OllamaProvider extends OpenAICompatibleProvider { readonly name = "ollama"; private readonly keepAlive; constructor(config?: OllamaProviderConfig); /** * Ollama has no authentication by default */ protected getAuthHeaders(): Record; /** * Ollama's OpenAI-compatible endpoint */ protected getEndpointPath(): string; /** * Add Ollama-specific request options */ protected buildProviderSpecificBody(options?: ChatOptions): Record; /** * Map HTTP errors with Ollama-specific messages */ protected mapHttpError(status: number, body: string, model: string): ProviderError; /** * Map connection errors with Ollama-specific messages */ protected mapConnectionError(_error: Error): ProviderError; } /** * Create an Ollama provider instance * * @example * ```typescript * // Default configuration (llama3.1 on localhost:11434) * const provider = createOllamaProvider(); * * // Custom model * const provider = createOllamaProvider({ model: 'mistral' }); * * // Custom server * const provider = createOllamaProvider({ * baseUrl: 'http://192.168.1.100:11434', * model: 'llama3.1:70b' * }); * ``` */ export declare function createOllamaProvider(config?: OllamaProviderConfig): OllamaProvider;