ChatInterface
Learn about the ChatInterface and how we can interact with a chatbot.
We'll cover the following
Overview
Generative AI is becoming increasingly popular, and more accessible than ever before. With the release of ChatGPT, many people are now harnessing the capabilities of pre-trained large language models (LLMs). In this chapter, we will explore how we can integrate chatbots into Gradio with minimal code.
In this lesson, we are going to learn about the ChatInterface
. This is Gradio's high-level abstraction for creating chatbots and allows the user to interact with a chatbot in the UI.
At its core, a chatbot consists of a user and an agent. The user (which is us!) will send a message, the agent will read the message and respond accordingly. The user is then prompted to reply to the agent's message, which keeps repeating just like in a conversation. Depending on the trained LLM, we can also have additional roles, such as a ‘system’ that can provide context about the conversation between the user and the agent. Under the hood, we keep track of the conversation history between the user and the agent, so that when the agent replies it will use all the information it has learned up until that point in the conversation. Fortunately, most of this complexity is abstracted away in Gradio.
Get hands-on with 1300+ tech skills courses.