Skip to main content

Huggingface conversation

Type: conversation.huggingface

Status: alpha

Reference: https://docs.dapr.io/reference/components-reference/supported-conversation/hugging-face/

Example​

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: conversation.huggingface
version: v1
metadata:
# API key for Huggingface.
- name: key
value: |
**********
# A time-to-live value for a prompt cache to expire. Uses Golang durations (Optional)
#- name: cacheTTL
# value: "10m"
# Custom OpenAI-compatible endpoint URL for the model. If not specified, automatically generates the endpoint based on the model name using the template: https://router.huggingface.co/hf-inference/models/{{model}}/v1 (Optional)
#- name: endpoint
# value: "https://router.huggingface.co/hf-inference/models/microsoft/DialoGPT-medium/v1"
# HTTP headers to send on every request to the model endpoint, as a JSON object of header names to string values. Use it for headers that a gateway or proxy in front of the provider requires, for example a tenant ID or a gateway key. A header in this field replaces the header of the same name that the component sets. This includes the Authorization header that the component builds from key. key is still required, so set key to any non-empty value if the gateway does its own authentication. Host, Content-Length and hop-by-hop headers are not allowed. When this field is set, the component does not follow redirects to a different origin. (Optional)
#- name: headers
# value: "{"X-Tenant-ID": "tenant-a", "X-Gateway-Key": "**********"}"
# Default maximum number of tokens the model may generate per request. A request-level maxTokens value greater than zero overrides this default. When unset, no cap is sent and the provider's own default applies. (Optional)
#- name: maxTokens
# value: "2048"
# The Huggingface model to use. Uses OpenAI-compatible API. Configurable via HUGGINGFACE_MODEL environment variable. (Optional)
#- name: model
# value: "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B"

Authentication profiles​

Available authentication profiles:

  • API Key

API Key​

Authenticate using an API key

key (string)​

Required - API key for Huggingface.

Example value:

**********

Metadata​

cacheTTL (string)​

A time-to-live value for a prompt cache to expire. Uses Golang durations

Example value: 10m

endpoint (string)​

Custom OpenAI-compatible endpoint URL for the model. If not specified, automatically generates the endpoint based on the model name using the template: https://router.huggingface.co/hf-inference/models/\{\{model\}\}/v1

Example value: https://router.huggingface.co/hf-inference/models/microsoft/DialoGPT-medium/v1

headers (string)​

HTTP headers to send on every request to the model endpoint, as a JSON object of header names to string values. Use it for headers that a gateway or proxy in front of the provider requires, for example a tenant ID or a gateway key. A header in this field replaces the header of the same name that the component sets. This includes the Authorization header that the component builds from key. key is still required, so set key to any non-empty value if the gateway does its own authentication. Host, Content-Length and hop-by-hop headers are not allowed. When this field is set, the component does not follow redirects to a different origin.

Example value: {"X-Tenant-ID": "tenant-a", "X-Gateway-Key": "**********"}

maxTokens (number)​

Default maximum number of tokens the model may generate per request. A request-level maxTokens value greater than zero overrides this default. When unset, no cap is sent and the provider's own default applies.

Example value: 2048

model (string)​

The Huggingface model to use. Uses OpenAI-compatible API. Configurable via HUGGINGFACE_MODEL environment variable.

Default value: deepseek-ai/DeepSeek-R1-Distill-Qwen-32B

Example value: deepseek-ai/DeepSeek-R1-Distill-Qwen-32B