Repository navigation
fix(py/plugins/ollama): return one embedding per document - #181
Open
pcbeingused33 wants to merge 2 commits into
Open
pcbeingused33 wants to merge 2 commits into
pcbeingused33 wants to merge 2 commits into
Conversation
huangjeff5
approved these changes
Nov 30, 2026
huangjeff5
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Pushed a small cleanup (31a0e55) to use doc.text so Ollama matches Document.text, OpenAI, and Vertex multimodal (and avoids stray newlines on empty text parts).
huangjeff5
enabled auto-merge (squash)
November 30, 2026 19:52
Collaborator
|
@pcbeingused33 — same |
Contributor
Author
|
@googlebot I fixed it. |
Contributor
Author
This branch has not been deployed
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.
The Ollama embedder sends each text part as a separate input string. Ollama returns one vector per string, so a multipart document shifts the vectors returned by
embed_manyout of alignment with the input documents.Join each document's text parts with newlines before sending the batch to Ollama. This keeps one input string per document and preserves document order.
The regression test simulates one vector per string. With two documents containing three text parts in total, it reproduced three vectors before the fix and verifies two ordered vectors after it. All 254 non-integration Ollama tests passed. The local Ollama server was unavailable for a live reproduction.
Disclosure: this change was prepared with AI assistance.