Introducing Community Tools on HuggingChat

-


Nathan Sarrazin's avatar

Today we’re releasing our latest feature on HuggingChat: Community Tools! This permits you to turn any Space that you simply love on HuggingFace right into a tool that might be utilized by models directly from HuggingChat.

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

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

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


Turning a community Space right into a tool

You possibly can turn anyone’s public Space right into a tool. That is handy for using the newest models directly in HuggingChat. Let’s use DamarJati/FLUX.1-RealismLora for instance here.

Start by making a latest tool and filling within 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 routinely.

There are some fields that must be filled in accurately with a view to ensure optimal tool performance.

  • Tool Description: The outline is passed to the LLM to clarify what the tool can do. Keep it short and describe what the tool might be used for.
  • AI Function Name: The tools are represented as code functions. That 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 might be:
    • Required: The model must fill in a worth to make use of this tool. This required the parameter to be described properly.
    • Optional: There may be a default value provided however the model can override it if needed.
    • Fixed: The worth is fixed when creating the tool and may’t be modified by the model.

You possibly can all the time take a look at other tools’ definition to raised understand the right way to create tools. (example)

Now that our tool is created, we are able to enable it and begin using it with tools compatible models!



Making a custom tool yourself

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

Start by making a latest Gradio Space on Hugging Face. The CPU Basic free tier works high quality for this. Your Space could have to be public with a view to be used inside HuggingChat.

Create a straightforward app.py app inside your pace repo, within the case of our roll dice example that may very well 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="Variety of Sides"),
    outputs="text",
    title="Dice Roller",
    description="Enter the variety of sides for the dice and get the roll result."
)

demo.launch()

For those who’re not aware of Gradio, it’s very easy to start creating interfaces, you will discover the docs here.

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

When you’re done, push the changes and when your Space is deployed you possibly can create a community tool for it in HuggingChat similar to we did previously.


Enhance your assistants with Community Tools

You possibly can activate tools directly by going to the tools page and picking those you want or you can even package tools in an assistant.

When creating an assistant using a model that’s compatible with tool calling you’ll now have the choice to pick tools. Seek for the name of the tools and add as much as 3 different tools. In our case, let’s create a Game Master assistant that has access to image generation and dice rolling tools.

You need to use the system instructions field to inform the model when to make use of the tools.



Create a RAG tool on your individual documents

To go together with the discharge we created a straightforward RAG tool that you may easily copy to ask questions on your documents directly from HuggingChat. Start by duplicating this Space into your individual account. You possibly can then drop files you should be parsed within the sources/ folder of that Space.

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



Share your feedback with us

With the discharge of Community Tools we hope you’ll have the ability to boost your chats with multimodal content and custom tools. The feature remains to be experimental so in case you see Spaces that are usually not supported or tools that don’t work, please share them with us in the feedback thread!



Source link

ASK ANA

What are your thoughts on this topic?
Let us know in the comments below.

0 0 votes
Article Rating
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

0
Would love your thoughts, please comment.x
()
x