OptionalapiKey: stringProtected_Protected property to store additional provider-specific settings
ProtectedthinkingState tracking for streaming thinking extraction Providers should initialize this if they support thinking models
Get the current additional settings
ProtectedapiOnly sub-classes can access the API key
Read only getter method to get the Ollama client instance
Read only getter method to get the Ollama client instance
Ollama natively supports assistant prefill
Ollama supports streaming
ProtectedaddAdd thinking content to a chat completion message
OptionalthinkingContent: stringProcess a chat completion request. If streaming is enabled and supported, this will route to the streaming implementation.
Process multiple chat completion requests in parallel. This is useful for:
Array of chat completion parameter objects
Optionalcallbacks: ParallelChatCompletionsCallbacksOptional callbacks for progress and individual completions
Promise resolving to an array of ChatResults in the same order as the input params
Clear all additional settings This is useful for resetting the state of the provider or when switching between different configurations.
ProtectedcreateProtectedextractExtract thinking content from non-streaming content This method handles case-insensitive extraction of thinking blocks
ProtectedfinalizeCreate the final response from streaming results for Ollama
Generate endpoint implementation for Ollama (alternative to chat) This can be useful for simple completion tasks
Returns the native file input capabilities of this LLM driver, or null if the driver does not support file attachments. Subclasses that accept files (PDFs, images, etc.) should override this method.
ProtectedgetGet the thinking tag format for this provider Providers can override this to customize the thinking tag format
ProtectedhandleTemplate method for handling streaming chat completion This implements the common pattern across providers while delegating provider-specific logic to abstract methods.
ProtectedinitializeInitialize thinking stream state for streaming extraction
Check if a model is available locally
List available models in Ollama
ProtectednonImplementation of non-streaming chat completion for Ollama
ProtectedprocessProcess streaming chunk with thinking extraction This method handles case-insensitive extraction across chunk boundaries
ProtectedprocessProcess a streaming chunk from Ollama
Pull a model from Ollama registry
ProtectedresetClear per-request streaming state. Called by the base class at the start of every streaming
request and again in its finally, so the cancellation token never leaks across requests.
ProtectedresetReset thinking stream state
Override SetAdditionalSettings to handle Ollama specific settings
ProtectedsupportsCheck if the provider supports thinking models Ollama can support thinking models depending on the loaded model
Ollama implementation of the BaseLLM class for local LLM inference Supports chat, generation, and streaming with various open-source models