fix(ollama): exclude top-level keys from nested options in embeddings request#1013
Open
sv-LayZ wants to merge 2 commits intoprism-php:mainfrom
Open
fix(ollama): exclude top-level keys from nested options in embeddings request#1013sv-LayZ wants to merge 2 commits intoprism-php:mainfrom
sv-LayZ wants to merge 2 commits intoprism-php:mainfrom
Conversation
… embeddings request Prevents duplicate keys in the Ollama API payload that caused "invalid option provided" warnings. Closes prism-php#1010
There was a problem hiding this comment.
Pull request overview
Fixes Ollama embeddings payload construction so dimensions and keep_alive are not duplicated inside the nested options object (preventing Ollama “invalid option provided” warnings).
Changes:
- Exclude
dimensionsandkeep_alivefrom the nestedoptionspayload in the Ollama embeddings handler. - Add/adjust Ollama embeddings HTTP assertion to ensure
optionsis not sent when onlydimensionsis provided. - Minor test/code refactors to use first-class callable syntax.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Providers/Ollama/Handlers/Embeddings.php |
Builds options by excluding keys already sent at the top level. |
tests/Providers/Ollama/EmbeddingsTest.php |
Asserts dimensions is top-level and options is omitted in that scenario. |
tests/Embeddings/MultimodalEmbeddingsTest.php |
Refactors toThrow callable syntax (introduces an unused import). |
tests/Embeddings/ImageEmbeddingsTest.php |
Refactors toThrow callable syntax (introduces an unused import). |
src/Text/Response.php |
Refactors map() callback to first-class callable syntax. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
dimensionsandkeep_aliveprovider options were sent twice in the Ollama embeddings payload — as top-level fields and again insideoptions. This caused Ollama to loginvalid option providedwarnings on every request.Strips those keys from the nested
optionsobject since they're already handled at the top level.Closes #1010