Configuration
🚀 Configure Vector and Graph Stores
You can configure the vector and graph stores using the environment variables in your .env file or programmatically. We use Pydantic Settings
We have a global configuration object (cognee.config) and individual configurations on pipeline and data store levels
Check available configuration options:
from cognee.infrastructure.databases.vector import get_vectordb_config
from cognee.infrastructure.databases.graph.config import get_graph_config
from cognee.infrastructure.databases.relational import get_relational_config
from cognee.infrastructure.llm.config import get_llm_config
print(get_vectordb_config().to_dict())
print(get_graph_config().to_dict())
print(get_relational_config().to_dict())
print(get_llm_config().to_dict())
Setting the environment variables in your .env file, and Pydantic will pick them up:
GRAPH_DATABASE_PROVIDER = 'lancedb'
Otherwise, you can set the configuration yourself:
cognee.config.set_llm_provider('ollama')
Make sure to keep your API keys secure and never commit them to version control.
🏆 .env
settings for the most used engines
Relational Engines
The default SQLite does not need much.
DB_PROVIDER=sqlite
A local Postgres instance would require more.
DB_PROVIDER=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=cognee
DB_PASSWORD=cognee
Vector Engines
LanceDB
is the default local, file-based vector store.
VECTOR_DB_PROVIDER="lancedb"
PGVector
sits in a PostGres, so a PSQL
+ PGVector
is a natural choice.
VECTOR_DB_PROVIDER="pgvector"
If you’re using an AWS hosted Postgres you need to run CREATE EXTENSION vector;
before first use.
Graph Engines
NetworkX
only needs
GRAPH_DATABASE_PROVIDER="networkx"
It will persist the data in cognee/.cognee_system/databases/cognee_graph.pkl
JSON file.
The same way Kuzu
only needs
GRAPH_DATABASE_PROVIDER="kuzu"
Its persistance is slightly different as it will write files to the cognee/.cognee_system/databases/cognee_graph.pkl
directory.
Neo4J
needs more, a default for a local instance would look like this.
GRAPH_DATABASE_PROVIDER="neo4j"
GRAPH_DATABASE_URL=bolt://localhost:7687
GRAPH_DATABASE_USERNAME=neo4j
GRAPH_DATABASE_PASSWORD=pleaseletmein
Don’t forget to install apoc
and graph-data-science
plugins.