Skip to content
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 ability to provide preset response options in gr.Chatbot / gr.ChatInterface #9989

Merged
merged 40 commits into from
Nov 22, 2024

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Nov 18, 2024

Adds an optional options field to MessageDict that can take a list of dictionaries of value and optionally, a separate label, which produces preset options that a user can click on.

To see it in action, please run: demo/chatinterface_options/run.py

Screen.Recording.2024-11-20.at.2.07.07.PM.mov

Closes: #8698
Closes: #4763
Closes: #6372

I'm working on improving the ChatInterface docs so hold off on reviewing those, but once the docs are ready, it'll also close:

Closes: #9917

@abidlabs abidlabs changed the title Add ability to set "preset" options Add ability to provide preset response options in gr.Chatbot / gr.ChatInterface Nov 18, 2024
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Nov 18, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website building...
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/1607c279e37d26f35261449408eaa9fd62a06d5c/gradio-5.6.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@1607c279e37d26f35261449408eaa9fd62a06d5c#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/1607c279e37d26f35261449408eaa9fd62a06d5c/gradio-client-1.8.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/1607c279e37d26f35261449408eaa9fd62a06d5c/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Nov 18, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/chatbot minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Add ability to provide preset response options in gr.Chatbot / gr.ChatInterface

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs marked this pull request as ready for review November 20, 2024 22:29
Copy link
Collaborator

@hysts hysts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@abidlabs
Copy link
Member Author

Tweaked the styling a bit (cc @hannahblair):

Screen.Recording.2024-11-21.at.7.29.14.AM.online-video-cutter.com.mp4

@abidlabs
Copy link
Member Author

Maybe presets or responses would be a better name instead of options? Open to suggestions on the api

abidlabs and others added 6 commits November 21, 2024 09:34
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
@abidlabs
Copy link
Member Author

abidlabs commented Nov 21, 2024

Thanks @hannahblair for the docs fixes! Had no idea I repeat words that often

Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
@@ -459,11 +485,6 @@
justify-content: center;
}

.example:hover {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accident! Will restore

Copy link
Collaborator

@dawoodkhan82 dawoodkhan82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one small comment. Otherwise lgtm!

@abidlabs abidlabs enabled auto-merge (squash) November 21, 2024 23:59
@abidlabs
Copy link
Member Author

Thanks @hysts and @dawoodkhan82 for reviewing!

@abidlabs abidlabs merged commit 369a44e into main Nov 22, 2024
22 of 23 checks passed
@abidlabs abidlabs deleted the options branch November 22, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants