Constructor
Parameters
The function to wrap the chat interface around. The function should accept two parameters: a str representing the input message and list of openai-style dictionaries representing the chat history. The function should return/yield a str (for a simple message), a supported Gradio component, a dict (for a complete openai-style message response), or a list of such messages.
If True, the chat interface will use a gr.MultimodalTextbox component for the input, which allows for the uploading of multimedia files. If False, the chat interface will use a gr.Textbox component for the input.
An instance of the gr.Chatbot component to use for the chat interface, if you would like to customize the chatbot properties.
An instance of the gr.Textbox or gr.MultimodalTextbox component to use for the chat interface, if you would like to customize the textbox properties.
An instance or list of instances of gradio components to use as additional inputs to the chatbot. The values of these components will be passed into fn as arguments in order after the chat history.
If a string is provided, this is the label of the gr.Accordion to use to contain additional inputs. A gr.Accordion object can be provided as well to configure other properties of the container.
An instance or list of instances of gradio components to use as additional outputs from the chat function. These must be components that are already defined in the same Blocks scope.
If True, users can edit past messages to regenerate responses.
Sample inputs for the function; if provided, appear within the chatbot and can be clicked to populate the chatbot input.
Labels for the examples, to be displayed instead of the examples themselves. If provided, should be a list of strings with the same length as the examples list.
Icons for the examples, to be displayed above the examples. If provided, should be a list of string URLs or local paths with the same length as the examples list.
If True, clicking on an example will run the example through the chatbot fn and the response will be displayed in the chatbot.
If True, caches examples in the server for fast runtime in examples.
If “eager”, all examples are cached at app launch. If “lazy”, examples are cached for all users after the first use by any user of the app.
A title for the interface; if provided, appears above chatbot in large font. Also used as the tab title when opened in a browser window.
A description for the interface; if provided, appears above the chatbot and beneath the title in regular font. Accepts Markdown and HTML content.
One of “never”, “manual”. If “never”, users will not see a button to flag an input and output. If “manual”, users will see a button to flag.
A list of strings representing the options that users can choose from when flagging a message. Defaults to [“Like”, “Dislike”].
Path to the directory where flagged data is stored.
Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable if defined, or default to True.
If True, autofocuses to the textbox when the page loads.
If True, will automatically scroll to the bottom of the chatbot when a new message appears.
If True, will show a submit button with a submit icon within the textbox. If a string, will use that string as the submit button text.
If True, will show a button with a stop icon during generator executions, to stop generating. If a string, will use that string as the stop button text.
If set, this is the maximum number of chatbot submissions that can be running simultaneously.
A tuple corresponding [frequency, age] both expressed in number of seconds.
How to show the progress animation while event is running.
If True, the chat interface will expand to the height of window.
Whether to horizontally expand to fill container fully.
Defines how the chat endpoint appears in the API docs.
Description of the API endpoint.
Controls the visibility of the chat endpoint.
If True, will save the chat history to the browser’s local storage and display previous conversations in a side panel.
A function that takes in the inputs and can optionally return a gr.validate() object for each input.