[BUG]: HuggingFace embedder remote mode fails to initialize (endpoint_url rejected as model and timeout dropped)
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #2542 di @Bhumit267 — integrata
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start in packages/nvidia_nat_langchain/src/nat/plugins/langchain/embedder.py at the huggingface_langchain branch that builds HuggingFaceEndpointEmbeddings when endpoint_url is set, and check the timeout field in packages/nvidia_nat_core/src/nat/embedder/huggingface_embedder.py. Done means the remote branch passes timeout through and does not feed the URL into model. The issue already has an open linked pull request (#2542), so coordinate with it before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
develop at commit 15fa7b6e0de923a6f535351720d4ab6353d78ef3
Which installation method(s) does this occur on?
- Source
- PyPi
Describe the bug.
In packages/nvidia_nat_langchain/src/nat/plugins/langchain/embedder.py, huggingface_langchain attempts to initialize HuggingFaceEndpointEmbeddings when embedder_config.endpoint_url is set:
if embedder_config.endpoint_url:
from langchain_huggingface import HuggingFaceEndpointEmbeddings
client = HuggingFaceEndpointEmbeddings(
model=embedder_config.endpoint_url,
huggingfacehub_api_token=get_secret_value(embedder_config.api_key),
)
This causes two bugs during remote embedder initialization:
endpoint_urlrejected asmodel:HuggingFaceEndpointEmbeddings(fromlangchain-huggingface) expectsmodelto be a Hugging Face Hub repository ID (e.g.,BAAI/bge-small-en-v1.5), not an HTTP/HTTPS URL. Passingmodel=embedder_config.endpoint_urlraises a validation error fromhuggingface_hub(HFValidationError: Repo id must use alphanumeric chars... ':' is forbidden: 'http...'). As a result, remote mode fails at startup for any valid TEI or Hugging Face Inference Endpoint URL.timeoutis dropped:HuggingFaceEmbedderConfiginpackages/nvidia_nat_core/src/nat/embedder/huggingface_embedder.pydefinestimeout: float = Field(default=120.0, ge=1.0), buttimeoutis never forwarded toHuggingFaceEndpointEmbeddings(timeout=...), ignoring user-configured network timeouts.model_nameis discarded in remote mode: If a user supplies both a model identifier and anendpoint_url(e.g., when targeting a multi-model TEI gateway or HuggingFace inference endpoint),model_nameis completely ignored.
Minimum reproducible example
import asyncio
from pydantic import SecretStr
from nat.embedder.huggingface_embedder import HuggingFaceEmbedderConfig
from nat.plugins.langchain.embedder import huggingface_langchain
async def reproduce():
config = HuggingFaceEmbedderConfig(
endpoint_url="https://api-inference.huggingface.co/models/BAAI/bge-small-en-v1.5",
api_key=SecretStr("hf_dummy_token"),
timeout=60.0,
)
# Attempting to yield client
async for client in huggingface_langchain(config, None):
print(client)
asyncio.run(reproduce())
Equivalent workflow YAML:
embedders:
remote_tei:
_type: huggingface
endpoint_url: "https://api-inference.huggingface.co/models/BAAI/bge-small-en-v1.5"
api_key: "${HF_API_KEY}"
timeout: 60.0
Relevant log output
Click here to see error details
huggingface_hub.utils.validators.HFValidationError: Repo id must use alphanumeric chars or '-', '', '.', '--' and '..' are forbidden, ':' is forbidden: 'https://api-inference.huggingface.co/models/BAAI/bge-small-en-v1.5'. Use
repo_typeargument if needed.
Other/Misc.
- Previously noted in discussion on #2528 / PR #2529, where local HuggingFace embeddings were fixed, but remote
endpoint_urlsupport was excluded from scope. - Suggested direction:
- If using
HuggingFaceEndpointEmbeddings, provide the model repo ID viaembedder_config.model_name(or deduce repo ID if endpoint follows Hub URL pattern), and forwardtimeout=embedder_config.timeout. - For custom self-hosted TEI servers running with an OpenAI-compatible endpoint, document or route through the OpenAI embedder client pointing to TEI's
/v1endpoint.
- If using
Code of Conduct
- I agree to follow the NeMo Agent Toolkit Code of Conduct
- I have searched the open bugs and have found no duplicates for this bug report
- Lingua principale
- Python
- Stelle
- 2.7k
- Fork
- 823
- Merge medio
- 1g 5h
- PR unite (30g)
- 139
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/NeMo-Agent-Toolkit
-
[BUG]: Semantic Kernel profiler breaks streaming chat completions and reports total_tokens as 0Forse già presa @ShivamSharma43 l’ha presa 2 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
NVIDIA/NeMo-Agent-Toolkit#2571 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA/NeMo-Agent-Toolkit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
NVIDIA/auto-ontology#463 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
NousResearch/hermes-agent#151165 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
code-health
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinaudio/synth-setter#3750 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] vllm-sr config migrate drops providers.models[].deploymentForse già presa @Bevisy l’ha presa oggi. Apertaneeds-acceptance wg/developer-experience-ecosystem
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
vllm-project/semantic-router#5996 ·
I maintainer di solito rispondono entro 2 giorni