Package org.springframework.ai.ollama
Class OllamaEmbeddingClient
java.lang.Object
org.springframework.ai.embedding.AbstractEmbeddingClient
org.springframework.ai.ollama.OllamaEmbeddingClient
- All Implemented Interfaces:
EmbeddingClient
,ModelClient<EmbeddingRequest,
EmbeddingResponse>
EmbeddingClient
implementation for Ollama.
Ollama allows developers to run large language models and generate embeddings locally.
It supports open-source models available on [Ollama AI
Library](https://ollama.ai/library).
Examples of models supported: - Llama 2 (7B parameters, 3.8GB size) - Mistral (7B
parameters, 4.1GB size)
Please refer to the official Ollama website for the
most up-to-date information on available models.- Since:
- 0.8.0
- Author:
- Christian Tzolov
-
Field Summary
Fields inherited from class org.springframework.ai.embedding.AbstractEmbeddingClient
embeddingDimensions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncall
(EmbeddingRequest request) Executes a method call to the AI model.Embeds the given document's content into a vector.withDefaultOptions
(OllamaOptions options) Deprecated.Methods inherited from class org.springframework.ai.embedding.AbstractEmbeddingClient
dimensions, dimensions
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.embedding.EmbeddingClient
embed, embed, embedForResponse
-
Constructor Details
-
OllamaEmbeddingClient
-
-
Method Details
-
withModel
Deprecated.UseOllamaOptions.setModel(java.lang.String)
instead. -
withDefaultOptions
-
embed
Description copied from interface:EmbeddingClient
Embeds the given document's content into a vector.- Parameters:
document
- the document to embed.- Returns:
- the embedded vector.
-
call
Description copied from interface:ModelClient
Executes a method call to the AI model.- Parameters:
request
- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
OllamaOptions.setModel(java.lang.String)
instead.