Class OllamaTextEmbedding.Builder
java.lang.Object
io.agentscope.core.embedding.ollama.OllamaTextEmbedding.Builder
- Enclosing class:
- OllamaTextEmbedding
Builder for OllamaTextEmbedding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the base URL for Ollama API.build()Builds the OllamaTextEmbedding instance.dimensions(int dimensions) Sets the dimension of embedding vectors.executionConfig(io.agentscope.core.model.ExecutionConfig config) Sets the default execution configuration.Sets the model name to use.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
baseUrl
Sets the base URL for Ollama API.- Parameters:
baseUrl- the base URL (e.g., "http://localhost:11434")- Returns:
- this builder instance
-
modelName
Sets the model name to use.- Parameters:
modelName- the model name (e.g., "nomic-embed-text", "all-minilm")- Returns:
- this builder instance
-
dimensions
Sets the dimension of embedding vectors.- Parameters:
dimensions- the dimension- Returns:
- this builder instance
-
executionConfig
Sets the default execution configuration.- Parameters:
config- the execution config (null for defaults)- Returns:
- this builder instance
-
build
Builds the OllamaTextEmbedding instance.This method validates required parameters and ensures that the defaultExecutionConfig always has proper defaults applied using EmbeddingUtils.ensureDefaultExecutionConfig().
- Returns:
- configured OllamaTextEmbedding instance
- Throws:
IllegalStateException- if required parameters are missing or invalid
-