15.5 C
London
Friday, September 20, 2024

Unleash Collaborative Potential: Introducing Community Tools on HuggingChat

Introduction

HuggingChat, a platform that enables users to create, share, and interact with AI models, has released a new feature called Community Tools. This feature allows users to turn any public Space on Hugging Face into a tool that can be used by models directly from HuggingChat. With this release, HuggingChat expands its modalities, enabling users to use community tools to understand images, generate videos, or answer with a text-to-speech model. In this post, we will explore the possibilities and benefits of Community Tools, including turning a community Space into a tool, creating a custom tool, enhancing assistants with Community Tools, and creating a RAG tool on your own documents.


Today we’re releasing our latest feature on HuggingChat: Community Tools! This lets you turn any Space that you love on HuggingFace into a tool that can be used by models directly from HuggingChat.

With this feature, we’re also expanding the modalities available in HuggingChat. You can now use community tools to understand images, generate videos, or answer with a text-to-speech model. The possibilities are endless and anyone can create tools using Spaces on Hugging Face! Explore existing tools here.

In this post we’re going to look at a few use cases for creating community tools:

  1. Turning a community Space into a tool
  2. Creating a custom tool yourself
  3. Enhance your assistants with community tools
  4. Create a RAG tool on your own documents

Turning a community Space into a tool

You can turn anyone’s public Space into a tool. This is handy for using the latest models directly in HuggingChat. Let’s use DamarJati/FLUX.1-RealismLora as an example here.

Start by creating a new tool and filling in the fields. As soon as you input the Space URL into the Hugging Face Space URL field you’ll see the available functions and parameters get filled automatically.

There are some fields that need to be filled in correctly in order to ensure optimal tool performance.

  • Tool Description: The description ****is passed to the LLM to explain what the tool can do. Keep it short and describe what the tool can be used for.
  • AI Function Name: The tools are represented as code functions. This is your tool’s function name. Keep it short, unique and self-explanatory.
  • Arguments: These are the tool parameters the LLM can fill-in. They can be:
    • Required: The model must fill in a value to use this tool. This required the parameter to be described properly.
    • Optional: There is a default value provided but the model can override it if needed.
    • Fixed: The value is fixed when creating the tool and can’t be changed by the model.

You can always look at other tools’ definition to better understand how to create tools. (example)

Now that our tool is created, we can enable it and start using it with tools compatible models!

Creating a custom tool yourself

Using existing Spaces can cover a lot of use cases but if you can write basic python then you can just as easily create custom tools for yourself. Let’s do a simple example of a dice roll tool since LLMs are quite bad at picking random numbers by themselves.

Start by creating a new Gradio Space on Hugging Face. The CPU Basic free tier works fine for this. Your Space will have to be public in order to be used inside HuggingChat.

Create a simple app.py app inside your pace repo, in the case of our roll dice example that could be:


    import gradio as gr
    import random

    def roll_dice(sides=6):
        return random.randint(1, sides)

    demo = gr.Interface(
        fn=roll_dice,
        inputs=gr.Number(value=6, label="Number of Sides"),
        outputs="text",
        title="Dice Roller",
        description="Enter the number of sides for the dice and get the roll result."
    )

    demo.launch()
  

If you’re not familiar with Gradio, it’s very easy to get started creating interfaces, you can find the docs here.

You can have multiple functions inside a single Space to make it easier to manage your tools.

Once you’re done, push the changes and when your Space is deployed you can create a community tool for it in HuggingChat just like we did previously.

Enhance your assistants with Community Tools

You can activate tools directly by going to the tools page and picking the ones you like or you can also package tools in an assistant.

When creating an assistant using a model that is compatible with tool calling you will now have the option to select tools. Search for the name of the tools and add up to 3 different tools. In our case, let’s create a Game Master assistant that has access to image generation and dice rolling tools.

You can use the system instructions field to tell the model when to use the tools.

Create a RAG tool on your own documents

To go along with the release we created a simple RAG tool that you can easily copy to ask questions about your documents directly from HuggingChat. Start by duplicating this Space into your own account. You can then drop files you want to be parsed in the sources/ folder of that Space.

Once the Space is started up you can easily create a tool out of it on HuggingChat like we’ve covered previously.

Conclusion

With the release of Community Tools, HuggingChat is making it easier for users to create, share, and interact with AI models. This feature expands the modalities available in HuggingChat, enabling users to use community tools to understand images, generate videos, or answer with a text-to-speech model.

Frequently Asked Questions

Q: What are Community Tools?

A: Community Tools is a feature that allows users to turn any public Space on Hugging Face into a tool that can be used by models directly from HuggingChat.

Q: How do I create a community tool?

A: You can create a community tool by filling in the fields of a new tool and selecting the Space URL. You can also create a custom tool by writing basic python code and using Gradio.

Q: What are the benefits of using Community Tools?

A: The benefits of using Community Tools include expanding the modalities available in HuggingChat, enabling users to use community tools to understand images, generate videos, or answer with a text-to-speech model, and enhancing assistants with community tools.

Q: How do I enhance my assistants with Community Tools?

A: You can enhance your assistants with Community Tools by packaging tools in an assistant and selecting up to 3 different tools. You can also use the system instructions field to tell the model when to use the tools.

Q: Can I create a RAG tool on my own documents?

A: Yes, you can create a RAG tool on your own documents by duplicating the simple RAG tool created by HuggingChat and dropping files you want to be parsed in the sources/ folder of that Space.

Q: Where can I find more information about Community Tools?

A: You can find more information about Community Tools in the documentation and on the HuggingChat forums.

Latest news
Related news
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x