Skip to content

fix(ollama): exclude top-level keys from nested options in embeddings request#1013

Open
sv-LayZ wants to merge 2 commits intoprism-php:mainfrom
sv-LayZ:fix/ollama-embeddings-duplicate-dimensions
Open

fix(ollama): exclude top-level keys from nested options in embeddings request#1013
sv-LayZ wants to merge 2 commits intoprism-php:mainfrom
sv-LayZ:fix/ollama-embeddings-duplicate-dimensions

Conversation

@sv-LayZ
Copy link
Copy Markdown
Contributor

@sv-LayZ sv-LayZ commented Apr 15, 2026

Description

dimensions and keep_alive provider options were sent twice in the Ollama embeddings payload — as top-level fields and again inside options. This caused Ollama to log invalid option provided warnings on every request.

Strips those keys from the nested options object since they're already handled at the top level.

Closes #1010

… embeddings request

Prevents duplicate keys in the Ollama API payload that caused
"invalid option provided" warnings. Closes prism-php#1010
Copilot AI review requested due to automatic review settings April 15, 2026 13:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 dimensions and keep_alive from the nested options payload in the Ollama embeddings handler.
  • Add/adjust Ollama embeddings HTTP assertion to ensure options is not sent when only dimensions is 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.

Comment thread tests/Embeddings/MultimodalEmbeddingsTest.php
Comment thread tests/Embeddings/ImageEmbeddingsTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ollama embeddings: dimensions provider option is sent twice, triggering "invalid option" warning

2 participants