HuggingChat Community Tools Release

Hugging Face has released Community Tools for HuggingChat, enabling users to transform any public Hugging Face Space into a functional tool that models can call directly. This update expands HuggingChat's capabilities into new modalities, including image understanding, video generation, and text-to-speech.

Integrating Public Spaces as Tools

Users can convert any public Hugging Face Space into a tool by providing the Space URL in the HuggingChat tool creation interface. When a URL is entered, the system automatically populates available functions and parameters. To ensure optimal performance, users must configure three key fields:

  • Tool Description: A concise explanation passed to the LLM to describe the tool's purpose.
  • AI Function Name: A short, unique, and self-explanatory name representing the tool as a code function.
  • Arguments: Parameters the LLM can fill, categorized as Required (must be provided), Optional (has a default value but can be overridden), or Fixed (constant value that the model cannot change).

Creating Custom Tools with Python and Gradio

Custom tools can be built using basic Python and the Gradio library. The process involves creating a public Gradio Space on Hugging Face (which can run on the free CPU Basic tier) and deploying an app.py file.

For example, a dice roll tool can be implemented by defining a function that returns a random integer based on a specified number of sides. Once the Gradio Space is deployed, it can be linked to HuggingChat using the same tool creation process used for public Spaces. Hugging Face notes that multiple functions can be hosted within a single Space to simplify tool management.

Enhancing AI Assistants with Tool Integration

Community Tools can be activated globally via the tools page or bundled into specific AI assistants. When creating a new assistant with a tool-compatible model, users can select and add up to three different tools.

System instructions can be used to guide the model on specifically when and how to utilize these integrated tools. For instance, a "Game Master" assistant could be configured with both image generation and dice rolling tools to enhance role-playing interactions.

Implementing RAG Tools for Private Documents

To facilitate Retrieval-Augmented Generation (RAG), Hugging Face provided a RAG tool template Space. Users can implement their own RAG tool by duplicating the template Space into their own account and uploading the documents they wish to be parsed into the sources/ folder. Once the Space is active, it is converted into a HuggingChat tool, allowing the model to answer questions based on the user's specific documents.

Sources