Building a search-driven chatbot with Gradio and Haystack
In this section, we will integrate Gradio to build an interactive chatbot interface powered by Haystack and Neo4j. Gradio makes it easy to create a web-based interface for interacting with your chatbot. The chatbot will allow users to input queries, which will then trigger a vector-based search of movie embeddings stored in Neo4j. The chatbot will return detailed responses, including the movie titles, overviews, and similarity scores, providing an informative and user-friendly experience.
Setting up a Gradio interface
If you have not installed Gradio yet, do so by running the following:
pip install gradio
Note
The script in this chapter works fine with Gradio v 5.23.1
.
Next, we will set up a basic Gradio interface that triggers our search pipeline and displays the results:
import gradio as gr
# Define the Gradio chatbot interface
def chatbot(user_input):
return...