gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
34.11k stars 2.59k forks source link

Enhancements to tool use in `gr.Chatbot` #9051

Open abidlabs opened 3 months ago

abidlabs commented 3 months ago

As suggested by @Blaizzy, there are some ways we can improve the tool use display in gr.Chatbot:

  1. Better documentation, outside of LangChain and OpenAI.

  2. I would like to pass the arguments used to the assistant chat component so users can see what was used for the call.

  3. And a way to display parallel calls.

Blaizzy commented 3 months ago

Thanks @abidlabs!

To elaborate on the docs part. It took me 15 min to look through your docs to find anything related to this component.

Then the examples told me nothing about how to use it. I found the solution by looking through the code on a HF space.

https://huggingface.co/spaces/gradio/agent_chatbot/blob/main/utils.py

Blaizzy commented 3 months ago

Regarding the arguments, I expect to pass the JSON and have it nicely displayed but instead it displayed the string which is not optimal.

And formatting it into a string can be painful if have multiple arguments or tools with different formatting.

abidlabs commented 3 months ago

Thanks @Blaizzy! cc @freddyaboulton

Blaizzy commented 3 months ago

My pleasure!

Parallel calls is pretty much clear if we solve the first two.

abidlabs commented 3 months ago

@Blaizzy btw regarding docs, did you see this Guide: https://www.gradio.app/guides/agents-and-tool-usage -- was it not sufficient?

Blaizzy commented 3 months ago

I saw it, but it was not very informative on how to do it.

I have my custom library for inferencing Models locally on Apple Silicon that follows the openAI API.