Align OllamaEmbeddingOptions with Ollama Embedding API specification#6590
Open
ywzou wants to merge 2 commits into
Open
Align OllamaEmbeddingOptions with Ollama Embedding API specification#6590ywzou wants to merge 2 commits into
ywzou wants to merge 2 commits into
Conversation
added 2 commits
July 10, 2026 17:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.