Link to medium article
This Jupyter Notebook provides a detailed example of how to use Docker to run a FalkorDB database, install various Python packages for data handling and machine learning, and set up a question-answering system using FalkorDB, LangChain, and Gradio.
Ensure you have Docker installed on your system to run the FalkorDB container. You also need an OpenAI API key to use with LangChain.
Run the following command to start the FalkorDB in a Docker container:
!docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb
Install the required Python packages using the following command:
%pip install langchain langchain-openai falkordb langchain-experimental pandas gradio
Set your OpenAI API key and configure logging:
import os
import sys
import logging
os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
Load the IMDB dataset and perform data cleaning operations to prepare the data for graph construction:
import pandas as pd
# Data cleaning functions and operations...
Use FalkorDB to create a graph database from the cleaned IMDB data:
from langchain_community.graphs import FalkorDBGraph
# Graph construction code...
Set up the question-answering chain that uses FalkorDB and LangChain to answer questions related to the movie database:
from langchain_openai import ChatOpenAI
from langchain.chains import FalkorDBQAChain
# Question answering setup and execution...
Create a Gradio interface to interact with the question-answering system:
import gradio as gr
# Gradio app setup and launch...
Execute the notebook cells in order to start the question-answering system. You can ask questions about the movie database through the Gradio interface.
Make sure to replace "YOUR_API_KEY"
with your actual OpenAI API key, and ensure that the Docker container for FalkorDB is running before executing the notebook cells.
For more detailed information and troubleshooting, please refer to the official documentation of each package and tool used in this notebook.