Skip to main content

Hugging Face Hub

This section explains how to connect Hugging Face Hub as a Gen AI Model data source in DataDios. A Hugging Face data source powers AI Studio chat and insights, provides embeddings for RAG, browses the models, datasets and spaces your account can see, and can create prompt repositories on the Hub.


Prerequisites​

A Hugging Face access token from huggingface.co/settings/tokens.

The token's scope decides what the data source can do — a token that can chat but cannot read repositories produces an empty catalog with no error:

What you want to doToken needs
Chat / embeddings via the Inference APIInference access
Browse your own models, datasets and spacesRead access to your repositories
Browse an organization's repositoriesRead access granted for that organization
Create a prompt repository (Add item)Write access to repositories

If your network egress is restricted, allow https://huggingface.co (and the Hugging Face CDN it redirects downloads to — *.hf.co / cdn-lfs.huggingface.co). Token counting downloads a tokenizer from there on first use.


Steps to Create and Test a Hugging Face Data Source​

Step 1: Create a Data Source​

  1. Navigate to the Data Sources tab in DataDios
  2. Click + CREATE SOURCE
  3. In the data source type dropdown, expand Gen AI Models and select Hugging Face Hub

Step 2: Fill Connection Details​

  • token: Your Hugging Face access token (required, stored encrypted through the secret store)
  • huggingface_hub_endpoint: (required) https://huggingface.co by default. Change it only to point at a self-hosted / dedicated inference endpoint
  • model_name: (required) The chat model this data source uses:
    • Qwen/Qwen2-7B-Instruct
    • Qwen/Qwen2-72B-Instruct
    • Qwen/Qwen2.5-7B-Instruct
    • Qwen/Qwen2.5-72B-Instruct
    • mistralai/Mixtral-8x22B-Instruct-v0.1 — gated
    • meta-llama/Meta-Llama-3-8B-Instruct — gated
    • meta-llama/Meta-Llama-3-70B-Instruct — gated
    • HuggingFaceH4/zephyr-7b-beta
  • embedding_model: (optional) the model used for vector / RAG operations:
    • BAAI/bge-small-en-v1.5, BAAI/bge-base-en-v1.5, BAAI/bge-large-en-v1.5

Gated models​

The three models marked gated return 403 until the Hugging Face account behind your token has accepted that model's licence on its Hub page. Chat still works once the licence is accepted; until then, requests to the model fail.

A gated model also blocks the tokenizer download DataDios uses to count tokens. When the tokenizer cannot be loaded, DataDios falls back to a characters ÷ 4 estimate instead of an exact count. That estimate is what decides when older messages get trimmed out of a long chat, so a session may be trimmed slightly earlier or later than an exact count would trim it. Accepting the licence removes the fallback.

Custom / self-hosted endpoints​

If you set huggingface_hub_endpoint to your own inference endpoint:

  • An embedding model cannot be combined with a custom endpoint. DataDios refuses the connection rather than silently sending your text to the public Hub instead. Leave embedding_model empty, or keep the default endpoint.
  • model_name is still required, and it is how DataDios knows which model your endpoint serves — it supplies the context-window limit and the tokenizer. Select the model your endpoint actually runs; a mismatch gives the wrong context limit.

JSON Configuration​

{
"token": "hf_...",
"huggingface_hub_endpoint": "https://huggingface.co",
"model_name": "HuggingFaceH4/zephyr-7b-beta",
"embedding_model": "BAAI/bge-small-en-v1.5"
}

Step 3: Test Connection​

  1. Click TEST CONNECTION
  2. A valid token returns Status: OK. The token is never echoed back in any response or log.

The test authenticates against the Hub before reporting success, so an invalid token, an unreachable endpoint or a model that cannot be initialised fails here rather than on your first chat.


Step 4: Save Data Source​

  1. Click CREATE to save the data source
  2. It appears on the Data Sources listing page under Gen AI Models

Browsing the Hub​

Expanding the data source shows three sections — MODELS, DATASETS and SPACES — listing the repositories owned by your account and by every organization your account belongs to. Selecting a repository lists the files it contains; files are fetched when you open the repository rather than all up front.

All three sections empty, but the connection tested fine?

That is a token scope, not a connection fault. A token with Inference access but no Read access to repositories authenticates successfully and returns an empty catalog with no error. Issue a token with repository read access — and, for an organization's repositories, read access granted for that organization. See Prerequisites.


Creating a prompt repository​

Use Add item on the data source row to store a prompt on the Hub.

FieldMeaning
repo_typeThe kind of repository to create (dataset)
repo_nameRepository name, e.g. team-prompts
repo_settingprivate (default), org, or public
org_nameRequired when repo_setting is org — the organization that owns the repository
prompt_directoryDirectory inside the repository, e.g. prompts
prompt_titleFile name (without .json), e.g. summarize-tickets
promptThe prompt text
description, tagsOptional metadata stored in the file
model_nameThe model this prompt is written for

Notes:

  • org chooses the namespace only — the repository is still created private. Only public makes it public.
  • The prompt is written to <prompt_directory>/<prompt_title>.json in a repository your account owns, with the keys prompt_title, prompt, description, tags and model_name.
  • If the repository does not exist it is created; an existing file at that path is left untouched.
  • Every field marked required above is validated before anything is written, so a mistake in one item of a batch never leaves earlier items half-created on your account.

Using Hugging Face with AI Studio and RAG​

Select this data source in AI Studio for chat and insights (see the AI Studio documentation). When an embedding_model is configured, it can also be picked as the embedding source for RAG / hybrid search.

To make it available to every user in your tenant, bind it to the AI · reasoning role under Manage → Integrations → Catalog.


When the connection fails​

What you seeWhat it usually meansWhat to check
Test connection fails with an authentication or 401 errorThe token is invalid, revoked, or was pasted with whitespaceReissue the token at huggingface.co/settings/tokens and paste it without surrounding spaces
Test connection succeeds, but chat fails with 403The model is gated and the account behind the token has not accepted its licenceOpen the model's page on the Hub with that account and accept the licence — see Gated models
Test connection fails against a custom endpointThe endpoint is unreachable from the DataDios server, or the model cannot be initialised on itConfirm the endpoint URL and that the DataDios server can reach it; if egress is restricted, allow https://huggingface.co and *.hf.co
The connection is refused when saving, mentioning the embedding modelAn embedding model was combined with a custom endpoint, which is not allowedClear embedding_model, or return huggingface_hub_endpoint to https://huggingface.co — see Custom / self-hosted endpoints
MODELS, DATASETS and SPACES are all emptyThe token lacks repository Read accessSee Browsing the Hub
Token counts look approximate on a gated modelThe tokenizer download is blocked, so DataDios estimates at characters ÷ 4Accept the model's licence — see Gated models

Not supported​

  • SQL editor — Hugging Face Hub is not a queryable source and is not offered in the SQL/Query editor
  • Metadata history / schema drift — there is no History tab and no drift schedule for this source
  • Cost and workload extraction — per-call LLM usage is still logged under the Hugging Face Hub provider, but batch workload/cost extraction is not implemented
  • Fine-tuning and reading file contents from a repository