Skip to content

Align OllamaEmbeddingOptions with Ollama Embedding API specification#6590

Open
ywzou wants to merge 2 commits into
spring-projects:mainfrom
ywzou:main
Open

Align OllamaEmbeddingOptions with Ollama Embedding API specification#6590
ywzou wants to merge 2 commits into
spring-projects:mainfrom
ywzou:main

Conversation

@ywzou

@ywzou ywzou commented Jul 10, 2026

Copy link
Copy Markdown

This PR updates OllamaEmbeddingOptions to fully align with the latest Ollama Embedding API as documented at https://docs.ollama.com/api/embed#body-options-temperature.

The Ollama API defines a runtime options object within the embedding request body, which accepts parameters like temperature, top_k, seed, and num_predict. The current OllamaEmbeddingOptions class, while already containing many of these fields, is not consistently handling them in accordance with the API's structure.

This PR enhances and refines the implementation to ensure all runtime options are correctly supported. Key changes include:

Comprehensive alignment: Ensures all generation parameters (temperature, top_k, top_p, seed, num_predict, repeat_penalty, stop, etc.) that are supported by the Ollama embedding API are correctly defined and mapped within OllamaEmbeddingOptions.

Correct JSON mapping: Reviews and refines the @JsonProperty annotations to ensure these fields are serialized into the correct options object in the JSON payload sent to Ollama.

Consistency with chat options: Aligns the handling of these options with the established pattern used in OllamaChatOptions for a consistent developer experience.

Enhances configuration: Adds missing parameters like dimensions, aligning with prior community work, and ensures all options are accessible via builder and application.properties.

This improvement follows the ongoing effort to split OllamaOptions into dedicated OllamaChatOptions and OllamaEmbeddingOptions classes, providing type-safe and specific configuration for each use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants