No description
Find a file
2024-03-30 17:53:53 +01:00
.data Update docs 2024-03-17 18:31:16 +01:00
.dlt fix: remove obsolete code 2024-03-13 10:19:03 +01:00
.github Update docs 2024-03-14 19:56:40 +01:00
.test_data chore: add functions to improve user experience 2024-03-30 15:25:34 +01:00
assets Update docs 2024-03-17 19:20:59 +01:00
bin Build the docker and push 2023-12-16 15:25:32 +01:00
cognee fix: change API client according to api implementation 2024-03-30 17:53:53 +01:00
docs fix: change API client according to api implementation 2024-03-30 17:53:53 +01:00
iterations Rename the build package name and refactored the local runner 2024-01-25 12:30:39 +01:00
notebooks fix: change API client according to api implementation 2024-03-30 17:53:53 +01:00
.env.template chore: rename package in files 2024-03-13 16:27:07 +01:00
.gitignore chore: add functions to improve user experience 2024-03-30 15:25:34 +01:00
.pylintrc feat: add create-memory and remember API endpoints 2024-02-25 23:56:50 +01:00
.python-version chore: update python version to 3.11 2024-03-29 14:10:20 +01:00
CONTRIBUTING.md Build the docker and push 2023-12-16 15:25:32 +01:00
docker-compose.yml Fixes to database manager 2024-02-20 09:29:09 +01:00
Dockerfile Update docs 2024-03-17 15:36:30 +01:00
entrypoint.sh Update docs 2024-03-17 15:36:30 +01:00
LICENSE Update LICENSE 2024-03-30 11:57:07 +01:00
mkdocs.yml Added docs 2024-03-24 11:09:04 +01:00
poetry.lock chore: add functions to improve user experience 2024-03-30 15:25:34 +01:00
pyproject.toml fix: change API client according to api implementation 2024-03-30 17:53:53 +01:00
README.md fix: change API client according to api implementation 2024-03-30 17:53:53 +01:00

cognee

Make data processing for LLMs easy

Cognee logo

Open-source framework for creating knowledge graphs and data models for LLMs.

cognee forks cognee stars cognee pull-requests cognee releases

🚀 It's alive

Try it yourself on Whatsapp with one of our partners by typing `/save {content you want to save}` followed by `/query {knowledge you saved previously}` For more info here are the docs

📦 Installation

With pip:

pip install "cognee[weaviate]"

With poetry:

poetry add "cognee[weaviate]"

💻 Usage

Setup

Create .env file in your project root directory in order to store environment variables such as API keys.

Note: Don't push .env file to git repo as it will expose those keys to others.

If cognee is installed with Weaviate as a vector database provider, add Weaviate environment variables:

WEAVIATE_URL = {YOUR_WEAVIATE_URL}
WEAVIATE_API_KEY = {YOUR_WEAVIATE_API_KEY}

Otherwise if cognee is installed with a default (Qdrant) vector database provider, add Qdrant environment variables:

QDRANT_URL = {YOUR_QDRANT_URL}
QDRANT_API_KEY = {YOUR_QDRANT_API_KEY}

Add OpenAI API Key environment variable:

OPENAI_API_KEY = {YOUR_OPENAI_API_KEY}

Cognee stores data and system files inside the library directory, which is lost if the library folder is removed. You can change the directories where cognee will store data and system files by calling config functions:

import cognee

cognee.config.system_root_directory(absolute_path_to_directory)

cognee.config.data_root_directory(absolute_path_to_directory)

Run

Add a new piece of information to the storage:

import cognee

cognee.add("some_text", dataset_name)

cognee.add([
    "some_text_1",
    "some_text_2",
    "some_text_3",
    ...
])

Or

cognee.add("file://{absolute_path_to_file}", dataset_name)

cognee.add(
    [
        "file://{absolute_path_to_file_1}",
        "file://{absolute_path_to_file_2}",
        "file://{absolute_path_to_file_3}",
        ...
    ],
    dataset_name
)

Or

cognee.add("data://{absolute_path_to_directory}", dataset_name)

# This is useful if you have a directory with files organized in subdirectories.
# You can target which directory to add by providing dataset_name.
# Example:
#            root
#           /    \
#      reports  bills
#     /       \
#   2024     2023
#
# cognee.add("data://{absolute_path_to_root}", "reports.2024")
# This will add just directory 2024 under reports.

Use LLMs and cognee to create graphs:

cognee.cognify(dataset_name)

Render the graph with our util function:

from cognee.utils import render_graph

graph_url = await render_graph(graph)

print(graph_url)

Query the graph for a piece of information:

search_results = cognee.search('SIMILARITY', "query_search")

print(search_results)

Demo

Check out our demo notebook here

Architecture

How Cognee Enhances Your Contextual Memory

Our framework for the OpenAI, Graph (Neo4j) and Vector (Weaviate) databases introduces three key enhancements:

  • Query Classifiers: Navigate information graph using Pydantic OpenAI classifiers.
  • Document Topology: Structure and store documents in public and private domains.
  • Personalized Context: Provide a context object to the LLM for a better response.

Image