-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guides for msg format and llm agents #8750
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/7eacc4ceec7ea611b44267edbbbe9d054ad557b2/gradio-4.37.2-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@7eacc4ceec7ea611b44267edbbbe9d054ad557b2#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-builds.s3.amazonaws.com/7eacc4ceec7ea611b44267edbbbe9d054ad557b2/gradio-client-1.2.1.tgz |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
|
Need to fix the deployed spaces but content is good for a review. @aliabd why is the build failing on the redirect? I followed the pattern in |
13deb6e
to
d084d9f
Compare
avatar_images=(None, "https://em-content.zobj.net/source/twitter/53/robot-face_1f916.png")) | ||
text_input = gr.Textbox(lines=1, label="Chat Message") | ||
text_input.submit(interact_with_agent, [text_input, chatbot], [chatbot]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think text_input
needs to be cleared here after submit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Good call
def chat_function(message, history): | ||
history.append(ChatMessage(role="user", content=message)) | ||
history.append(ChatMessage(role="assistant", content="Hello, how can I help you?")) | ||
return history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so clean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small comment, but guides look good! Thanks @freddyaboulton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good apart from my comments on website build.
Thanks @freddyaboulton!
@@ -0,0 +1,97 @@ | |||
# Using the Messages data format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this file should be 03_messages-format.md
(the numerical prefix is followed by an underscore not a dash)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 Thank you!
Tags: LLM, AGENTS, CHAT | ||
Related spaces: https://huggingface.co/spaces/gradio/agent_chatbot, https://huggingface.co/spaces/gradio/langchain-agent | ||
|
||
The Gradio Chatbot can natively display intermediate thoughts and tool usage. This makes it perfect for creating UIs for LLM agents. This guide will show you how. Before we begin, familiarize yourself with the `messages` chatbot data format documented in this [guide](/guides/05_chatbots/messages-format). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what's currently breaking the build. Guide urls are just /guides/ there is no folder (chatbots in this case), and no numerical prefix. But also you're linking to a guide that doesn't exist on the release yet (because there hasn't been a release yet) so you need to link to the main url until then. The right way is to use a relative url so it finds the guide if it's on main or pip.
The Gradio Chatbot can natively display intermediate thoughts and tool usage. This makes it perfect for creating UIs for LLM agents. This guide will show you how. Before we begin, familiarize yourself with the `messages` chatbot data format documented in this [guide](/guides/05_chatbots/messages-format). | |
The Gradio Chatbot can natively display intermediate thoughts and tool usage. This makes it perfect for creating UIs for LLM agents. This guide will show you how. Before we begin, familiarize yourself with the `messages` chatbot data format documented in this [guide](./messages-format). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - thanks @aliabd !
Description
Also renames
msg_format
totype
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh