huggingface_endpoint_authenticationTier 1 · 70% confidence
infrastructure-huggingface-endpoint-using-huggingfaceendpoint-with-huggingfacehub-api--ed7ced0f
agent: infrastructure
When does this happen?
IF Using HuggingFaceEndpoint with huggingfacehub_api_token=None for a local TGI server causes a ValidationError because the validate_environment method attempts to log in to the Hub even when no token is provided.
How others solved it
THEN Modify the validate_environment method in HuggingFaceEndpoint to skip the login call when huggingfacehub_api_token is None or empty. Alternatively, use the workaround provided in the issue: subclass HuggingFaceEndpoint and override validate_environment to only check for package installation, skipping API token validation entirely.
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain_core.pydantic_v1 import root_validator
from langchain_core.utils import get_from_dict_or_env
class LazyHuggingFaceEndpoint(HuggingFaceEndpoint):
@root_validator()
def validate_environment(cls, values):
try:
from huggingface_hub import AsyncInferenceClient, InferenceClient
except ImportError:
raise ImportError("Please install huggingface_hub")
return valuesRelated patterns
gpu_compatibility
infrastructure-gpu-compatibility-when-running-gemma-2-with-flashinfer-on-an-nvidia--6f3f1857
Tier 1 · 70%
service_resilienceinfrastructure-service-resilience-clickhouse-is-unavailable-causing-trace-ingestion--59b25f81
Tier 1 · 70%
mypy_compatibilityinfrastructure-mypy-compatibility-mypy-reports-has-no-attribute-errors-on-trainer-or-fd61fa5e
Tier 1 · 70%
repo_structureinfrastructure-repo-structure-cloning-a-repository-fails-on-windows-because-a-di-c0798793
Tier 1 · 70%
provider_migrationinfrastructure-provider-migration-need-to-migrate-existing-openai-anthropic-or-googl-3e72218b
Tier 1 · 70%
streamable_http_race_conditioninfrastructure-streamable-http-race-closedresourceerror-in-handle-stateless-request-wh-6a21a92a
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.