Repository navigation
Conversation
Twiink
temporarily deployed
to
github-app-auth
November 22, 2026 06:47 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the NVIDIA embedding connector’s empty-batch handling change.
No open issues 🎉
What changed in this PR
Fixes empty-batch handling in the Python NVIDIA embedding connector so the default batch size returns no vectors without raising an error or making a provider request.
Changes:
- Adds a positive fallback loop step while preserving non-empty batching behavior.
- Adds regression tests for raw and NumPy APIs with default and explicit batch sizes, including checks that no provider request occurs.
| File | Description |
|---|---|
python/tests/unit/connectors/ai/nvidia/services/test_nvidia_text_embedding.py |
Tests empty results and absence of provider calls across both APIs and batch-size options. |
python/semantic_kernel/connectors/ai/nvidia/services/nvidia_text_embedding.py |
Prevents a zero loop step for empty input with the default batch size. |
Review effort: Balanced
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 and Context
An empty document batch sent to NVIDIA embeddings with the default batch size raises
ValueError: range() arg 3 must not be zero. The same empty input already returns no vectors when a positive batch size is provided. Keep the loop step positive for the default empty case, producing the same empty result without a provider request.Description
Regression coverage checks both the raw and numpy APIs with default and explicit batch sizes. Two default-size cases fail on unchanged source, while the explicit-size controls pass.
Contribution Checklist
All 40 NVIDIA connector tests, Ruff lint/format, and
git diff --checkpass locally. No live provider call was made.Prepared with AI assistance and verified locally.