AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Configure HuggingChat Web Search and Community Tools to Ground Open-Access Models

365Finds Editorial
Indexed 11,430 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Open-access large language models offer complete visibility into model weights and architecture, but out of the box they suffer from fixed training cutoffs and hallucinations when asked about current technical standards, breaking discoveries, or niche research literature. HuggingChat—Hugging Face’s open-source chat ecosystem powered by chat-ui—bridges this gap by providing two native mechanisms to ground open-weight models in verified, real-time web data: built-in Web Search and Community Tools.

Researchers and developers can configure these features directly in the hosted HuggingChat interface or inside custom self-hosted environments. Here is a practical, step-by-step guide to configuring live web retrieval, deploying custom Gradio tool Spaces, and constructing grounded research assistants using open models like Command R+, Llama 3, and Qwen 2.5.


1. Quick Grounding: Built-In Web Search in HuggingChat

For day-to-day literature exploration and factual cross-checking, HuggingChat includes an integrated Retrieval-Augmented Generation (RAG) search pipeline.

Enabling Web Search in the Chat Interface

  1. Navigate to HuggingChat (https://huggingface.co/chat).
  2. Select a base model optimized for instruction-following and factual reasoning (such as Meta Llama 3.1 70B, Cohere Command R+, or Qwen 2.5 72B).
  3. In the message input bar at the bottom, toggle the Search web switch (represented by a globe icon).
  4. Enter your query (for example: "What were the key benchmark findings of the latest DeepSeek-V3 technical report published this week?").

How the Built-In Pipeline Operates Under the Hood

HuggingChat does not simply dump raw Google results into the prompt. The underlying chat-ui backend executes an automated six-stage RAG workflow:


2. Advanced Workflows: Configuring Custom Community Tools

While built-in web search works well for broad queries, academic research and engineering tasks often require targeted endpoints: searching ArXiv papers, checking documentation across internal repositories, or querying specialized scientific APIs. HuggingChat's Community Tools system allows developers to convert any public Hugging Face Space into an invocable agent tool.

Step 1: Prepare or Select a Hugging Face Space

Any public Space built on Gradio that exposes a functional endpoint can serve as a Community Tool.

import gradio as gr
import urllib.request
import xml.etree.ElementTree as ET

def search_arxiv(query: str, max_results: int = 3) -> str:
    url = f"http://export.arxiv.org/api/query?search_query=all:{urllib.parse.quote(query)}&max_results={max_results}"
    response = urllib.request.urlopen(url).read().decode("utf-8")
    root = ET.fromstring(response)
    results = []
    for entry in root.findall("{http://www.w3.org/2005/Atom}entry"):
        title = entry.find("{http://www.w3.org/2005/Atom}title").text.strip()
        summary = entry.find("{http://www.w3.org/2005/Atom}summary").text.strip()
        results.append(f"Title: {title}\nSummary: {summary}\n")
    return "\n---\n".join(results) if results else "No papers found."

demo = gr.Interface(
    fn=search_arxiv,
    inputs=[gr.Textbox(label="Query"), gr.Number(label="Max Results", value=3)],
    outputs="text",
    title="ArXiv Search Tool"
)

demo.launch()

Step 2: Register the Tool in HuggingChat

  1. Go to https://huggingface.co/chat/tools and click Create New Tool (or navigate to https://huggingface.co/chat/tools/new).
  2. In the Hugging Face Space URL field, paste your Space URL (e.g., https://huggingface.co/spaces/your-username/arxiv-search).
  3. HuggingChat automatically parses the Gradio schema and detects function names and arguments.
  4. Fill in the required fields:
    • Tool Description: Provide a concise explanation of what the tool does (e.g., "Searches ArXiv for the latest computer science and AI preprints based on user keywords"). The LLM relies on this description to decide when to invoke the tool.
    • AI Function Name: Assign a unique snake_case identifier (e.g., search_arxiv_preprints).
    • Argument Settings: For each detected parameter, specify whether it is:
      • Required: The LLM must supply an argument before calling the tool.
      • Optional: Has a default value that the model can override when necessary.
      • Fixed: A hardcoded value invisible to the model (useful for API keys or fixed filters).
  5. Save the tool. It will now appear in your available tools library.

3. Packaging into a Custom Grounded Assistant

To create an autonomous research workflow that consistently applies web search and community tools without manual toggling each session, configure a dedicated HuggingChat Assistant.

  1. Go to Settings > Assistants or open https://huggingface.co/chat/settings/assistants/new.
  2. Name and Avatar: Give your assistant a descriptive name (e.g., "Open Research Analyst").
  3. Model Selection: Choose an open-access model with native tool-calling strengths. Models like Cohere Command R+ or Llama 3.1 70B are specifically fine-tuned for multi-step tool invocation and citation generation.
  4. System Instructions: Add explicit prompting to govern tool invocation and factual discipline:
    You are an autonomous research assistant.
    Always verify empirical claims, benchmark figures, and release dates by invoking the web search tool or community retrieval tools before answering.
    Do not extrapolate or speculate beyond retrieved documents.
    Always cite source titles and URLs directly in your answers.
    
  5. Enable Capabilities and Attach Tools:
    • Toggle Web search to give the assistant background web access.
    • Click Add Community Tools and search for up to 3 active tools from your library or community Spaces.
  6. Click Create. You can now share your assistant via a public URL or use it privately for team evaluations.

4. Self-Hosted Deployments: Configuring chat-ui

For academic laboratories, defense applications, and enterprise teams requiring strict data privacy or dedicated on-premises infrastructure, Hugging Face provides the entire frontend and backend as open source via huggingface/chat-ui.

Environment Configuration for Live Grounding

When running your own instance, search providers and local models are defined in .env.local:

# MongoDB Database
MONGODB_URL=mongodb://localhost:27017
MONGODB_DB_NAME=chat-ui

# OpenAI-Compatible Inference Endpoint (vLLM, Ollama, llama.cpp, or Hugging Face Router)
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_your_huggingface_access_token

# Web Search Provider Configuration
SERPER_API_KEY=your_serper_api_dev_key
# Alternatively use self-hosted SearXNG:
# SEARXNG_QUERY_URL=http://localhost:8080/search?q=<query>&format=json

# Scraping & Embedding Controls
USE_LOCAL_WEBSEARCH=false
WEBSEARCH_ALLOWLIST=[]
WEBSEARCH_BLOCKLIST=[]

Deploying this configuration allows local researcher teams to run open weights on private GPUs while querying curated internal knowledge bases or live web search gateways without third-party vendor lock-in.


Strategic Trade-Offs and Best Practices

HuggingChat turns open-access models from frozen static snapshots into dynamic research engines. By combining zero-setup Web Search with modular Community Tools, developers and researchers gain full control over how open AI models observe, verify, and cite the live web.

References