fix: update deprecated NVIDIA retrieval models - #9750
Open
C10H14N2O5 wants to merge 1 commit into
Open
Conversation
C10H14N2O5
marked this pull request as ready for review
August 20, 2026 04:16
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_nvidia_embedding_source.py" line_range="26-35" />
<code_context>
+ assert provider.get_model() == NEW_MODEL
+
+
+def test_nvidia_embedding_provider_preserves_explicit_old_model():
+ provider = NvidiaEmbeddingProvider(
+ {
+ "embedding_model": OLD_MODEL,
+ "embedding_dimensions": 1024,
+ },
+ {},
+ )
+
+ assert provider.model == OLD_MODEL
+ assert provider.get_dim() == 1024
+
+
</code_context>
<issue_to_address>
**suggestion (testing):** Add coverage for explicit non-default embedding dimensions with the new model
This test only checks that the old model keeps its 1024 dimension. Please also add a test that verifies an explicitly configured non-default dimension is honored for `NEW_MODEL`, e.g. instantiate `NvidiaEmbeddingProvider` with `{"embedding_model": NEW_MODEL, "embedding_dimensions": 4096}` and assert `get_dim() == 4096`.
Suggested implementation:
```python
assert templates["NVIDIA Embedding"]["embedding_dimensions"] == 2048
def test_nvidia_embedding_provider_uses_new_fallback_model():
provider = NvidiaEmbeddingProvider({}, {})
assert provider.model == NEW_MODEL
assert provider.get_model() == NEW_MODEL
def test_nvidia_embedding_provider_honors_explicit_new_model_dimensions():
provider = NvidiaEmbeddingProvider(
{
"embedding_model": NEW_MODEL,
"embedding_dimensions": 4096,
},
{},
)
assert provider.model == NEW_MODEL
assert provider.get_dim() == 4096
NEW_MODEL = "nvidia/nemotron-3-embed-1b"
OLD_MODEL = "nvidia/llama-nemotron-embed-1b-v2"
```
If the constants `NEW_MODEL` and `OLD_MODEL` are actually defined earlier in the file (the snippet may be out of order), you may prefer to move this new test closer to the existing `test_nvidia_embedding_provider_preserves_explicit_old_model` for readability, keeping the same body. The logic of the test—instantiating `NvidiaEmbeddingProvider` with an explicit `embedding_dimensions` of `4096` for `NEW_MODEL` and asserting `get_dim() == 4096`—should remain unchanged.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
TL;DR
nvidia/nemotron-3-embed-1b1024to2048nvidia/llama-nemotron-rerank-vl-1b-v2Background
Fixes #9729
NVIDIA has marked the APIs used by some existing Embedding and Rerank models for deprecation on 2026-08-24.
AstrBot currently uses the affected models as the defaults for its NVIDIA Embedding and NVIDIA Rerank provider templates:
nvidia/llama-nemotron-embed-1b-v2nv-rerank-qa-mistral-4b:1This PR updates the defaults to the replacement models proposed in #9729:
nvidia/nemotron-3-embed-1bnvidia/llama-nemotron-rerank-vl-1b-v2The new embedding model uses a native output dimension of
2048, so the defaultembedding_dimensionsvalue is updated from1024to2048as part of the migration.This dimension update is required because AstrBot validates the actual embedding vector length against the configured provider dimension when creating a knowledge base, and the FAISS index is initialized using that configured dimension.
The existing NVIDIA Embedding and Rerank adapters already support the API contracts used by the replacement models, so no endpoint, payload, response parsing, knowledge base, or vector database logic needs to be changed.
Modifications / 改动点
NVIDIA Embedding
In
astrbot/core/config/default.py:Change the default model from:
nvidia/llama-nemotron-embed-1b-v2To:
nvidia/nemotron-3-embed-1bChange the default embedding dimension:
1024→2048In
astrbot/core/provider/sources/nvidia_embedding_source.py:nvidia/nemotron-3-embed-1bThe existing NVIDIA Embedding API contract is retained unchanged:
POST /v1/embeddingsinput,model,input_type, andencoding_formatpayloaddata[].embeddingresponse parsingNVIDIA Rerank
In
astrbot/core/config/default.py:Change the default model from:
nv-rerank-qa-mistral-4b:1To:
nvidia/llama-nemotron-rerank-vl-1b-v2In
astrbot/core/provider/sources/nvidia_rerank_source.py:nvidia/llama-nemotron-rerank-vl-1b-v2The existing endpoint construction logic already generates the hosted NVIDIA endpoint for the new model:
The existing Rerank request and response handling is also retained unchanged:
query.textpassages[].texttruncaterankings[].indexrankings[].logitRegression Tests
Added:
tests/test_nvidia_embedding_source.pytests/test_nvidia_rerank_source.pyThe tests cover:
2048default embedding dimensionrankings[].index/rankings[].logitresponse parsingExisting saved provider configurations are not automatically migrated or overwritten. This PR only changes the defaults used for newly created providers or when the corresponding model field is absent.
Existing knowledge base indexes are not automatically rebuilt or reindexed.
Screenshots or Test Results / 运行截图或测试结果
Test Environment
25H226200.91683.12.134fe29759758255a35ad01ea6177a91c2293bfcd374c5d2bada441b285399bb5b6aa8d9fad83bc22dNVIDIA Embedding Default Configuration
A newly created NVIDIA Embedding provider uses:
nvidia/nemotron-3-embed-1b2048NVIDIA Rerank Default Configuration
A newly created NVIDIA Rerank provider uses:
nvidia/llama-nemotron-rerank-vl-1b-v2NVIDIA Embedding Provider Test
The NVIDIA Embedding provider test completes successfully using the new default model and returns embeddings normally.
NVIDIA Rerank Provider Test
The NVIDIA Rerank provider test completes successfully using the new default model and returns reranking results normally.
End-to-End Knowledge Base Verification
The change was tested against a running AstrBot instance using the NVIDIA hosted APIs.
A new knowledge base was created using:
nvidia/nemotron-3-embed-1bas the Embedding providernvidia/llama-nemotron-rerank-vl-1b-v2as the Rerank providerThe following workflow was verified successfully:
2048-dimension embeddings without dimension mismatch errorsKnowledge Base Verification 1
Knowledge Base Verification 2
Knowledge Base Verification 3
Automated Tests
The NVIDIA provider tests and related knowledge base / FAISS regression tests were executed with:
Result:
The focused NVIDIA provider tests were also rerun after formatting:
Formatting and static checks:
Result:
A whitespace check was also performed:
Result:
No new dependencies are introduced by this change.
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Update NVIDIA retrieval provider defaults to supported embedding and reranking models without changing existing API integrations.
Bug Fixes:
Enhancements:
Tests: