Class OllamaEmbeddingModel.OllamaEmbeddingModelBuilder
java.lang.Object
dev.langchain4j.model.ollama.OllamaEmbeddingModel.OllamaEmbeddingModelBuilder
- Enclosing class:
OllamaEmbeddingModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier for custom HTTP headers.customHeaders(Map<String, String> customHeaders) Sets custom HTTP headers.dimensions(Integer dimensions) Sets the number of dimensions for the generated embeddings.httpClientBuilder(HttpClientBuilder httpClientBuilder) Sets theHttpClientBuilderthat will be used to create theHttpClientthat will be used to communicate with Ollama.logRequests(Boolean logRequests) logResponses(Boolean logResponses) maxRetries(Integer maxRetries)
-
Constructor Details
-
OllamaEmbeddingModelBuilder
public OllamaEmbeddingModelBuilder()
-
-
Method Details
-
httpClientBuilder
public OllamaEmbeddingModel.OllamaEmbeddingModelBuilder httpClientBuilder(HttpClientBuilder httpClientBuilder) Sets theHttpClientBuilderthat will be used to create theHttpClientthat will be used to communicate with Ollama.NOTE:
timeout(Duration)overrides timeouts set on theHttpClientBuilder. -
baseUrl
-
modelName
-
timeout
-
maxRetries
-
logRequests
-
logResponses
-
customHeaders
public OllamaEmbeddingModel.OllamaEmbeddingModelBuilder customHeaders(Map<String, String> customHeaders) Sets custom HTTP headers. -
customHeaders
public OllamaEmbeddingModel.OllamaEmbeddingModelBuilder customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier for custom HTTP headers. The supplier is called before each request, allowing dynamic header values. For example, this is useful for OAuth2 tokens that expire and need refreshing. -
dimensions
Sets the number of dimensions for the generated embeddings.If provided, the embedding vector will be truncated or projected to the specified size by the Ollama embedding model.
- Parameters:
dimensions- the embedding dimension size, must be positive- Returns:
- builder
-
build
-