OllamaBuilder class

Ollama-specific LLM builder with provider-specific configuration methods

This builder provides a layered configuration approach where Ollama-specific parameters are handled separately from the generic LLMBuilder, keeping the main builder clean and focused.

Use this for Ollama-specific parameters only. For common parameters like apiKey, model, temperature, etc., continue using the base LLMBuilder methods.

Constructors

OllamaBuilder.new(LLMBuilder _baseBuilder)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() Future<ChatCapability>
Builds and returns a configured LLM provider instance
buildEmbedding() Future<EmbeddingCapability>
Builds a provider with EmbeddingCapability
buildModelListing() Future<ModelListingCapability>
Builds a provider with ModelListingCapability
forBalanced() OllamaBuilder
Configure for balanced performance and memory usage
forCpuOnly({int? threads}) OllamaBuilder
Configure for CPU-only inference
forDevelopment() OllamaBuilder
Configure for development and testing
forLongConversations() OllamaBuilder
Configure for long conversations
forMaxPerformance() OllamaBuilder
Configure for maximum performance (GPU-optimized)
forMemoryEfficiency() OllamaBuilder
Configure for memory efficiency
forProduction() OllamaBuilder
Configure for production deployment
keepAlive(String duration) OllamaBuilder
Sets how long to keep the model loaded in memory
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
numa(bool enabled) OllamaBuilder
Enables or disables NUMA (Non-Uniform Memory Access) optimization
numBatch(int batchSize) OllamaBuilder
Sets the batch size for processing
numCtx(int contextLength) OllamaBuilder
Sets the context window size (number of tokens)
numGpu(int gpuLayers) OllamaBuilder
Sets the number of GPU layers to use
numThread(int threads) OllamaBuilder
Sets the number of threads to use for computation
raw(bool enabled) OllamaBuilder
Enables or disables raw mode
reasoning(bool enabled) OllamaBuilder
Enables thinking for reasoning models
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited