How to load your data to cognee
Difficulty: Beginner
Overview
cognee let’s you load from 30+ data sources using dlt. You can connect relational, graph and vector stores to cognee.
Let’s create a basic LLM memory with cognee
Adding data to our graph and connecting it to LLM can help LLM reason better. You move from large amounts to text to structured data. See before and after bellow.
Here is what we start with:
And here is how it ends:
Step 1: Clone cognee repo
git clone https://github.com/topoteretes/cognee.git
And our getting started repo
git clone https://github.com/topoteretes/cognee-starter.git
Step 2: Install with poetry
Navigate to cognee repo
cd cognee
Install with poetry
poetry install
Step 3: Run simple cognee script
Create a python file called simple_example.py
and copy the code from the following link into it
https://github.com/topoteretes/cognee-starter/blob/main/src/pipelines/default.py
Step 4: Run cognee
In order to load the data
Run
python simple_example.py
Step 5: Inspect your cognee graph
The script will create an html file in the root folder that you can inspect and check the graph
import webbrowser
import os
from cognee.api.v1.visualize.visualize import visualize_graph
html = await visualize_graph()
home_dir = os.path.expanduser("~")
html_file = os.path.join(home_dir, "graph_visualization.html")
display(html_file)
webbrowser.open(f"file://{html_file}")
If you prefer video tutorial, check this short video that our engineer Igor made
Join the Conversation!
Have questions? Join our community now to connect with professionals, share insights, and get your questions answered!