Tools: Python, OpenAI (free tier), LangChain, Neo4j
- Create a Python virtual environment where the dependencies for this project will be installed.
cd server
python3 -m venv venv
- Activate the environment and install all the packages available in the requirement.txt file.
source venv/bin/activate
pip install -r ./requirements.txt
- If a
.env
file is not present in the server folder, create one to store the private OpenAI API key, which is required to use the LLMs.
OPENAI_API_KEY=XXXXXX
NEO4J_PW=XXX
- Run the Python script to web scrape product information found online.
python3 web_scrape.py
- The
llm_kg.ipynb
file explains:
- How to use LLM to extract new relations from product descriptions and construct Knowledge Graph
- Methods to query the graph database (based on embeddings, LLM-generated entities in prompt, Cypher)