HuggingFace

Parameter reference for the HuggingFace model class, covering Hugging Face Hub Inference settings.

The HuggingFace model provides access to models hosted on the HuggingFace Hub.

Parameters

ParameterTypeDefaultDescription
idstr"meta-llama/Meta-Llama-3-8B-Instruct"The id of the Hugging Face model to use
namestr"HuggingFace"The name of the model
providerstr"HuggingFace"The provider of the model
storeOptional[bool]NoneDeclared but rejected by the current chat_completion method when set; leave None.
frequency_penaltyOptional[float]NonePenalizes new tokens based on their frequency in the text so far
logit_biasOptional[Any]NoneModifies the likelihood of specified tokens appearing
logprobsOptional[bool]NoneReturn log probabilities of the output tokens
max_tokensOptional[int]NoneMaximum number of tokens to generate
presence_penaltyOptional[float]NonePenalizes new tokens based on whether they appear in the text so far
seedOptional[int]NoneRandom seed for deterministic sampling
stopOptional[Union[str, List[str]]]NoneSequences where the API stops generating further tokens
temperatureOptional[float]NoneControls randomness in the model's output
top_logprobsOptional[int]NoneNumber of most likely tokens to return log probabilities for
top_pOptional[float]NoneControls diversity via nucleus sampling
request_paramsOptional[Dict[str, Any]]NoneAdditional parameters to include in the request
api_keyOptional[str]NoneThe API key for Hugging Face (defaults to HF_TOKEN env var)
base_urlOptional[Union[str, httpx.URL]]NoneThe base URL for the inference endpoint
timeoutOptional[float]NoneRequest timeout in seconds
max_retriesOptional[int]NoneDeclared but rejected by the current Hugging Face client constructor when set; leave None.
default_headersOptional[Any]NoneDeclared but rejected by the current Hugging Face client constructor when set; leave None.
default_queryOptional[Any]NoneDeclared but rejected by the current Hugging Face client constructor when set; leave None.
client_paramsOptional[Dict[str, Any]]NoneAdditional parameters for client configuration
clientOptional[InferenceClient]NonePre-configured HuggingFace inference client
async_clientOptional[AsyncInferenceClient]NonePre-configured async HuggingFace inference client
model_typeModelTypeModelType.MODELFunctional role of this model (e.g. MODEL, OUTPUT_MODEL, PARSER_MODEL). Set by the agent
supports_native_structured_outputsboolFalseWhether the model supports structured outputs natively
supports_json_schema_outputsboolFalseWhether the model uses JSON schema for structured outputs
system_promptOptional[str]NoneSystem prompt from the model added to the agent
instructionsOptional[List[str]]NoneInstructions from the model added to the agent
tool_message_rolestr"tool"Role of tool messages
assistant_message_rolestr"assistant"Role of assistant messages
cache_responseboolFalseCache model responses to avoid redundant API calls during development
cache_ttlOptional[int]NoneTime-to-live for cached responses, in seconds
cache_dirOptional[str]NoneDirectory for the response cache. Defaults to ~/.agno/cache/model_responses
retriesint0Number of retries to attempt before raising a ModelProviderError
delay_between_retriesint1Delay between retries, in seconds
exponential_backoffboolFalseIf True, the delay between retries is doubled each time
retry_with_guidanceboolTrueRetry a failed model invocation once with a guidance message appended
retry_with_guidance_limitint1Number of times to retry the model invocation with guidance
With the current Hugging Face inference clients, use client_params={"headers": {...}} for custom headers or inject configured clients. The incompatible fields above must remain unset; adding client_params does not remove them.