cognee

cognee

Reliable LLM Memory for AI Applications and AI Agents

Stars: 1806

Visit
 screenshot

Cognee is an open-source framework designed for creating self-improving deterministic outputs for Large Language Models (LLMs) using graphs, LLMs, and vector retrieval. It provides a platform for AI engineers to enhance their models and generate more accurate results. Users can leverage Cognee to add new information, utilize LLMs for knowledge creation, and query the system for relevant knowledge. The tool supports various LLM providers and offers flexibility in adding different data types, such as text files or directories. Cognee aims to streamline the process of working with LLMs and improving AI models for better performance and efficiency.

README:

Cognee Logo

cognee - memory layer for AI apps and Agents

Demo . Learn more ยท Join Discord

GitHub forks GitHub stars GitHub commits Github tag Downloads License Contributors

AI Agent responses you can rely on.

Build dynamic Agent memory using scalable, modular ECL (Extract, Cognify, Load) pipelines.

More on use-cases.

Why cognee?

Features

  • Interconnect and retrieve your past conversations, documents, images and audio transcriptions
  • Reduce hallucinations, 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 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.

With pip

pip install cognee

๐Ÿ’ป 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.
  

Graph visualization: Graph Visualization Open in browser.

For more advanced usage, have a look at our documentation.

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

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for cognee

Similar Open Source Tools

For similar tasks

For similar jobs