Skip to content

Add embed model provider prefix for LiteLLM proxy compatability#2293

Merged
ChrisJar merged 2 commits into
NVIDIA:mainfrom
ChrisJar:inf-hub
Jul 6, 2026
Merged

Add embed model provider prefix for LiteLLM proxy compatability#2293
ChrisJar merged 2 commits into
NVIDIA:mainfrom
ChrisJar:inf-hub

Conversation

@ChrisJar

@ChrisJar ChrisJar commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Description

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@ChrisJar ChrisJar requested review from a team as code owners July 2, 2026 14:33
@ChrisJar ChrisJar requested a review from charlesbluca July 2, 2026 14:33
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an optional embed_model_provider_prefix parameter throughout the ingestion, query, and service stacks so that a LiteLLM proxy (or any provider-namespaced endpoint) can receive model IDs in the expected provider/model format without hard-coding the prefix into the model name.

  • New prepend_model_provider_prefix helper in string_processing/__init__.py performs a single, unconditional prepend; normalize_embed_kwargs consumes and applies the prefix (remote-only) and pops the key so it is never applied twice.
  • End-to-end plumbing: new field added to EmbedParams, IngestEmbedOptions, QueryEmbedOptions, NimEndpointsConfig, VectorDbConfig, AgenticRetrievalConfig, CLI options, Helm values, and the service YAML; forwarded through infer_microservice, _http_embed_openai_compat, embed_text_main_text_embed, and VectorDBState.
  • shared.py fix: pre-existing dead code after return {...} in build_embed_kwargs is replaced with a proper normalize_embed_kwargs call.

Confidence Score: 5/5

Safe to merge; the prefix is applied exactly once on each embedding call path, the feature is opt-in with a sensible None default, and the new tests cover the main scenarios.

The prefix logic is gated behind an endpoint check so local/GPU embedding is never affected. normalize_embed_kwargs pops the key after applying it, preventing re-application. The shared.py dead-code fix is a net improvement. The two minor style observations have no impact on correctness.

No files require special attention. The normalize_embed_kwargs / build_embed_option_kwargs interaction in utils.py is worth understanding for future maintainers since the prefix is applied eagerly in the CLI path but lazily in the service path.

Important Files Changed

Filename Overview
nemo_retriever/src/nemo_retriever/common/api/util/string_processing/init.py New prepend_model_provider_prefix helper: correctly handles None inputs, strips leading slashes on model name before prepending, and returns model unchanged when prefix is absent.
nemo_retriever/src/nemo_retriever/common/params/utils.py Adds provider-prefix application logic to normalize_embed_kwargs; pops the key after applying so it is consumed exactly once.
nemo_retriever/src/nemo_retriever/models/inference/main_text_embed.py Provider prefix threaded through the full async call chain; resolution cascade in create_text_embeddings_for_df checks task_config then transform config. Redundant or model_name fallback on line 269.
nemo_retriever/src/nemo_retriever/models/nim/util/init.py Adds model_provider_prefix to infer_microservice; prefix applied only on the HTTP path, consistent with pre-PR behaviour for None inputs.
nemo_retriever/src/nemo_retriever/models/inference/runtime.py Passes embed_model_provider_prefix to both TextEmbeddingConfig and the task_config dict.
nemo_retriever/src/nemo_retriever/service/vectordb_app.py Correctly stores and forwards embed_model_provider_prefix through VectorDBState to infer_microservice.
nemo_retriever/src/nemo_retriever/models/inference/shared.py Replaces dead-code endpoint-alias fallback with a proper normalize_embed_kwargs call.
nemo_retriever/src/nemo_retriever/service/services/pipeline_executor.py Adds embed_model_provider_prefix to _TRUST_OWNED_EMBED_KEYS and propagates it into EmbedParams.
nemo_retriever/tests/test_embed_params.py Five new tests covering prefix application scenarios including remote-only guard.
nemo_retriever/tests/test_service_vectordb_app.py New test verifies _embed_queries_remote forwards the prefix to infer_microservice.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CLI / YAML config\nembed_model_provider_prefix] --> B[build_embed_option_kwargs\nor build_embed_params]
    B --> C{Endpoint\npresent?}
    C -- Yes --> D[normalize_embed_kwargs\npops prefix, applies to\nmodel_name + embed_model_name]
    C -- No --> E[prefix silently discarded\nlocal embedding unaffected]
    D --> F[EmbedParams with prefixed model name]
    F --> G{Embedding path}
    G -- HTTP NIM --> H[infer_microservice]
    G -- main_text_embed --> I[_http_embed_openai_compat]
    G -- VectorDB query --> K[_embed_queries_remote]
    H --> L[LiteLLM Proxy]
    I --> L
    K --> L
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[CLI / YAML config\nembed_model_provider_prefix] --> B[build_embed_option_kwargs\nor build_embed_params]
    B --> C{Endpoint\npresent?}
    C -- Yes --> D[normalize_embed_kwargs\npops prefix, applies to\nmodel_name + embed_model_name]
    C -- No --> E[prefix silently discarded\nlocal embedding unaffected]
    D --> F[EmbedParams with prefixed model name]
    F --> G{Embedding path}
    G -- HTTP NIM --> H[infer_microservice]
    G -- main_text_embed --> I[_http_embed_openai_compat]
    G -- VectorDB query --> K[_embed_queries_remote]
    H --> L[LiteLLM Proxy]
    I --> L
    K --> L
Loading

Reviews (4): Last reviewed commit: "Change parameter name to embed_model_pro..." | Re-trigger Greptile

Comment thread nemo_retriever/src/nemo_retriever/service/vectordb_app.py
Comment thread nemo_retriever/src/nemo_retriever/common/api/util/string_processing/__init__.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/common/api/util/string_processing/__init__.py Outdated
@ChrisJar ChrisJar changed the title Fix Inference Hub embedding model names Add embed model name prefix for LiteLLM proxy compatability Jul 2, 2026
@ChrisJar ChrisJar changed the title Add embed model name prefix for LiteLLM proxy compatability Add embed model provider prefix for LiteLLM proxy compatability Jul 6, 2026
@ChrisJar ChrisJar merged commit b2e1520 into NVIDIA:main Jul 6, 2026
10 checks passed
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.

2 participants