langchain-cognee
This package contains the LangChain integration with cognee.
This package enables you to:
- Ingest documents into cognee
- Build or update a knowledge graph
- Retrieve and query your data using LangChain's standard interfaces
For more information, check out cognee documentation.
Installation
pip install -U langchain-cognee
Configuration
Set your environment variables required by cognee:
export LLM_API_KEY="your-openai-api-key"
Cognee's default settings:
- LLM Provider: OpenAI
- Databases: SQLite, LanceDB, networkx
In case you want to customize your settings, please refer here and configure your env variables accordingly.
Supported databases
- Relational databases: SQLite, PostgreSQL
- Vector databases: LanceDB, PGVector, QDrant, Weviate
- Graph databases: Neo4j, NetworkX
Basic Usage
Below is a minimal example of how to use this integration:
from langchain_cognee.retrievers import CogneeRetriever
from langchain_core.documents import Document
# 1) Instantiate the retriever
retriever = CogneeRetriever(
llm_api_key="YOUR_KEY",
dataset_name="test_dataset",
k=3
)
# 2) (Optional) Reset dataset if you want a clean slate
retriever.reset_dataset()
# 3) Add documents
docs = [
Document(page_content="Elon Musk is the CEO of SpaceX."),
Document(page_content="SpaceX focuses on rockets."),
]
retriever.add_documents(docs)
# 4) Build knowledge graph
retriever.process_data()
# 5) Retrieve documents
results = retriever.invoke("Tell me about Elon Musk")
for doc in results:
print(doc.page_content)
You can also incorporate CogneeRetriever in any LangChain chain.
Metadata
Release files for langchain-cognee 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_cognee-0.1.1.tar.gz | 6.3 kB | Without provenance | Details for langchain_cognee-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_cognee-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for langchain_cognee-0.1.1-py3-none-any.whl |
Total release size: 15.5 kB
Release files / langchain_cognee-0.1.1.tar.gz
| Download URL | langchain_cognee-0.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ab75f6110591779dc11cb63379767524179e0b847eba8507023df951051c100
|
|
BLAKE2b-256 checksum How to use checksums |
034d985b98a08991ae00bf6ac44ede419cb9b78d6f463f80b03aa44823542cb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.5 Darwin/23.6.0
|
Release files / langchain_cognee-0.1.1-py3-none-any.whl
| Download URL | langchain_cognee-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
000d1b21bc3461bf7d6f46e27710563b773ce784641a691524b3b33749e1fbcd
|
|
BLAKE2b-256 checksum How to use checksums |
12e06ec0826eeef2d7dd75ba3621464d997a3136e3642a5cc2fe5dcc8c64aeb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.5 Darwin/23.6.0
|
Security for langchain-cognee 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.