Repository navigation
Python: fix(ollama): preserve zero embedding keep_alive - #8928
Merged
Evan Mattson (moonbox3) merged 1 commit intoOct 1, 2026
Merged
Evan Mattson (moonbox3) merged 1 commit into
Evan Mattson (moonbox3) merged 1 commit into
Conversation
RKS (rksharma-owg)
temporarily deployed
to
github-app-auth
October 1, 2026 04:26 — with
GitHub Actions
Inactive
RKS (rksharma-owg)
temporarily deployed
to
github-app-auth
October 1, 2026 04:26 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly handles zero without changing omission behavior and includes comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes Ollama embedding requests so explicit numeric keep_alive=0 values reach the SDK and HTTP endpoint.
Changes:
- Replaces the truthiness check with an explicit
Nonecheck. - Adds HTTP-boundary coverage for zero, nonzero, string, and omitted values.
| File | Description |
|---|---|
python/packages/ollama/agent_framework_ollama/_embedding_client.py |
Preserves zero-valued keep_alive options. |
python/packages/ollama/tests/ollama/test_ollama_embedding_client.py |
Verifies serialized request behavior through the Ollama SDK. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Evan Mattson (moonbox3)
approved these changes
Oct 1, 2026
This branch was previously 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.
Motivation & Context
Ollama embedding requests silently omit numeric
keep_alive=0, preventing callers from requesting a zero keep-alive duration. A truthiness check treats the valid zero as an absent option.Description & Review Guide
keep_aliveagainstNone, matching the adjacenttruncatehandling. Add request-level tests through the real Ollama SDK for numeric zero, positive/negative durations, duration strings, and omission./api/embed; existing nonzero values and omitted options retain their behavior. No API or dependency changes.Related Issue
Fixes #8927
Contribution Checklist