Skip to main content

Cognee - is a library for enriching LLM context with a semantic layer for better understanding and reasoning.

Project description

Cognee Logo

cognee - Memory for AI Agents in 5 lines of code

Demo . Learn more · Join Discord · Join r/AIMemory

GitHub forks GitHub stars GitHub commits Github tag Downloads License Contributors Sponsor

cognee - Memory for AI Agents  in 5 lines of code | Product Hunt

topoteretes%2Fcognee | Trendshift

🚀 We are launching Cognee SaaS: Sign up here for the hosted beta!

Build dynamic memory for Agents and replace RAG using scalable, modular ECL (Extract, Cognify, Load) pipelines.

More on use-cases and evals

🌐 Available Languages : Deutsch | Español | français | 日本語 | 한국어 | Português | Русский | 中文

Why cognee?

Features

  • Interconnect and retrieve your past conversations, documents, images and audio transcriptions
  • Replaces RAG systems and reduces developer effort, and cost.
  • Load data to graph and vector databases using only Pydantic
  • Manipulate your data while ingesting from 30+ data sources

Get Started

Get started quickly with a Google Colab notebook , Deepnote notebook or starter repo

Contributing

Your contributions are at the core of making this a true open source project. Any contributions you make are greatly appreciated. See CONTRIBUTING.md for more information.

📦 Installation

You can install Cognee using either pip, poetry, uv or any other python package manager. Cognee supports Python 3.8 to 3.12

With pip

pip install cognee

Local Cognee installation

You can install the local Cognee repo using pip, poetry and uv. For local pip installation please make sure your pip version is above version 21.3.

with UV with all optional dependencies

uv sync --all-extras

💻 Basic Usage

Setup

import os
os.environ["LLM_API_KEY"] = "YOUR OPENAI_API_KEY"

You can also set the variables by creating .env file, using our template. To use different LLM providers, for more info check out our documentation

Simple example

This script will run the default pipeline:

import cognee
import asyncio


async def main():
    # Add text to cognee
    await cognee.add("Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval.")

    # Generate the knowledge graph
    await cognee.cognify()

    # Query the knowledge graph
    results = await cognee.search("Tell me about NLP")

    # Display the results
    for result in results:
        print(result)


if __name__ == '__main__':
    asyncio.run(main())

Example output:

  Natural Language Processing (NLP) is a cross-disciplinary and interdisciplinary field that involves computer science and information retrieval. It focuses on the interaction between computers and human language, enabling machines to understand and process natural language.

Our paper is out! Read here

cognee paper

Cognee UI

You can also cognify your files and query using cognee UI.

Cognee UI 2

Try cognee UI out locally here.

Understand our architecture

cognee concept diagram

Demos

  1. What is AI memory:

Learn about cognee

  1. Simple GraphRAG demo

Simple GraphRAG demo

  1. cognee with Ollama

cognee with local models

Code of Conduct

We are committed to making open source an enjoyable and respectful experience for our community. See CODE_OF_CONDUCT for more information.

💫 Contributors

contributors

Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognee-0.2.0.tar.gz (15.5 MB view details)

Uploaded Source

Built Distribution

cognee-0.2.0-py3-none-any.whl (963.4 kB view details)

Uploaded Python 3

File details

Details for the file cognee-0.2.0.tar.gz.

File metadata

  • Download URL: cognee-0.2.0.tar.gz
  • Upload date:
  • Size: 15.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.13 Darwin/24.5.0

File hashes

Hashes for cognee-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ae302040dfe36dffcfb991452249c121f3f82787b99db0205a82a278112ac71
MD5 9cf00dc8598838bace352a60658e4fba
BLAKE2b-256 f76a71ecadc9cfb90a512e3857ad2f02d4c47e69611aabb6bb5b7b20ac13e4ac

See more details on using hashes here.

File details

Details for the file cognee-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cognee-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 963.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.13 Darwin/24.5.0

File hashes

Hashes for cognee-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e11d76c8a56dc75045095f14f8efbd1a52357818688724c7e6ab147fbb1a447e
MD5 6ca9b16863d6ef1d10220358307077c1
BLAKE2b-256 13fef44e5217b40b49be8b238dcbe0dce3d45d3ae18284218d0b43039cf8235b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page