Compare commits
1 commit
main
...
feature/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07505b5f5e |
1035 changed files with 30747 additions and 87268 deletions
127
.coderabbit.yaml
127
.coderabbit.yaml
|
|
@ -1,127 +0,0 @@
|
|||
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
|
||||
# .coderabbit.yaml
|
||||
language: en
|
||||
early_access: false
|
||||
enable_free_tier: true
|
||||
reviews:
|
||||
profile: chill
|
||||
instructions: >-
|
||||
# Code Review Instructions
|
||||
|
||||
- Ensure the code follows best practices and coding standards.
|
||||
- For **Python** code, follow
|
||||
[PEP 20](https://www.python.org/dev/peps/pep-0020/) and
|
||||
[CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161)
|
||||
standards.
|
||||
|
||||
# Documentation Review Instructions
|
||||
- Verify that documentation and comments are clear and comprehensive.
|
||||
- Verify that documentation and comments are free of spelling mistakes.
|
||||
|
||||
# Test Code Review Instructions
|
||||
- Ensure that test code is automated, comprehensive, and follows testing best practices.
|
||||
- Verify that all critical functionality is covered by tests.
|
||||
- Ensure that test code follow
|
||||
[CEP-8](https://gist.github.com/reactive-firewall/d840ee9990e65f302ce2a8d78ebe73f6)
|
||||
|
||||
# Misc.
|
||||
- Confirm that the code meets the project's requirements and objectives.
|
||||
- Confirm that copyright years are up-to date whenever a file is changed.
|
||||
request_changes_workflow: false
|
||||
high_level_summary: true
|
||||
high_level_summary_placeholder: '@coderabbitai summary'
|
||||
auto_title_placeholder: '@coderabbitai'
|
||||
review_status: true
|
||||
poem: false
|
||||
collapse_walkthrough: false
|
||||
sequence_diagrams: false
|
||||
changed_files_summary: true
|
||||
path_filters: ['!*.xc*/**', '!node_modules/**', '!dist/**', '!build/**', '!.git/**', '!venv/**', '!__pycache__/**']
|
||||
path_instructions:
|
||||
- path: README.md
|
||||
instructions: >-
|
||||
1. Consider the file 'README.md' the overview/introduction of the project.
|
||||
Also consider the 'README.md' file the first place to look for project documentation.
|
||||
|
||||
2. When reviewing the file 'README.md' it should be linted with help
|
||||
from the tools `markdownlint` and `languagetool`, pointing out any issues.
|
||||
|
||||
3. You may assume the file 'README.md' will contain GitHub flavor Markdown.
|
||||
- path: '**/*.py'
|
||||
instructions: >-
|
||||
When reviewing Python code for this project:
|
||||
|
||||
1. Prioritize portability over clarity, especially when dealing with cross-Python compatibility. However, with the priority in mind, do still consider improvements to clarity when relevant.
|
||||
|
||||
2. As a general guideline, consider the code style advocated in the PEP 8 standard (excluding the use of spaces for indentation) and evaluate suggested changes for code style compliance.
|
||||
|
||||
3. As a style convention, consider the code style advocated in [CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161) and evaluate suggested changes for code style compliance.
|
||||
|
||||
4. As a general guideline, try to provide any relevant, official, and supporting documentation links to any tool's suggestions in review comments. This guideline is important for posterity.
|
||||
|
||||
5. As a general rule, undocumented function definitions and class definitions in the project's Python code are assumed incomplete. Please consider suggesting a short summary of the code for any of these incomplete definitions as docstrings when reviewing.
|
||||
- path: cognee/tests/*
|
||||
instructions: >-
|
||||
When reviewing test code:
|
||||
|
||||
1. Prioritize portability over clarity, especially when dealing with cross-Python compatibility. However, with the priority in mind, do still consider improvements to clarity when relevant.
|
||||
|
||||
2. As a general guideline, consider the code style advocated in the PEP 8 standard (excluding the use of spaces for indentation) and evaluate suggested changes for code style compliance.
|
||||
|
||||
3. As a style convention, consider the code style advocated in [CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161) and evaluate suggested changes for code style compliance, pointing out any violations discovered.
|
||||
|
||||
4. As a general guideline, try to provide any relevant, official, and supporting documentation links to any tool's suggestions in review comments. This guideline is important for posterity.
|
||||
|
||||
5. As a project rule, Python source files with names prefixed by the string "test_" and located in the project's "tests" directory are the project's unit-testing code. It is safe, albeit a heuristic, to assume these are considered part of the project's minimal acceptance testing unless a justifying exception to this assumption is documented.
|
||||
|
||||
6. As a project rule, any files without extensions and with names prefixed by either the string "check_" or the string "test_", and located in the project's "tests" directory, are the project's non-unit test code. "Non-unit test" in this context refers to any type of testing other than unit testing, such as (but not limited to) functional testing, style linting, regression testing, etc. It can also be assumed that non-unit testing code is usually written as Bash shell scripts.
|
||||
- path: requirements.txt
|
||||
instructions: >-
|
||||
* The project's own Python dependencies are recorded in 'requirements.txt' for production code.
|
||||
|
||||
* The project's testing-specific Python dependencies are recorded in 'tests/requirements.txt' and are used for testing the project.
|
||||
|
||||
* The project's documentation-specific Python dependencies are recorded in 'docs/requirements.txt' and are used only for generating Python-focused documentation for the project. 'docs/requirements.txt' may be absent if not applicable.
|
||||
|
||||
Consider these 'requirements.txt' files the records of truth regarding project dependencies.
|
||||
- path: .github/**
|
||||
instructions: >-
|
||||
* When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
|
||||
|
||||
* 'actionlint' erroneously generates false positives when dealing with GitHub's `${{ ... }}` syntax in conditionals.
|
||||
|
||||
* 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid `${{ ... }}` syntax.
|
||||
abort_on_close: true
|
||||
auto_review:
|
||||
enabled: true
|
||||
auto_incremental_review: true
|
||||
ignore_title_keywords: []
|
||||
labels: []
|
||||
drafts: false
|
||||
base_branches:
|
||||
- dev
|
||||
- main
|
||||
tools:
|
||||
shellcheck:
|
||||
enabled: true
|
||||
ruff:
|
||||
enabled: true
|
||||
configuration:
|
||||
extend_select:
|
||||
- E # Pycodestyle errors (style issues)
|
||||
- F # PyFlakes codes (logical errors)
|
||||
- W # Pycodestyle warnings
|
||||
- N # PEP 8 naming conventions
|
||||
ignore:
|
||||
- W191
|
||||
- W391
|
||||
- E117
|
||||
- D208
|
||||
line_length: 100
|
||||
dummy_variable_rgx: '^(_.*|junk|extra)$' # Variables starting with '_' or named 'junk' or 'extras', are considered dummy variables
|
||||
markdownlint:
|
||||
enabled: true
|
||||
yamllint:
|
||||
enabled: true
|
||||
chat:
|
||||
auto_reply: true
|
||||
404
.env.template
404
.env.template
|
|
@ -1,175 +1,189 @@
|
|||
###############################################################################
|
||||
# NOTE: With default settings Cognee only needs an OpenAI LLM_API_KEY to be set.
|
||||
# The rest of the settings don't have to be set.
|
||||
# Default relational database: SQLite
|
||||
# Default vector database : LanceDB
|
||||
# Default graph database : Kuzu
|
||||
#
|
||||
# These default databases are all file-based, so no extra setup is needed
|
||||
# for local use. The data by default will be stored in your .venv
|
||||
###############################################################################
|
||||
|
||||
################################################################################
|
||||
# 🧠 LLM Settings
|
||||
################################################################################
|
||||
# Currently we support BAML and Instructor(using litellm) for structured outputs
|
||||
STRUCTURED_OUTPUT_FRAMEWORK="instructor"
|
||||
###
|
||||
### DEV
|
||||
###
|
||||
|
||||
|
||||
TOKENIZERS_PARALLELISM="false"
|
||||
|
||||
###
|
||||
### LLM
|
||||
###
|
||||
|
||||
###
|
||||
### simple, "expensive", an OpenAPI key
|
||||
###
|
||||
|
||||
LLM_API_KEY="your_api_key"
|
||||
LLM_MODEL="openai/gpt-5-mini"
|
||||
LLM_PROVIDER="openai"
|
||||
LLM_ENDPOINT=""
|
||||
LLM_API_VERSION=""
|
||||
|
||||
###
|
||||
### DEV LLM, cheap with content filters
|
||||
###
|
||||
|
||||
LLM_MODEL="azure/gpt-4o-mini"
|
||||
LLM_ENDPOINT="https://DNS.azure.com/openai/deployments/gpt-4o-mini"
|
||||
LLM_API_KEY="<<TALK TO YOUR AZURE GUY"
|
||||
LLM_API_VERSION="2024-12-01-preview"
|
||||
#llm api version might not be relevant
|
||||
LLM_MAX_TOKENS="16384"
|
||||
# Instructor's modes determine how structured data is requested from and extracted from LLM responses
|
||||
# You can change this type (i.e. mode) via this env variable
|
||||
# Each LLM has its own default value, e.g. gpt-5 models have "json_schema_mode"
|
||||
LLM_INSTRUCTOR_MODE=""
|
||||
|
||||
EMBEDDING_MODEL="azure/text-embedding-3-large"
|
||||
EMBEDDING_ENDPOINT="https://DNS.openai.azure.com/openai/deployments/text-embedding-3-large"
|
||||
EMBEDDING_API_KEY="<<TALK TO YOUR AZURE GUY>"
|
||||
EMBEDDING_API_VERSION="2024-12-01-preview"
|
||||
EMBEDDING_DIMENSIONS=3072
|
||||
EMBEDDING_MAX_TOKENS=8191
|
||||
|
||||
###
|
||||
### free local LLM, install it
|
||||
###
|
||||
|
||||
LLM_API_KEY = "ollama"
|
||||
LLM_MODEL = "llama3.1:8b"
|
||||
LLM_PROVIDER = "ollama"
|
||||
LLM_ENDPOINT = "http://localhost:11434/v1"
|
||||
EMBEDDING_PROVIDER = "ollama"
|
||||
EMBEDDING_MODEL = "avr/sfr-embedding-mistral:latest"
|
||||
EMBEDDING_ENDPOINT = "http://localhost:11434/api/embeddings"
|
||||
EMBEDDING_DIMENSIONS = 4096
|
||||
HUGGINGFACE_TOKENIZER = "Salesforce/SFR-Embedding-Mistral"
|
||||
|
||||
###
|
||||
### openrouter, also frewe
|
||||
###
|
||||
|
||||
LLM_API_KEY="<<go-get-one-yourself"
|
||||
LLM_PROVIDER="custom"
|
||||
LLM_MODEL="openrouter/google/gemini-2.0-flash-lite-preview-02-05:free"
|
||||
LLM_ENDPOINT="https://openrouter.ai/api/v1"
|
||||
|
||||
###
|
||||
### deepinfra
|
||||
###
|
||||
|
||||
LLM_API_KEY="<<>>"
|
||||
LLM_PROVIDER="custom"
|
||||
LLM_MODEL="deepinfra/meta-llama/Meta-Llama-3-8B-Instruct"
|
||||
LLM_ENDPOINT="https://api.deepinfra.com/v1/openai"
|
||||
|
||||
EMBEDDING_PROVIDER="openai"
|
||||
EMBEDDING_MODEL="openai/text-embedding-3-large"
|
||||
EMBEDDING_API_KEY="<<>>"
|
||||
EMBEDDING_MODEL="deepinfra/BAAI/bge-base-en-v1.5"
|
||||
EMBEDDING_ENDPOINT=""
|
||||
EMBEDDING_API_VERSION=""
|
||||
EMBEDDING_DIMENSIONS=3072
|
||||
EMBEDDING_MAX_TOKENS=8191
|
||||
EMBEDDING_BATCH_SIZE=36
|
||||
# If embedding key is not provided same key set for LLM_API_KEY will be used
|
||||
#EMBEDDING_API_KEY="your_api_key"
|
||||
|
||||
###
|
||||
### DB
|
||||
###
|
||||
|
||||
# If using BAML structured output these env variables will be used
|
||||
BAML_LLM_PROVIDER=openai
|
||||
BAML_LLM_MODEL="gpt-5-mini"
|
||||
BAML_LLM_ENDPOINT=""
|
||||
BAML_LLM_API_KEY="your_api_key"
|
||||
BAML_LLM_API_VERSION=""
|
||||
###
|
||||
### db minimal/default
|
||||
###
|
||||
|
||||
GRAPH_DATABASE_PROVIDER="networkx"
|
||||
VECTOR_DB_PROVIDER="lancedb"
|
||||
DB_PROVIDER=sqlite
|
||||
DB_NAME=cognee_db
|
||||
|
||||
################################################################################
|
||||
# 📂 ROOT DIRECTORY FOR DATABASES
|
||||
################################################################################
|
||||
# Set up the Cognee system directory. Cognee will store system files and databases here.
|
||||
# Useful for setting root directory inside docker and also to avoid storing the databases in .venv
|
||||
# DATA_ROOT_DIRECTORY='/Users/<user>/Desktop/cognee/.cognee_data/'
|
||||
# SYSTEM_ROOT_DIRECTORY='/Users/<user>/Desktop/cognee/.cognee_system/'
|
||||
|
||||
################################################################################
|
||||
# ☁️ Storage Backend Settings
|
||||
################################################################################
|
||||
# Configure storage backend (local filesystem or S3)
|
||||
# STORAGE_BACKEND="local" # Default: uses local filesystem
|
||||
#
|
||||
# -- To switch to S3 storage, uncomment and fill these: ---------------------
|
||||
# STORAGE_BACKEND="s3"
|
||||
# STORAGE_BUCKET_NAME="your-bucket-name"
|
||||
# AWS_REGION="us-east-1"
|
||||
# AWS_ACCESS_KEY_ID="your-access-key"
|
||||
# AWS_SECRET_ACCESS_KEY="your-secret-key"
|
||||
#
|
||||
# -- S3 Root Directories (optional) -----------------------------------------
|
||||
# DATA_ROOT_DIRECTORY="s3://your-bucket/cognee/data"
|
||||
# SYSTEM_ROOT_DIRECTORY="s3://your-bucket/cognee/system"
|
||||
#
|
||||
# -- Cache Directory (auto-configured for S3) -------------------------------
|
||||
# When STORAGE_BACKEND=s3, cache automatically uses S3: s3://BUCKET/cognee/cache
|
||||
# To override the automatic S3 cache location, uncomment:
|
||||
# CACHE_ROOT_DIRECTORY="s3://your-bucket/cognee/cache"
|
||||
|
||||
################################################################################
|
||||
# 🗄️ Relational database settings
|
||||
################################################################################
|
||||
###
|
||||
### Relational options
|
||||
###
|
||||
|
||||
DB_PROVIDER="sqlite"
|
||||
DB_NAME=cognee_db
|
||||
|
||||
# -- To switch to Postgres / PGVector, uncomment and fill these: -------------
|
||||
#DB_PROVIDER=postgres
|
||||
#DB_NAME=cognee_db
|
||||
# To use Postgres with the Cognee backend in Docker compose use the following instead: DB_HOST=host.docker.internal
|
||||
#DB_HOST=127.0.0.1
|
||||
#DB_PORT=5432
|
||||
#DB_USERNAME=cognee
|
||||
#DB_PASSWORD=cognee
|
||||
DB_PROVIDER=postgres
|
||||
DB_NAME=cognee_db
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_USERNAME=cognee
|
||||
DB_PASSWORD=cognee
|
||||
|
||||
################################################################################
|
||||
# 🕸️ Graph Database settings
|
||||
################################################################################
|
||||
###
|
||||
### Graph options
|
||||
###
|
||||
|
||||
|
||||
#Default
|
||||
|
||||
# Default (local file-based)
|
||||
GRAPH_DATABASE_PROVIDER="kuzu"
|
||||
# Handler for multi-user access control mode, it handles how should the mapping/creation of separate DBs be handled per Cognee dataset
|
||||
GRAPH_DATASET_DATABASE_HANDLER="kuzu"
|
||||
|
||||
# -- To switch to Remote Kuzu uncomment and fill these: -------------------------------------------------------------
|
||||
#GRAPH_DATABASE_PROVIDER="kuzu"
|
||||
#GRAPH_DATABASE_PROVIDER="kuzu-remote"
|
||||
#GRAPH_DATABASE_URL="http://localhost:8000"
|
||||
#GRAPH_DATABASE_USERNAME=XXX
|
||||
#GRAPH_DATABASE_PASSWORD=YYY
|
||||
#or if using remote
|
||||
|
||||
# -- To switch to Neo4j uncomment and fill these: -------------------------------------------------------------------
|
||||
#GRAPH_DATABASE_PROVIDER="neo4j"
|
||||
#GRAPH_DATABASE_URL=bolt://localhost:7687
|
||||
#GRAPH_DATABASE_NAME="neo4j"
|
||||
#GRAPH_DATABASE_USERNAME=neo4j
|
||||
#GRAPH_DATABASE_PASSWORD=localneo4j
|
||||
GRAPH_DATABASE_PROVIDER="kuzu"
|
||||
GRAPH_DATABASE_PROVIDER="kuzu-remote"
|
||||
GRAPH_DATABASE_URL="http://localhost:8000"
|
||||
GRAPH_DATABASE_USERNAME=XXX
|
||||
GRAPH_DATABASE_PASSWORD=YYY
|
||||
|
||||
################################################################################
|
||||
# 📐 Vector Database settings
|
||||
################################################################################
|
||||
# or if using neo4j
|
||||
|
||||
GRAPH_DATABASE_PROVIDER="neo4j"
|
||||
GRAPH_DATABASE_URL=bolt://localhost:7687
|
||||
GRAPH_DATABASE_USERNAME=neo4j
|
||||
GRAPH_DATABASE_PASSWORD=localneo4j
|
||||
|
||||
###
|
||||
### Vector options
|
||||
###
|
||||
|
||||
# Supported providers: pgvector | qdrant | weaviate | milvus | lancedb | chromadb
|
||||
VECTOR_DB_PROVIDER="lancedb"
|
||||
# Not needed if a cloud vector database is not used
|
||||
VECTOR_DB_URL=
|
||||
VECTOR_DB_KEY=
|
||||
# Handler for multi-user access control mode, it handles how should the mapping/creation of separate DBs be handled per Cognee dataset
|
||||
VECTOR_DATASET_DATABASE_HANDLER="lancedb"
|
||||
|
||||
################################################################################
|
||||
# 🧩 Ontology resolver settings
|
||||
################################################################################
|
||||
VECTOR_DB_PROVIDER="pgvector"
|
||||
|
||||
# -- Ontology resolver params --------------------------------------
|
||||
# ONTOLOGY_RESOLVER=rdflib # Default: uses rdflib and owl file to read ontology structures
|
||||
# MATCHING_STRATEGY=fuzzy # Default: uses fuzzy matching with 80% similarity threshold
|
||||
# ONTOLOGY_FILE_PATH=YOUR_FULL_FULE_PATH # Default: empty
|
||||
# To add ontology resolvers, either set them as it is set in ontology_example or add full_path and settings as envs.
|
||||
###
|
||||
### for release test
|
||||
###
|
||||
|
||||
################################################################################
|
||||
# 🔄 MIGRATION (RELATIONAL → GRAPH) SETTINGS
|
||||
################################################################################
|
||||
LLM_API_KEY="..."
|
||||
|
||||
MIGRATION_DB_PATH="/path/to/migration/directory"
|
||||
MIGRATION_DB_NAME="migration_database.sqlite"
|
||||
OPENAI_API_KEY="..."
|
||||
|
||||
MIGRATION_DB_PATH="~/Downloads/"
|
||||
MIGRATION_DB_NAME="Chinook_Sqlite.sqlite"
|
||||
MIGRATION_DB_PROVIDER="sqlite"
|
||||
|
||||
# -- Postgres-specific migration params --------------------------------------
|
||||
GRAPH_DATABASE_URL="bolt://54.246.89.112:7687"
|
||||
GRAPH_DATABASE_USERNAME="neo4j"
|
||||
GRAPH_DATABASE_PASSWORD="pleaseletmein"
|
||||
|
||||
###
|
||||
### ROOT DIRECTORY IF USING COGNEE LIB INSIDE A DOCKER
|
||||
###
|
||||
# Set up the Cognee system directory. Cognee will store system files and databases here.
|
||||
|
||||
|
||||
DATA_ROOT_DIRECTORY ='/cognee_data/data'
|
||||
SYSTEM_ROOT_DIRECTORY= '/cognee_data/system'
|
||||
|
||||
|
||||
|
||||
# Postgres specific parameters (Only if Postgres or PGVector is used). Do not use for cognee default simplest setup of SQLite-NetworkX-LanceDB
|
||||
# DB_USERNAME=cognee
|
||||
# DB_PASSWORD=cognee
|
||||
# To use Postgres with the Cognee backend in Docker compose use the following instead: DB_HOST=host.docker.internal
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=5432
|
||||
|
||||
|
||||
|
||||
# Params for migrating relational database data to graph / Cognee ( PostgreSQL and SQLite supported )
|
||||
# MIGRATION_DB_PATH="/path/to/migration/directory"
|
||||
# MIGRATION_DB_NAME="migration_database.sqlite"
|
||||
# MIGRATION_DB_PROVIDER="sqlite"
|
||||
# Postgres specific parameters for migration
|
||||
# MIGRATION_DB_USERNAME=cognee
|
||||
# MIGRATION_DB_PASSWORD=cognee
|
||||
# MIGRATION_DB_HOST="127.0.0.1"
|
||||
# MIGRATION_DB_PORT=5432
|
||||
|
||||
################################################################################
|
||||
# 🔒 Security Settings
|
||||
################################################################################
|
||||
# LITELLM Logging Level. Set to quiten down logging
|
||||
LITELLM_LOG="ERROR"
|
||||
|
||||
# When set to false don't allow adding of local system files to Cognee. Should be set to False when Cognee is used as a backend.
|
||||
ACCEPT_LOCAL_FILE_PATH=True
|
||||
|
||||
# When set to false don't allow HTTP requests to be sent from Cognee.
|
||||
# This protects against Server Side Request Forgery when proper infrastructure is not in place.
|
||||
ALLOW_HTTP_REQUESTS=True
|
||||
|
||||
# When set to false don't allow cypher search to be used in Cognee.
|
||||
ALLOW_CYPHER_QUERY=True
|
||||
|
||||
# When set to False errors during data processing will be returned as info but not raised to allow handling of faulty documents
|
||||
RAISE_INCREMENTAL_LOADING_ERRORS=True
|
||||
|
||||
# When set to True, the Cognee backend will require authentication for requests to the API.
|
||||
# If you're disabling this, make sure to also disable ENABLE_BACKEND_ACCESS_CONTROL.
|
||||
REQUIRE_AUTHENTICATION=False
|
||||
# Set this environment variable to disable sending telemetry data
|
||||
# TELEMETRY_DISABLED=1
|
||||
|
||||
# Set this variable to True to enforce usage of backend access control for Cognee
|
||||
# Note: This is only currently supported by the following databases:
|
||||
|
|
@ -177,124 +191,6 @@ REQUIRE_AUTHENTICATION=False
|
|||
# Vector: LanceDB
|
||||
# Graph: KuzuDB
|
||||
#
|
||||
# It enforces creation of databases per Cognee user + dataset. Does not work with some graph and database providers.
|
||||
# Disable mode when using not supported graph/vector databases.
|
||||
ENABLE_BACKEND_ACCESS_CONTROL=True
|
||||
# It enforces LanceDB and KuzuDB use and uses them to create databases per Cognee user + dataset
|
||||
ENABLE_BACKEND_ACCESS_CONTROL=False
|
||||
|
||||
################################################################################
|
||||
# ☁️ Cloud Sync Settings
|
||||
################################################################################
|
||||
|
||||
# Cognee Cloud API settings for syncing data to/from cloud infrastructure
|
||||
COGNEE_CLOUD_API_URL="http://localhost:8001"
|
||||
COGNEE_CLOUD_AUTH_TOKEN="your-api-key"
|
||||
|
||||
################################################################################
|
||||
# UI Settings
|
||||
################################################################################
|
||||
|
||||
# URL where the frontend is served, defaults to http://localhost:3000
|
||||
UI_APP_URL=http://localhost:3000
|
||||
|
||||
################################################################################
|
||||
# 🛠️ DEV Settings
|
||||
################################################################################
|
||||
|
||||
ENV="local"
|
||||
|
||||
TOKENIZERS_PARALLELISM="false"
|
||||
|
||||
# LITELLM Logging Level. Set to quiet down logging
|
||||
LITELLM_LOG="ERROR"
|
||||
|
||||
# Set this environment variable to disable sending telemetry data
|
||||
# TELEMETRY_DISABLED=1
|
||||
|
||||
# Default User Configuration
|
||||
# DEFAULT_USER_EMAIL=""
|
||||
# DEFAULT_USER_PASSWORD=""
|
||||
|
||||
################################################################################
|
||||
# 📂 AWS Settings
|
||||
################################################################################
|
||||
|
||||
#AWS_REGION=""
|
||||
#AWS_ENDPOINT_URL=""
|
||||
#AWS_ACCESS_KEY_ID=""
|
||||
#AWS_SECRET_ACCESS_KEY=""
|
||||
#AWS_SESSION_TOKEN=""
|
||||
|
||||
------------------------------- END OF POSSIBLE SETTINGS -------------------------------
|
||||
|
||||
|
||||
###############################################################################
|
||||
# 🧪 EXAMPLE OVERRIDES (commented out)
|
||||
###############################################################################
|
||||
# The blocks below show how to configure alternative providers.
|
||||
# Uncomment + fill values to switch.
|
||||
|
||||
########## Azure OpenAI #######################################################
|
||||
#LLM_MODEL="azure/gpt-5-mini"
|
||||
#LLM_ENDPOINT="https://DNS.azure.com/openai/deployments/gpt-5-mini"
|
||||
#LLM_API_KEY="<<TALK TO YOUR AZURE GUY"
|
||||
#LLM_API_VERSION="2024-12-01-preview"
|
||||
|
||||
## llm api version might not be relevant
|
||||
#LLM_MAX_TOKENS="16384"
|
||||
|
||||
#EMBEDDING_MODEL="azure/text-embedding-3-large"
|
||||
#EMBEDDING_ENDPOINT="https://DNS.openai.azure.com/openai/deployments/text-embedding-3-large"
|
||||
#EMBEDDING_API_KEY="<<TALK TO YOUR AZURE GUY>"
|
||||
#EMBEDDING_API_VERSION="2024-12-01-preview"
|
||||
#EMBEDDING_DIMENSIONS=3072
|
||||
#EMBEDDING_MAX_TOKENS=8191
|
||||
|
||||
########## Local LLM via Ollama ###############################################
|
||||
|
||||
|
||||
#LLM_API_KEY ="ollama"
|
||||
#LLM_MODEL="llama3.1:8b"
|
||||
#LLM_PROVIDER="ollama"
|
||||
#LLM_ENDPOINT="http://localhost:11434/v1"
|
||||
#EMBEDDING_PROVIDER="ollama"
|
||||
#EMBEDDING_MODEL="nomic-embed-text:latest"
|
||||
#EMBEDDING_ENDPOINT="http://localhost:11434/api/embed"
|
||||
#EMBEDDING_DIMENSIONS=768
|
||||
#HUGGINGFACE_TOKENIZER="nomic-ai/nomic-embed-text-v1.5"
|
||||
|
||||
########## OpenRouter (also free) #########################################################
|
||||
|
||||
#LLM_API_KEY="<<go-get-one-yourself"
|
||||
#LLM_PROVIDER="custom"
|
||||
#LLM_MODEL="openrouter/google/gemini-2.0-flash-lite-preview-02-05:free"
|
||||
#LLM_ENDPOINT="https://openrouter.ai/api/v1"
|
||||
|
||||
########## DeepInfra ##########################################################
|
||||
|
||||
#LLM_API_KEY="<<>>"
|
||||
#LLM_PROVIDER="custom"
|
||||
#LLM_MODEL="deepinfra/meta-llama/Meta-Llama-3-8B-Instruct"
|
||||
#LLM_ENDPOINT="https://api.deepinfra.com/v1/openai"
|
||||
|
||||
#EMBEDDING_PROVIDER="openai"
|
||||
#EMBEDDING_API_KEY="<<>>"
|
||||
#EMBEDDING_MODEL="deepinfra/BAAI/bge-base-en-v1.5"
|
||||
#EMBEDDING_ENDPOINT=""
|
||||
#EMBEDDING_API_VERSION=""
|
||||
#EMBEDDING_DIMENSIONS=3072
|
||||
#EMBEDDING_MAX_TOKENS=8191
|
||||
|
||||
|
||||
########## Release Test ###############################################
|
||||
|
||||
#LLM_API_KEY="..."
|
||||
|
||||
#OPENAI_API_KEY="..."
|
||||
|
||||
#MIGRATION_DB_PATH="~/Downloads/"
|
||||
#MIGRATION_DB_NAME="Chinook_Sqlite.sqlite"
|
||||
#MIGRATION_DB_PROVIDER="sqlite"
|
||||
|
||||
#GRAPH_DATABASE_URL="bolt://54.246.89.112:7687"
|
||||
#GRAPH_DATABASE_USERNAME="neo4j"
|
||||
#GRAPH_DATABASE_PASSWORD="pleaseletmein"
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
# .gitguardian.yml
|
||||
version: v1
|
||||
|
||||
secret-scan:
|
||||
# Ignore specific files
|
||||
excluded-paths:
|
||||
- '.env.template'
|
||||
- '.github/workflows/*.yml'
|
||||
- 'examples/**'
|
||||
- 'tests/**'
|
||||
|
||||
# Ignore specific patterns
|
||||
excluded-detectors:
|
||||
- 'Generic Password'
|
||||
- 'Generic High Entropy Secret'
|
||||
|
||||
# Ignore by commit (if needed)
|
||||
excluded-commits:
|
||||
- '782bbb4'
|
||||
- 'f857e07'
|
||||
|
||||
# Custom rules for template files
|
||||
paths-ignore:
|
||||
- path: '.env.template'
|
||||
comment: 'Template file with placeholder values'
|
||||
- path: '.github/workflows/search_db_tests.yml'
|
||||
comment: 'Test workflow with test credentials'
|
||||
- path: 'docker-compose.yml'
|
||||
comment: 'Development docker compose with test credentials (neo4j/pleaseletmein, postgres cognee/cognee)'
|
||||
- path: 'deployment/helm/docker-compose-helm.yml'
|
||||
comment: 'Helm deployment docker compose with test postgres credentials (cognee/cognee)'
|
||||
97
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
97
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -1,97 +0,0 @@
|
|||
name: 🐛 Bug Report
|
||||
description: Report a bug or unexpected behavior
|
||||
title: "[Bug]: "
|
||||
labels: ["bug", "needs-triage"]
|
||||
assignees: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report! Please provide a clear and detailed description.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: Please provide a clear and concise description of the bug. What happened vs what you expected?
|
||||
placeholder: Describe the bug in detail...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: Please provide detailed steps to reproduce the issue
|
||||
placeholder: |
|
||||
1. Go to...
|
||||
2. Click on...
|
||||
3. See error...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: What did you expect to happen?
|
||||
placeholder: Describe what you expected...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: What actually happened?
|
||||
placeholder: Describe what actually happened...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: Please provide your environment details
|
||||
placeholder: |
|
||||
- OS: [e.g. macOS 13.0, Ubuntu 20.04]
|
||||
- Python version: [e.g. 3.9.0]
|
||||
- Cognee version: [e.g. 0.1.0]
|
||||
- LLM Provider: [e.g. OpenAI, Ollama]
|
||||
- Database: [e.g. Neo4j]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs/Error Messages
|
||||
description: Please include any relevant logs or error messages
|
||||
placeholder: Paste logs here...
|
||||
render: shell
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context about the problem here
|
||||
placeholder: Any additional information...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Pre-submission Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: I have searched existing issues to ensure this bug hasn't been reported already
|
||||
required: true
|
||||
- label: I have provided a clear and detailed description of the bug
|
||||
required: true
|
||||
- label: I have included steps to reproduce the issue
|
||||
required: true
|
||||
- label: I have included my environment details
|
||||
required: true
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,8 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💬 Discord Community
|
||||
url: https://discord.gg/NQtRemgQVD
|
||||
about: Join our Discord community for questions, discussions, and support
|
||||
- name: 📖 Documentation
|
||||
url: https://docs.cognee.ai
|
||||
about: Check our documentation for guides and API references
|
||||
74
.github/ISSUE_TEMPLATE/documentation.yml
vendored
74
.github/ISSUE_TEMPLATE/documentation.yml
vendored
|
|
@ -1,74 +0,0 @@
|
|||
name: 📚 Documentation Issue
|
||||
description: Report an issue with documentation or suggest documentation improvements
|
||||
title: "[Docs]: "
|
||||
labels: ["documentation", "needs-triage"]
|
||||
assignees: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for helping improve our documentation! Please provide details about the documentation issue or improvement.
|
||||
|
||||
- type: dropdown
|
||||
id: doc-type
|
||||
attributes:
|
||||
label: Documentation Type
|
||||
description: What type of documentation issue is this?
|
||||
options:
|
||||
- Missing documentation
|
||||
- Incorrect documentation
|
||||
- Unclear documentation
|
||||
- Documentation improvement
|
||||
- New documentation request
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: location
|
||||
attributes:
|
||||
label: Documentation Location
|
||||
description: Where is the documentation issue located? (URL, file path, section, etc.)
|
||||
placeholder: https://cognee.ai/docs/... or specific file/section
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: issue
|
||||
attributes:
|
||||
label: Issue Description
|
||||
description: Please describe the documentation issue or improvement needed
|
||||
placeholder: The documentation is unclear about...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: Suggested Improvement
|
||||
description: How would you improve this documentation?
|
||||
placeholder: I suggest changing this to...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context about the documentation issue
|
||||
placeholder: Additional context...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Pre-submission Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: I have searched existing issues to ensure this documentation issue hasn't been reported already
|
||||
required: true
|
||||
- label: I have provided a clear description of the documentation issue
|
||||
required: true
|
||||
- label: I have specified the location of the documentation issue
|
||||
required: true
|
||||
|
||||
78
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
78
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -1,78 +0,0 @@
|
|||
name: 🚀 Feature Request
|
||||
description: Suggest a new feature or enhancement
|
||||
title: "[Feature]: "
|
||||
labels: ["enhancement", "needs-triage"]
|
||||
assignees: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for suggesting a new feature! Please provide a clear and detailed description of your idea.
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem Statement
|
||||
description: Is your feature request related to a problem? Please describe the problem you're trying to solve.
|
||||
placeholder: I'm always frustrated when...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Proposed Solution
|
||||
description: Describe the solution you'd like to see implemented
|
||||
placeholder: I would like to see...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives Considered
|
||||
description: Describe any alternative solutions or features you've considered
|
||||
placeholder: I have also considered...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: use-case
|
||||
attributes:
|
||||
label: Use Case
|
||||
description: Describe your specific use case and how this feature would help
|
||||
placeholder: This feature would help me...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: implementation
|
||||
attributes:
|
||||
label: Implementation Ideas
|
||||
description: If you have ideas about how this could be implemented, please share them
|
||||
placeholder: This could be implemented by...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context, screenshots, or examples about the feature request
|
||||
placeholder: Additional context...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Pre-submission Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: I have searched existing issues to ensure this feature hasn't been requested already
|
||||
required: true
|
||||
- label: I have provided a clear problem statement and proposed solution
|
||||
required: true
|
||||
- label: I have described my specific use case
|
||||
required: true
|
||||
|
||||
38
.github/actions/cognee_setup/action.yml
vendored
38
.github/actions/cognee_setup/action.yml
vendored
|
|
@ -1,19 +1,11 @@
|
|||
name: cognee-setup
|
||||
description: "Sets up Python, installs uv, and installs dependencies for Cognee."
|
||||
description: "Sets up Python, installs Poetry, loads venv from cache, and installs dependencies for Cognee."
|
||||
|
||||
inputs:
|
||||
python-version:
|
||||
description: "Which Python version to use"
|
||||
required: false
|
||||
default: "3.11.x"
|
||||
extra-dependencies:
|
||||
description: "Additional extra dependencies to install (space-separated)"
|
||||
required: false
|
||||
default: ""
|
||||
rebuild-lockfile:
|
||||
description: "Whether to rebuild the uv lockfile"
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
|
@ -24,31 +16,11 @@ runs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Rebuild uv lockfile
|
||||
if: ${{ inputs.rebuild-lockfile == 'true' }}
|
||||
- name: Install Poetry
|
||||
shell: bash
|
||||
run: |
|
||||
rm uv.lock
|
||||
uv lock
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
pip install poetry
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
EXTRA_ARGS=""
|
||||
if [ -n "${{ inputs.extra-dependencies }}" ]; then
|
||||
IFS=' ' read -r -a deps <<< "${{ inputs.extra-dependencies }}"
|
||||
for extra in "${deps[@]}"; do
|
||||
EXTRA_ARGS="$EXTRA_ARGS --extra $extra"
|
||||
done
|
||||
fi
|
||||
uv sync --extra api --extra docs --extra evals --extra codegraph --extra ollama --extra dev --extra neo4j --extra redis $EXTRA_ARGS
|
||||
|
||||
- name: Add telemetry identifier for telemetry test and in case telemetry is enabled by accident
|
||||
shell: bash
|
||||
run: |
|
||||
echo "test-machine" > .anon_id
|
||||
run: poetry install --no-interaction -E api -E docs -E evals -E gemini -E codegraph -E ollama -E dev
|
||||
|
|
|
|||
67
.github/actions/setup_neo4j/action.yml
vendored
67
.github/actions/setup_neo4j/action.yml
vendored
|
|
@ -1,67 +0,0 @@
|
|||
name: 'Setup Neo4j with Graph Data Science'
|
||||
description: 'Sets up a Neo4j instance with APOC and Graph Data Science plugins for testing'
|
||||
inputs:
|
||||
neo4j-version:
|
||||
description: 'Neo4j version to use'
|
||||
required: false
|
||||
default: '5.21'
|
||||
neo4j-password:
|
||||
description: 'Password for Neo4j'
|
||||
required: false
|
||||
default: 'cognee_test_password'
|
||||
outputs:
|
||||
neo4j-url:
|
||||
description: 'Neo4j connection URL'
|
||||
value: 'bolt://localhost:7687'
|
||||
neo4j-username:
|
||||
description: 'Neo4j username'
|
||||
value: 'neo4j'
|
||||
neo4j-password:
|
||||
description: 'Neo4j password'
|
||||
value: ${{ inputs.neo4j-password }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Start Neo4j with GDS
|
||||
shell: bash
|
||||
run: |
|
||||
docker run -d \
|
||||
--name neo4j-test \
|
||||
-p 7474:7474 -p 7687:7687 \
|
||||
-e NEO4J_AUTH="neo4j/${{ inputs.neo4j-password }}" \
|
||||
-e NEO4J_PLUGINS='["apoc", "graph-data-science"]' \
|
||||
-e NEO4J_dbms_security_procedures_unrestricted="apoc.*,gds.*" \
|
||||
-e NEO4J_apoc_export_file_enabled=true \
|
||||
-e NEO4J_apoc_import_file_enabled=true \
|
||||
neo4j:${{ inputs.neo4j-version }}
|
||||
|
||||
- name: Wait for Neo4j to be ready
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Waiting for Neo4j to start..."
|
||||
timeout=60
|
||||
counter=0
|
||||
|
||||
while [ $counter -lt $timeout ]; do
|
||||
if docker exec neo4j-test cypher-shell -u neo4j -p "${{ inputs.neo4j-password }}" "RETURN 1" > /dev/null 2>&1; then
|
||||
echo "Neo4j is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting... ($counter/$timeout)"
|
||||
sleep 2
|
||||
counter=$((counter + 2))
|
||||
done
|
||||
|
||||
if [ $counter -ge $timeout ]; then
|
||||
echo "Neo4j failed to start within $timeout seconds"
|
||||
docker logs neo4j-test
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Verify GDS is available
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Verifying Graph Data Science library is available..."
|
||||
docker exec neo4j-test cypher-shell -u neo4j -p "${{ inputs.neo4j-password }}" \
|
||||
"CALL gds.version() YIELD gdsVersion RETURN gdsVersion"
|
||||
echo "GDS verification complete!"
|
||||
12
.github/core-team.txt
vendored
12
.github/core-team.txt
vendored
|
|
@ -1,12 +0,0 @@
|
|||
# Core team GitHub logins (one per line). Lines may begin with @; case-insensitive.
|
||||
borisarzentar
|
||||
daukadolt
|
||||
dexters1
|
||||
hajdul88
|
||||
hande-k
|
||||
lxobr
|
||||
pazone
|
||||
siillee
|
||||
vasilije1990
|
||||
|
||||
|
||||
38
.github/pull_request_template.md
vendored
38
.github/pull_request_template.md
vendored
|
|
@ -1,43 +1,7 @@
|
|||
<!-- .github/pull_request_template.md -->
|
||||
|
||||
## Description
|
||||
<!--
|
||||
Please provide a clear, human-generated description of the changes in this PR.
|
||||
DO NOT use AI-generated descriptions. We want to understand your thought process and reasoning.
|
||||
-->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!--
|
||||
* Key requirements to the new feature or modification;
|
||||
* Proof that the changes work and meet the requirements;
|
||||
* Include instructions on how to verify the changes. Describe how to test it locally;
|
||||
* Proof that it's sufficiently tested.
|
||||
-->
|
||||
|
||||
## Type of Change
|
||||
<!-- Please check the relevant option -->
|
||||
- [ ] Bug fix (non-breaking change that fixes an issue)
|
||||
- [ ] New feature (non-breaking change that adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
- [ ] Documentation update
|
||||
- [ ] Code refactoring
|
||||
- [ ] Performance improvement
|
||||
- [ ] Other (please specify):
|
||||
|
||||
## Screenshots/Videos (if applicable)
|
||||
<!-- Add screenshots or videos to help explain your changes -->
|
||||
|
||||
## Pre-submission Checklist
|
||||
<!-- Please check all boxes that apply before submitting your PR -->
|
||||
- [ ] **I have tested my changes thoroughly before submitting this PR**
|
||||
- [ ] **This PR contains minimal changes necessary to address the issue/feature**
|
||||
- [ ] My code follows the project's coding standards and style guidelines
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] I have added necessary documentation (if applicable)
|
||||
- [ ] All new and existing tests pass
|
||||
- [ ] I have searched existing PRs to ensure this change hasn't been submitted already
|
||||
- [ ] I have linked any relevant issues in the description
|
||||
- [ ] My commits have clear and descriptive messages
|
||||
<!-- Provide a clear description of the changes in this PR -->
|
||||
|
||||
## DCO Affirmation
|
||||
I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
|
||||
|
|
|
|||
20
.github/release-drafter.yml
vendored
20
.github/release-drafter.yml
vendored
|
|
@ -1,20 +0,0 @@
|
|||
name-template: 'v$NEXT_PATCH_VERSION'
|
||||
tag-template: 'v$NEXT_PATCH_VERSION'
|
||||
|
||||
categories:
|
||||
- title: 'Features'
|
||||
labels: ['feature', 'enhancement']
|
||||
- title: 'Bug Fixes'
|
||||
labels: ['bug', 'fix']
|
||||
- title: 'Maintenance'
|
||||
labels: ['chore', 'refactor', 'ci']
|
||||
|
||||
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
|
||||
template: |
|
||||
## What’s Changed
|
||||
|
||||
$CHANGES
|
||||
|
||||
## Contributors
|
||||
|
||||
$CONTRIBUTORS
|
||||
45
.github/workflows/basic_tests.yml
vendored
45
.github/workflows/basic_tests.yml
vendored
|
|
@ -8,6 +8,10 @@ on:
|
|||
type: string
|
||||
default: '3.11.x'
|
||||
secrets:
|
||||
GRAPHISTRY_USERNAME:
|
||||
required: true
|
||||
GRAPHISTRY_PASSWORD:
|
||||
required: true
|
||||
LLM_PROVIDER:
|
||||
required: true
|
||||
LLM_MODEL:
|
||||
|
|
@ -75,7 +79,6 @@ jobs:
|
|||
name: Run Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
|
|
@ -99,22 +102,11 @@ jobs:
|
|||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: uv run pytest cognee/tests/unit/
|
||||
run: poetry run pytest cognee/tests/unit/
|
||||
|
||||
integration-tests:
|
||||
name: Run Integration Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
|
@ -125,16 +117,17 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "scraping"
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: uv run pytest cognee/tests/integration/
|
||||
run: poetry run pytest cognee/tests/integration/
|
||||
|
||||
simple-examples:
|
||||
name: Run Simple Examples
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
|
|
@ -158,19 +151,14 @@ jobs:
|
|||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Run Simple Examples
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
run: poetry run python ./examples/python/simple_example.py
|
||||
|
||||
simple-examples-baml:
|
||||
name: Run Simple Examples BAML
|
||||
graph-tests:
|
||||
name: Run Basic Graph Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
STRUCTURED_OUTPUT_FRAMEWORK: "BAML"
|
||||
BAML_LLM_PROVIDER: openai
|
||||
BAML_LLM_MODEL: ${{ secrets.OPENAI_MODEL }}
|
||||
BAML_LLM_ENDPOINT: ${{ secrets.OPENAI_ENDPOINT }}
|
||||
BAML_LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
# BAML_LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
|
|
@ -193,7 +181,6 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "baml"
|
||||
|
||||
- name: Run Simple Examples
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
- name: Run Graph Tests
|
||||
run: poetry run python ./examples/python/code_graph_example.py --repo_path ./cognee/tasks/graph
|
||||
|
|
|
|||
149
.github/workflows/cli_tests.yml
vendored
149
.github/workflows/cli_tests.yml
vendored
|
|
@ -1,149 +0,0 @@
|
|||
name: CLI Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
required: false
|
||||
type: string
|
||||
default: '3.11.x'
|
||||
secrets:
|
||||
LLM_PROVIDER:
|
||||
required: true
|
||||
LLM_MODEL:
|
||||
required: true
|
||||
LLM_ENDPOINT:
|
||||
required: true
|
||||
LLM_API_KEY:
|
||||
required: true
|
||||
LLM_API_VERSION:
|
||||
required: true
|
||||
EMBEDDING_PROVIDER:
|
||||
required: true
|
||||
EMBEDDING_MODEL:
|
||||
required: true
|
||||
EMBEDDING_ENDPOINT:
|
||||
required: true
|
||||
EMBEDDING_API_KEY:
|
||||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
cli-unit-tests:
|
||||
name: CLI Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Run CLI Unit Tests
|
||||
run: uv run pytest cognee/tests/cli_tests/cli_unit_tests/ -v
|
||||
|
||||
cli-integration-tests:
|
||||
name: CLI Integration Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Run CLI Integration Tests
|
||||
run: uv run pytest cognee/tests/cli_tests/cli_integration_tests/ -v
|
||||
|
||||
cli-functionality-tests:
|
||||
name: CLI Functionality Tests
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Test CLI Help Commands
|
||||
run: |
|
||||
uv run python -m cognee.cli._cognee --help
|
||||
uv run python -m cognee.cli._cognee --version
|
||||
uv run python -m cognee.cli._cognee add --help
|
||||
uv run python -m cognee.cli._cognee search --help
|
||||
uv run python -m cognee.cli._cognee cognify --help
|
||||
uv run python -m cognee.cli._cognee delete --help
|
||||
uv run python -m cognee.cli._cognee config --help
|
||||
|
||||
- name: Test CLI Config Subcommands
|
||||
run: |
|
||||
uv run python -m cognee.cli._cognee config get --help
|
||||
uv run python -m cognee.cli._cognee config set --help
|
||||
uv run python -m cognee.cli._cognee config list --help
|
||||
uv run python -m cognee.cli._cognee config unset --help
|
||||
uv run python -m cognee.cli._cognee config reset --help
|
||||
|
||||
- name: Test CLI Error Handling
|
||||
run: |
|
||||
# Test invalid command (should fail gracefully)
|
||||
! uv run python -m cognee.cli._cognee invalid_command
|
||||
|
||||
# Test missing required arguments (should fail gracefully)
|
||||
! uv run python -m cognee.cli._cognee search
|
||||
|
||||
# Test invalid search type (should fail gracefully)
|
||||
! uv run python -m cognee.cli._cognee search "test" --query-type INVALID_TYPE
|
||||
|
||||
# Test invalid chunker (should fail gracefully)
|
||||
! uv run python -m cognee.cli._cognee cognify --chunker InvalidChunker
|
||||
10
.github/workflows/community_greetings.yml
vendored
10
.github/workflows/community_greetings.yml
vendored
|
|
@ -1,14 +1,6 @@
|
|||
name: community | Greetings
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
on: [pull_request, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
|
|
|
|||
147
.github/workflows/db_examples_tests.yml
vendored
147
.github/workflows/db_examples_tests.yml
vendored
|
|
@ -29,7 +29,14 @@ on:
|
|||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
|
||||
QDRANT_API_URL:
|
||||
required: false
|
||||
QDRANT_API_KEY:
|
||||
required: false
|
||||
WEAVIATE_API_URL:
|
||||
required: false
|
||||
WEAVIATE_API_KEY:
|
||||
required: false
|
||||
POSTGRES_PASSWORD:
|
||||
required: false
|
||||
NEO4J_API_URL:
|
||||
|
|
@ -54,14 +61,13 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
- name: Install Neo4j extra
|
||||
run: |
|
||||
poetry install -E neo4j
|
||||
|
||||
- name: Run Neo4j Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -71,11 +77,11 @@ jobs:
|
|||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }}
|
||||
GRAPH_DATABASE_USERNAME: "neo4j"
|
||||
GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }}
|
||||
run: |
|
||||
uv run python examples/database_examples/neo4j_example.py
|
||||
poetry run python examples/database_examples/neo4j_example.py
|
||||
|
||||
run-db-example-kuzu:
|
||||
name: "Kuzu DB Example Test"
|
||||
|
|
@ -91,12 +97,13 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install Kuzu extra
|
||||
run: |
|
||||
poetry install
|
||||
|
||||
- name: Run Kuzu Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -107,7 +114,109 @@ jobs:
|
|||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: "kuzu"
|
||||
run: |
|
||||
uv run python examples/database_examples/kuzu_example.py
|
||||
poetry run python examples/database_examples/kuzu_example.py
|
||||
|
||||
run-db-example-milvus:
|
||||
name: "Milvus DB Example Test"
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'milvus') }}
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install Milvus extra
|
||||
run: |
|
||||
poetry install -E milvus
|
||||
|
||||
- name: Run Milvus Example
|
||||
env:
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: |
|
||||
poetry run python examples/database_examples/milvus_example.py
|
||||
|
||||
run-db-example-weaviate:
|
||||
name: "Weaviate DB Example Test"
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'weaviate') }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install Weaviate extra
|
||||
run: |
|
||||
poetry install -E weaviate
|
||||
|
||||
- name: Run Weaviate Example
|
||||
env:
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
VECTOR_DB_URL: ${{ secrets.WEAVIATE_API_URL }}
|
||||
VECTOR_DB_KEY: ${{ secrets.WEAVIATE_API_KEY }}
|
||||
run: |
|
||||
poetry run python examples/database_examples/weaviate_example.py
|
||||
|
||||
run-db-example-qdrant:
|
||||
name: "Qdrant DB Example Test"
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'qdrant') }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install Qdrant extra
|
||||
run: |
|
||||
poetry install -E qdrant
|
||||
|
||||
- name: Run Qdrant Example
|
||||
env:
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
VECTOR_DB_URL: ${{ secrets.QDRANT_API_URL }}
|
||||
VECTOR_DB_KEY: ${{ secrets.QDRANT_API_KEY }}
|
||||
run: |
|
||||
poetry run python examples/database_examples/qdrant_example.py
|
||||
|
||||
run-db-example-pgvector:
|
||||
name: "PostgreSQL PGVector DB Example Test"
|
||||
|
|
@ -138,12 +247,14 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Install PGVector extra
|
||||
run: |
|
||||
poetry install -E postgres
|
||||
|
||||
- name: Run PGVector Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -153,4 +264,4 @@ jobs:
|
|||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: |
|
||||
uv run python examples/database_examples/pgvector_example.py
|
||||
poetry run python examples/database_examples/pgvector_example.py
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ WORKFLOWS=(
|
|||
"test_kuzu.yml"
|
||||
"test_multimetric_qa_eval_run.yaml"
|
||||
"test_graphrag_vs_rag_notebook.yml"
|
||||
"test_llms.yml"
|
||||
"test_milvus.yml"
|
||||
"test_gemini.yml"
|
||||
"test_multimedia_example.yaml"
|
||||
"test_deduplication.yml"
|
||||
"test_eval_framework.yml"
|
||||
|
|
|
|||
74
.github/workflows/distributed_test.yml
vendored
74
.github/workflows/distributed_test.yml
vendored
|
|
@ -1,74 +0,0 @@
|
|||
name: Distributed Cognee test with modal
|
||||
permissions:
|
||||
contents: read
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
required: false
|
||||
type: string
|
||||
default: '3.11.x'
|
||||
secrets:
|
||||
LLM_MODEL:
|
||||
required: true
|
||||
LLM_ENDPOINT:
|
||||
required: true
|
||||
LLM_API_KEY:
|
||||
required: true
|
||||
LLM_API_VERSION:
|
||||
required: true
|
||||
EMBEDDING_MODEL:
|
||||
required: true
|
||||
EMBEDDING_ENDPOINT:
|
||||
required: true
|
||||
EMBEDDING_API_KEY:
|
||||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
OPENAI_API_KEY:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
run-server-start-test:
|
||||
name: Distributed Cognee test (Modal)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "distributed postgres"
|
||||
|
||||
- name: Run Distributed Cognee (Modal)
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
|
||||
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
|
||||
MODAL_SECRET_NAME: ${{ secrets.MODAL_SECRET_NAME }}
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ secrets.AZURE_NEO4j_URL }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ secrets.AZURE_NEO4J_USERNAME }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ secrets.AZURE_NEO4J_PW }}
|
||||
DB_PROVIDER: "postgres"
|
||||
DB_NAME: ${{ secrets.AZURE_POSTGRES_DB_NAME }}
|
||||
DB_HOST: ${{ secrets.AZURE_POSTGRES_HOST }}
|
||||
DB_PORT: ${{ secrets.AZURE_POSTGRES_PORT }}
|
||||
DB_USERNAME: ${{ secrets.AZURE_POSTGRES_USERNAME }}
|
||||
DB_PASSWORD: ${{ secrets.AZURE_POSTGRES_PW }}
|
||||
VECTOR_DB_PROVIDER: "pgvector"
|
||||
COGNEE_DISTRIBUTED: "true"
|
||||
run: uv run modal run ./distributed/entrypoint.py
|
||||
20
.github/workflows/dockerhub-mcp.yml
vendored
20
.github/workflows/dockerhub-mcp.yml
vendored
|
|
@ -7,29 +7,14 @@ on:
|
|||
|
||||
jobs:
|
||||
docker-build-and-push:
|
||||
runs-on:
|
||||
group: Default
|
||||
labels:
|
||||
- docker_build_runner
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check and free disk space before build
|
||||
run: |
|
||||
echo "=== Before cleanup ==="
|
||||
df -h
|
||||
echo "Removing unused preinstalled SDKs to free space..."
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc || true
|
||||
docker system prune -af || true
|
||||
echo "=== After cleanup ==="
|
||||
df -h
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
buildkitd-flags: --root /tmp/buildkit
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
|
|
@ -49,7 +34,7 @@ jobs:
|
|||
|
||||
- name: Build and push
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
|
@ -60,6 +45,5 @@ jobs:
|
|||
cache-from: type=registry,ref=cognee/cognee-mcp:buildcache
|
||||
cache-to: type=registry,ref=cognee/cognee-mcp:buildcache,mode=max
|
||||
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.build.outputs.digest }}
|
||||
|
|
|
|||
490
.github/workflows/e2e_tests.yml
vendored
490
.github/workflows/e2e_tests.yml
vendored
|
|
@ -1,6 +1,4 @@
|
|||
name: Reusable Integration Tests
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
|
@ -28,6 +26,10 @@ on:
|
|||
required: true
|
||||
OPENAI_API_KEY:
|
||||
required: true
|
||||
GRAPHISTRY_USERNAME:
|
||||
required: true
|
||||
GRAPHISTRY_PASSWORD:
|
||||
required: true
|
||||
AWS_ACCESS_KEY_ID:
|
||||
required: true
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
|
|
@ -59,7 +61,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_cognee_server_start.py
|
||||
run: poetry run python ./cognee/tests/test_cognee_server_start.py
|
||||
|
||||
run-telemetry-test:
|
||||
name: Run Telemetry Test
|
||||
|
|
@ -83,7 +85,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_telemetry.py
|
||||
run: poetry run python ./cognee/tests/test_telemetry.py
|
||||
|
||||
run-telemetry-pipeline-test:
|
||||
name: Run Telemetry Pipeline Test
|
||||
|
|
@ -112,7 +114,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_library.py
|
||||
run: poetry run python ./cognee/tests/test_library.py
|
||||
|
||||
run-deduplication-test:
|
||||
name: Deduplication Test
|
||||
|
|
@ -142,19 +144,50 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E postgres
|
||||
|
||||
- name: Run Deduplication Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_deduplication.py
|
||||
run: poetry run python ./cognee/tests/test_deduplication.py
|
||||
|
||||
run-deletion-test:
|
||||
name: Deletion Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Deletion Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: poetry run python ./cognee/tests/test_deletion.py
|
||||
|
||||
run-s3-bucket-test:
|
||||
name: S3 Bucket Test
|
||||
|
|
@ -167,7 +200,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Install specific S3 dependency
|
||||
run: |
|
||||
poetry install -E aws
|
||||
|
||||
- name: Run S3 Bucket Test
|
||||
env:
|
||||
|
|
@ -182,7 +218,7 @@ jobs:
|
|||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
run: uv run python ./cognee/tests/test_s3.py
|
||||
run: poetry run python ./cognee/tests/test_s3.py
|
||||
|
||||
test-parallel-databases:
|
||||
name: Test using different async databases in parallel in Cognee
|
||||
|
|
@ -196,8 +232,9 @@ jobs:
|
|||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install specific graph db dependency
|
||||
run: |
|
||||
poetry install
|
||||
|
||||
- name: Run parallel databases test
|
||||
env:
|
||||
|
|
@ -210,427 +247,4 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_parallel_databases.py
|
||||
|
||||
test-dataset-database-handler:
|
||||
name: Test dataset database handlers in Cognee
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run dataset databases handler test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_dataset_database_handler.py
|
||||
|
||||
test-dataset-database-deletion:
|
||||
name: Test dataset database deletion in Cognee
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run dataset databases deletion test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_dataset_delete.py
|
||||
|
||||
test-permissions:
|
||||
name: Test permissions with different situations in Cognee
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run permissions test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_permissions.py
|
||||
|
||||
test-multi-tenancy:
|
||||
name: Test multi tenancy with different situations in Cognee
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run multi tenancy test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_multi_tenancy.py
|
||||
|
||||
test-graph-edges:
|
||||
name: Test graph edge ingestion
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run graph edges test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_edge_ingestion.py
|
||||
|
||||
run_concurrent_subprocess_access_test:
|
||||
name: Concurrent Subprocess access test
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: cognee
|
||||
POSTGRES_PASSWORD: cognee
|
||||
POSTGRES_DB: cognee_db
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- 6379:6379
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 5s
|
||||
--health-timeout 3s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres redis"
|
||||
|
||||
- name: Run Concurrent subprocess access test (Kuzu/Lancedb/Postgres/Redis)
|
||||
env:
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
CACHING: true
|
||||
CACHE_BACKEND: 'redis'
|
||||
SHARED_KUZU_LOCK: true
|
||||
DB_PROVIDER: 'postgres'
|
||||
DB_NAME: 'cognee_db'
|
||||
DB_HOST: '127.0.0.1'
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_concurrent_subprocess_access.py
|
||||
|
||||
test-entity-extraction:
|
||||
name: Test Entity Extraction
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Entity Extraction Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/tasks/entity_extraction/entity_extraction_test.py
|
||||
|
||||
test-feedback-enrichment:
|
||||
name: Test Feedback Enrichment
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Feedback Enrichment Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_feedback_enrichment.py
|
||||
|
||||
test-edge-centered-payload:
|
||||
name: Test Cognify - Edge Centered Payload
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Edge Centered Payload Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
TRIPLET_EMBEDDING: True
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_edge_centered_payload.py
|
||||
|
||||
run_conversation_sessions_test_redis:
|
||||
name: Conversation sessions test (Redis)
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: cognee
|
||||
POSTGRES_PASSWORD: cognee
|
||||
POSTGRES_DB: cognee_db
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- 6379:6379
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 5s
|
||||
--health-timeout 3s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres redis"
|
||||
|
||||
- name: Run Conversation session tests (Redis)
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
CACHING: true
|
||||
CACHE_BACKEND: 'redis'
|
||||
DB_PROVIDER: 'postgres'
|
||||
DB_NAME: 'cognee_db'
|
||||
DB_HOST: '127.0.0.1'
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_conversation_history.py
|
||||
|
||||
run_conversation_sessions_test_fs:
|
||||
name: Conversation sessions test (FS)
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: cognee
|
||||
POSTGRES_PASSWORD: cognee
|
||||
POSTGRES_DB: cognee_db
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Run Conversation session tests (FS)
|
||||
env:
|
||||
ENV: dev
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
CACHING: true
|
||||
CACHE_BACKEND: 'fs'
|
||||
DB_PROVIDER: 'postgres'
|
||||
DB_NAME: 'cognee_db'
|
||||
DB_HOST: '127.0.0.1'
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_conversation_history.py
|
||||
|
||||
run-pipeline-cache-test:
|
||||
name: Test Pipeline Caching
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Pipeline Cache Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_pipeline_cache.py
|
||||
run: poetry run python ./cognee/tests/test_parallel_databases.py
|
||||
|
|
|
|||
219
.github/workflows/examples_tests.yml
vendored
219
.github/workflows/examples_tests.yml
vendored
|
|
@ -1,8 +1,5 @@
|
|||
name: Reusable Examples Tests
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
|
|
@ -21,10 +18,11 @@ jobs:
|
|||
|
||||
- name: Run Multimedia Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
run: uv run python ./examples/python/multimedia_example.py
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
run: poetry run python ./examples/python/multimedia_example.py
|
||||
|
||||
test-eval-example:
|
||||
name: Run Eval Example
|
||||
|
|
@ -37,11 +35,13 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "deepeval"
|
||||
|
||||
- name: Install specific eval dependency
|
||||
run: |
|
||||
poetry install -E deepeval
|
||||
|
||||
- name: Run Evaluation Framework Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -51,7 +51,9 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/eval_framework/run_eval.py
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
run: poetry run python ./cognee/eval_framework/run_eval.py
|
||||
|
||||
test-descriptive-metrics:
|
||||
name: Run Descriptive Metrics Example
|
||||
|
|
@ -65,14 +67,8 @@ jobs:
|
|||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Run Descriptive Graph Metrics Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -82,11 +78,9 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
run: uv run python ./cognee/tests/tasks/descriptive_metrics/neo4j_metrics_test.py
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
run: poetry run python ./cognee/tests/tasks/descriptive_metrics/networkx_metrics_test.py
|
||||
|
||||
|
||||
test-dynamic-steps-metrics:
|
||||
|
|
@ -103,8 +97,9 @@ jobs:
|
|||
|
||||
- name: Run Dynamic Steps Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -113,186 +108,4 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/dynamic_steps_example.py
|
||||
|
||||
test-temporal-example:
|
||||
name: Run Temporal Tests
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Temporal Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/temporal_example.py
|
||||
|
||||
test-ontology-example:
|
||||
name: Run Ontology Tests
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Ontology Demo Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/ontology_demo_example.py
|
||||
|
||||
test-agentic-reasoning:
|
||||
name: Run Agentic Reasoning Tests
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Agentic Reasoning Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/agentic_reasoning_procurement_example.py
|
||||
|
||||
test-memify:
|
||||
name: Run Memify Example
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Memify Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/memify_coding_agent_example.py
|
||||
|
||||
test-custom-pipeline:
|
||||
name: Run Custom Pipeline Example
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Custom Pipeline Example
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/run_custom_pipeline_example.py
|
||||
|
||||
test-permissions-example:
|
||||
name: Run Permissions Example
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Memify Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./examples/python/permissions_example.py
|
||||
test_docling_add:
|
||||
name: Run Add with Docling Test
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: 'docling'
|
||||
|
||||
- name: Run Docling Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_add_docling_document.py
|
||||
run: poetry run python ./examples/python/dynamic_steps_example.py
|
||||
|
|
|
|||
52
.github/workflows/graph_db_tests.yml
vendored
52
.github/workflows/graph_db_tests.yml
vendored
|
|
@ -11,6 +11,11 @@ on:
|
|||
type: string
|
||||
default: "all"
|
||||
description: "Which vector databases to test (comma-separated list or 'all')"
|
||||
secrets:
|
||||
WEAVIATE_API_URL:
|
||||
required: false
|
||||
WEAVIATE_API_KEY:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
run-kuzu-tests:
|
||||
|
|
@ -28,8 +33,9 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install
|
||||
|
||||
- name: Run Kuzu Tests
|
||||
env:
|
||||
|
|
@ -42,21 +48,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_kuzu.py
|
||||
|
||||
- name: Run Weighted Edges Tests with Kuzu
|
||||
env:
|
||||
ENV: 'dev'
|
||||
GRAPH_DATABASE_PROVIDER: "kuzu"
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v
|
||||
run: poetry run python ./cognee/tests/test_kuzu.py
|
||||
|
||||
run-neo4j-tests:
|
||||
name: Neo4j Tests
|
||||
|
|
@ -71,14 +63,13 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E neo4j
|
||||
|
||||
- name: Run default Neo4j
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -88,24 +79,7 @@ jobs:
|
|||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
run: uv run python ./cognee/tests/test_neo4j.py
|
||||
|
||||
- name: Run Weighted Edges Tests with Neo4j
|
||||
env:
|
||||
ENV: 'dev'
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }}
|
||||
GRAPH_DATABASE_USERNAME: "neo4j"
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v
|
||||
run: poetry run python ./cognee/tests/test_neo4j.py
|
||||
|
|
|
|||
76
.github/workflows/label-core-team.yml
vendored
76
.github/workflows/label-core-team.yml
vendored
|
|
@ -1,76 +0,0 @@
|
|||
name: Label PRs from core team
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, synchronize, ready_for_review, edited]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
label-core-team:
|
||||
if: ${{ !github.event.pull_request.draft }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out base repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ github.event.pull_request.base.ref }}
|
||||
|
||||
- name: Determine if PR author is a core team member
|
||||
id: check_core
|
||||
shell: bash
|
||||
run: |
|
||||
AUTHOR="${{ github.event.pull_request.user.login }}"
|
||||
LIST_FILE=".github/core-team.txt"
|
||||
|
||||
if [ ! -f "$LIST_FILE" ]; then
|
||||
echo "core=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Normalize author to lowercase and strip leading '@'
|
||||
AUTHOR_NORM="$(echo "$AUTHOR" | tr '[:upper:]' '[:lower:]' | sed 's/^@//')"
|
||||
|
||||
# Compare against normalized list values (ignore comments/blank lines)
|
||||
if awk -v author="$AUTHOR_NORM" '
|
||||
BEGIN { found=0 }
|
||||
{
|
||||
line=$0
|
||||
sub(/^[ \t]+|[ \t]+$/, "", line)
|
||||
if (line ~ /^#/ || line == "") next
|
||||
sub(/^@/, "", line)
|
||||
line=tolower(line)
|
||||
if (line == author) { found=1; exit }
|
||||
}
|
||||
END { exit(found ? 0 : 1) }
|
||||
' "$LIST_FILE"; then
|
||||
echo "core=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "core=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Add core-team label
|
||||
if: steps.check_core.outputs.core == 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const label = 'core-team';
|
||||
const { owner, repo } = context.repo;
|
||||
const prNumber = context.payload.pull_request.number;
|
||||
try {
|
||||
await github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: prNumber,
|
||||
labels: [label],
|
||||
});
|
||||
core.info(`Label '${label}' added to PR #${prNumber}`);
|
||||
} catch (error) {
|
||||
core.warning(`Failed to add label: ${error.message}`);
|
||||
}
|
||||
|
||||
|
||||
70
.github/workflows/load_tests.yml
vendored
70
.github/workflows/load_tests.yml
vendored
|
|
@ -1,70 +0,0 @@
|
|||
name: Load tests
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
secrets:
|
||||
LLM_MODEL:
|
||||
required: true
|
||||
LLM_ENDPOINT:
|
||||
required: true
|
||||
LLM_API_KEY:
|
||||
required: true
|
||||
LLM_API_VERSION:
|
||||
required: true
|
||||
EMBEDDING_MODEL:
|
||||
required: true
|
||||
EMBEDDING_ENDPOINT:
|
||||
required: true
|
||||
EMBEDDING_API_KEY:
|
||||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
OPENAI_API_KEY:
|
||||
required: true
|
||||
AWS_ACCESS_KEY_ID:
|
||||
required: true
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
test-load:
|
||||
name: Test Load
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Verify File Descriptor Limit
|
||||
run: ulimit -n
|
||||
|
||||
- name: Run Load Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: True
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
STORAGE_BACKEND: s3
|
||||
AWS_REGION: eu-west-1
|
||||
AWS_ENDPOINT_URL: https://s3-eu-west-1.amazonaws.com
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEV_USER_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEV_USER_SECRET_KEY }}
|
||||
run: uv run python ./cognee/tests/test_load.py
|
||||
|
||||
|
||||
22
.github/workflows/pre_test.yml
vendored
22
.github/workflows/pre_test.yml
vendored
|
|
@ -1,22 +0,0 @@
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
check-uv-lock:
|
||||
name: Validate uv lockfile and project metadata
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v4
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Validate uv lockfile and project metadata
|
||||
run: uv lock --check || { echo "'uv lock --check' failed."; echo "Run 'uv lock' and push your changes."; exit 1; }
|
||||
123
.github/workflows/python_version_tests.yml
vendored
Normal file
123
.github/workflows/python_version_tests.yml
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
name: Reusable Python Version Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-versions:
|
||||
required: false
|
||||
type: string
|
||||
default: '["3.10.x", "3.11.x", "3.12.x"]'
|
||||
secrets:
|
||||
GRAPHISTRY_USERNAME:
|
||||
required: true
|
||||
GRAPHISTRY_PASSWORD:
|
||||
required: true
|
||||
LLM_PROVIDER:
|
||||
required: true
|
||||
LLM_MODEL:
|
||||
required: true
|
||||
LLM_ENDPOINT:
|
||||
required: true
|
||||
LLM_API_KEY:
|
||||
required: true
|
||||
LLM_API_VERSION:
|
||||
required: true
|
||||
EMBEDDING_PROVIDER:
|
||||
required: true
|
||||
EMBEDDING_MODEL:
|
||||
required: true
|
||||
EMBEDDING_ENDPOINT:
|
||||
required: true
|
||||
EMBEDDING_API_KEY:
|
||||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
run-python-version-tests:
|
||||
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: [ubuntu-22.04, macos-13, macos-15, windows-latest]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run unit tests
|
||||
shell: bash
|
||||
run: poetry run pytest cognee/tests/unit/
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
|
||||
- name: Run integration tests
|
||||
if: ${{ !contains(matrix.os, 'windows') }}
|
||||
shell: bash
|
||||
run: poetry run pytest cognee/tests/integration/
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
|
||||
- name: Run default basic pipeline
|
||||
shell: bash
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: poetry run python ./cognee/tests/test_library.py
|
||||
|
||||
- name: Build with Poetry
|
||||
shell: bash
|
||||
run: poetry build
|
||||
|
||||
- name: Install Package
|
||||
if: ${{ !contains(matrix.os, 'windows') }}
|
||||
run: |
|
||||
cd dist
|
||||
pip install *.whl
|
||||
|
|
@ -58,10 +58,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: echo "Dependencies already installed in setup"
|
||||
run: |
|
||||
poetry install -E postgres
|
||||
|
||||
- name: Run PostgreSQL Script to create test data (Chinook_PostgreSql.sql)
|
||||
env:
|
||||
|
|
@ -90,7 +90,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_relational_db_migration.py
|
||||
run: poetry run python ./cognee/tests/test_relational_db_migration.py
|
||||
|
||||
run-relational-db-migration-test-kuzu:
|
||||
name: Kuzu Relational DB Migration Test
|
||||
|
|
@ -120,10 +120,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: echo "Dependencies already installed in setup"
|
||||
run: |
|
||||
poetry install -E postgres
|
||||
|
||||
- name: Run PostgreSQL Script to create test data (Chinook_PostgreSql.sql)
|
||||
env:
|
||||
|
|
@ -154,7 +154,7 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_relational_db_migration.py
|
||||
run: poetry run python ./cognee/tests/test_relational_db_migration.py
|
||||
|
||||
run-relational-db-migration-test-neo4j:
|
||||
name: Neo4j Relational DB Migration Test
|
||||
|
|
@ -184,14 +184,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: echo "Dependencies already installed in setup"
|
||||
run: |
|
||||
poetry install -E postgres -E neo4j
|
||||
|
||||
- name: Run PostgreSQL Script to create test data (Chinook_PostgreSql.sql)
|
||||
env:
|
||||
|
|
@ -210,9 +206,9 @@ jobs:
|
|||
env:
|
||||
ENV: 'dev'
|
||||
GRAPH_DATABASE_PROVIDER: "neo4j"
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
GRAPH_DATABASE_URL: ${{ secrets.NEO4J_API_URL }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ secrets.NEO4J_API_KEY }}
|
||||
GRAPH_DATABASE_USERNAME: "neo4j"
|
||||
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
|
|
@ -225,4 +221,4 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_relational_db_migration.py
|
||||
run: poetry run python ./cognee/tests/test_relational_db_migration.py
|
||||
|
|
|
|||
138
.github/workflows/release.yml
vendored
138
.github/workflows/release.yml
vendored
|
|
@ -1,138 +0,0 @@
|
|||
name: release.yml
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
flavour:
|
||||
required: true
|
||||
default: dev
|
||||
type: choice
|
||||
options:
|
||||
- dev
|
||||
- main
|
||||
description: Dev or Main release
|
||||
|
||||
jobs:
|
||||
release-github:
|
||||
name: Create GitHub Release from ${{ inputs.flavour }}
|
||||
outputs:
|
||||
tag: ${{ steps.create_tag.outputs.tag }}
|
||||
version: ${{ steps.create_tag.outputs.version }}
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out ${{ inputs.flavour }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.flavour }}
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
- name: Create and push git tag
|
||||
id: create_tag
|
||||
run: |
|
||||
VERSION="$(uv version --short)"
|
||||
TAG="v${VERSION}"
|
||||
|
||||
echo "Tag to create: ${TAG}"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
git tag "${TAG}"
|
||||
git push origin "${TAG}"
|
||||
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.create_tag.outputs.tag }}
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
release-pypi-package:
|
||||
needs: release-github
|
||||
name: Release PyPI Package from ${{ inputs.flavour }}
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out ${{ inputs.flavour }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.flavour }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
- name: Install Python
|
||||
run: uv python install
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --locked --all-extras
|
||||
|
||||
- name: Build distributions
|
||||
run: uv build
|
||||
|
||||
- name: Publish ${{ inputs.flavour }} release to PyPI
|
||||
env:
|
||||
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
run: uv publish
|
||||
|
||||
release-docker-image:
|
||||
needs: release-github
|
||||
name: Release Docker Image from ${{ inputs.flavour }}
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out ${{ inputs.flavour }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.flavour }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push Dev Docker Image
|
||||
if: ${{ inputs.flavour == 'dev' }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: cognee/cognee:${{ needs.release-github.outputs.version }}
|
||||
labels: |
|
||||
version=${{ needs.release-github.outputs.version }}
|
||||
flavour=${{ inputs.flavour }}
|
||||
cache-from: type=registry,ref=cognee/cognee:buildcache
|
||||
cache-to: type=registry,ref=cognee/cognee:buildcache,mode=max
|
||||
|
||||
- name: Build and push Main Docker Image
|
||||
if: ${{ inputs.flavour == 'main' }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
cognee/cognee:${{ needs.release-github.outputs.version }}
|
||||
cognee/cognee:latest
|
||||
labels: |
|
||||
version=${{ needs.release-github.outputs.version }}
|
||||
flavour=${{ inputs.flavour }}
|
||||
cache-from: type=registry,ref=cognee/cognee:buildcache
|
||||
cache-to: type=registry,ref=cognee/cognee:buildcache,mode=max
|
||||
17
.github/workflows/release_test.yml
vendored
17
.github/workflows/release_test.yml
vendored
|
|
@ -1,17 +0,0 @@
|
|||
# Long-running, heavy and resource-consuming tests for release validation
|
||||
name: Release Test Workflow
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
load-tests:
|
||||
name: Load Tests
|
||||
uses: ./.github/workflows/load_tests.yml
|
||||
secrets: inherit
|
||||
13
.github/workflows/reusable_notebook.yml
vendored
13
.github/workflows/reusable_notebook.yml
vendored
|
|
@ -8,6 +8,10 @@ on:
|
|||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GRAPHISTRY_USERNAME:
|
||||
required: true
|
||||
GRAPHISTRY_PASSWORD:
|
||||
required: true
|
||||
#LLM_MODEL:
|
||||
# required: true
|
||||
#LLM_ENDPOINT:
|
||||
|
|
@ -46,7 +50,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "notebook"
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E notebook
|
||||
|
||||
- name: Execute Jupyter Notebook
|
||||
env:
|
||||
|
|
@ -60,8 +67,10 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
run: |
|
||||
uv run jupyter nbconvert \
|
||||
poetry run jupyter nbconvert \
|
||||
--to notebook \
|
||||
--execute ${{ inputs.notebook-location }} \
|
||||
--output executed_notebook.ipynb \
|
||||
|
|
|
|||
78
.github/workflows/scorecard.yml
vendored
78
.github/workflows/scorecard.yml
vendored
|
|
@ -1,78 +0,0 @@
|
|||
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||
# by a third-party and are governed by separate terms of service, privacy
|
||||
# policy, and support documentation.
|
||||
|
||||
name: Scorecard supply-chain security
|
||||
on:
|
||||
# For Branch-Protection check. Only the default branch is supported. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||
branch_protection_rule:
|
||||
# To guarantee Maintained check is occasionally updated. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||
schedule:
|
||||
- cron: '35 8 * * 2'
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecard analysis
|
||||
runs-on: ubuntu-latest
|
||||
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
|
||||
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Needed to publish results and get a badge (see publish_results below).
|
||||
id-token: write
|
||||
# Uncomment the permissions below if installing in a private repository.
|
||||
# contents: read
|
||||
# actions: read
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||
# - you are installing Scorecard on a *private* repository
|
||||
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
|
||||
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||
|
||||
# Public repositories:
|
||||
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||
# - Allows the repository to include the Scorecard badge.
|
||||
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories:
|
||||
# - `publish_results` will always be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
|
||||
# file_mode: git
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
84
.github/workflows/search_db_tests.yml
vendored
84
.github/workflows/search_db_tests.yml
vendored
|
|
@ -11,6 +11,11 @@ on:
|
|||
type: string
|
||||
default: "all"
|
||||
description: "Which vector databases to test (comma-separated list or 'all')"
|
||||
secrets:
|
||||
WEAVIATE_API_URL:
|
||||
required: false
|
||||
WEAVIATE_API_KEY:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
run-kuzu-lance-sqlite-search-tests:
|
||||
|
|
@ -28,8 +33,9 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install
|
||||
|
||||
- name: Run Kuzu search Tests
|
||||
env:
|
||||
|
|
@ -45,12 +51,26 @@ jobs:
|
|||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
VECTOR_DB_PROVIDER: 'lancedb'
|
||||
DB_PROVIDER: 'sqlite'
|
||||
run: uv run python ./cognee/tests/test_search_db.py
|
||||
run: poetry run python ./cognee/tests/test_search_db.py
|
||||
|
||||
run-neo4j-lance-sqlite-search-tests:
|
||||
name: Search test for Neo4j/LanceDB/Sqlite
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/lance/sqlite') }}
|
||||
services:
|
||||
neo4j:
|
||||
image: neo4j:5.11
|
||||
env:
|
||||
NEO4J_AUTH: neo4j/pleaseletmein
|
||||
NEO4J_PLUGINS: '["apoc","graph-data-science"]'
|
||||
ports:
|
||||
- 7474:7474
|
||||
- 7687:7687
|
||||
options: >-
|
||||
--health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=5
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
|
|
@ -63,12 +83,9 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E neo4j
|
||||
|
||||
- name: Run Neo4j search Tests
|
||||
env:
|
||||
|
|
@ -84,11 +101,10 @@ jobs:
|
|||
GRAPH_DATABASE_PROVIDER: 'neo4j'
|
||||
VECTOR_DB_PROVIDER: 'lancedb'
|
||||
DB_PROVIDER: 'sqlite'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
run: uv run python ./cognee/tests/test_search_db.py
|
||||
GRAPH_DATABASE_URL: bolt://localhost:7687
|
||||
GRAPH_DATABASE_USERNAME: neo4j
|
||||
GRAPH_DATABASE_PASSWORD: pleaseletmein
|
||||
run: poetry run python ./cognee/tests/test_search_db.py
|
||||
|
||||
run-kuzu-pgvector-postgres-search-tests:
|
||||
name: Search test for Kuzu/PGVector/Postgres
|
||||
|
|
@ -118,10 +134,9 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install dependencies
|
||||
run: poetry install -E postgres
|
||||
|
||||
- name: Run Kuzu/PGVector/Postgres Tests
|
||||
env:
|
||||
|
|
@ -136,20 +151,32 @@ jobs:
|
|||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
VECTOR_DB_PROVIDER: 'pgvector'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
DB_PROVIDER: 'postgres'
|
||||
DB_NAME: 'cognee_db'
|
||||
DB_HOST: '127.0.0.1'
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_search_db.py
|
||||
run: poetry run python ./cognee/tests/test_search_db.py
|
||||
|
||||
run-neo4j-pgvector-postgres-search-tests:
|
||||
name: Search test for Neo4j/PGVector/Postgres
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/pgvector/postgres') }}
|
||||
services:
|
||||
neo4j:
|
||||
image: neo4j:5.11
|
||||
env:
|
||||
NEO4J_AUTH: neo4j/pleaseletmein
|
||||
NEO4J_PLUGINS: '["apoc","graph-data-science"]'
|
||||
ports:
|
||||
- 7474:7474
|
||||
- 7687:7687
|
||||
options: >-
|
||||
--health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=5
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
|
|
@ -173,14 +200,10 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
poetry install -E neo4j -E postgres
|
||||
|
||||
- name: Run Neo4j + PGVector + Postgres search Tests
|
||||
env:
|
||||
|
|
@ -196,13 +219,12 @@ jobs:
|
|||
GRAPH_DATABASE_PROVIDER: 'neo4j'
|
||||
VECTOR_DB_PROVIDER: 'pgvector'
|
||||
DB_PROVIDER: 'postgres'
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
GRAPH_DATABASE_URL: bolt://localhost:7687
|
||||
GRAPH_DATABASE_USERNAME: neo4j
|
||||
GRAPH_DATABASE_PASSWORD: pleaseletmein
|
||||
DB_NAME: cognee_db
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_search_db.py
|
||||
run: poetry run python ./cognee/tests/test_search_db.py
|
||||
|
|
|
|||
213
.github/workflows/temporal_graph_tests.yml
vendored
213
.github/workflows/temporal_graph_tests.yml
vendored
|
|
@ -1,213 +0,0 @@
|
|||
name: Temporal Graph Tests
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
databases:
|
||||
required: false
|
||||
type: string
|
||||
default: "all"
|
||||
description: "Which vector databases to test (comma-separated list or 'all')"
|
||||
|
||||
jobs:
|
||||
run_temporal_graph_kuzu_lance_sqlite:
|
||||
name: Temporal Graph test Kuzu (lancedb + sqlite)
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'kuzu/lance/sqlite') }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Temporal Graph with Kuzu (lancedb + sqlite)
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.OPENAI_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.OPENAI_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
VECTOR_DB_PROVIDER: 'lancedb'
|
||||
DB_PROVIDER: 'sqlite'
|
||||
run: uv run python ./cognee/tests/test_temporal_graph.py
|
||||
|
||||
run_temporal_graph_neo4j_lance_sqlite:
|
||||
name: Temporal Graph test Neo4j (lancedb + sqlite)
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/lance/sqlite') }}
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Temporal Graph with Neo4j (lancedb + sqlite)
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.OPENAI_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.OPENAI_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'neo4j'
|
||||
VECTOR_DB_PROVIDER: 'lancedb'
|
||||
DB_PROVIDER: 'sqlite'
|
||||
GRAPH_DATABASE_URL: ${{ steps.neo4j.outputs.neo4j-url }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ steps.neo4j.outputs.neo4j-username }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ steps.neo4j.outputs.neo4j-password }}
|
||||
run: uv run python ./cognee/tests/test_temporal_graph.py
|
||||
|
||||
run_temporal_graph_kuzu_postgres_pgvector:
|
||||
name: Temporal Graph test Kuzu (postgres + pgvector)
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'kuzu/pgvector/postgres') }}
|
||||
services:
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: cognee
|
||||
POSTGRES_PASSWORD: cognee
|
||||
POSTGRES_DB: cognee_db
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Temporal Graph with Kuzu (postgres + pgvector)
|
||||
env:
|
||||
ENV: dev
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.OPENAI_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.OPENAI_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'kuzu'
|
||||
VECTOR_DB_PROVIDER: 'pgvector'
|
||||
DB_PROVIDER: 'postgres'
|
||||
DB_NAME: 'cognee_db'
|
||||
DB_HOST: '127.0.0.1'
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_temporal_graph.py
|
||||
|
||||
run_temporal_graph_neo4j_postgres_pgvector:
|
||||
name: Temporal Graph test Neo4j (postgres + pgvector)
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'neo4j/pgvector/postgres') }}
|
||||
services:
|
||||
neo4j:
|
||||
image: neo4j:5.11
|
||||
env:
|
||||
NEO4J_AUTH: neo4j/pleaseletmein
|
||||
NEO4J_PLUGINS: '["apoc","graph-data-science"]'
|
||||
ports:
|
||||
- 7474:7474
|
||||
- 7687:7687
|
||||
options: >-
|
||||
--health-cmd="cypher-shell -u neo4j -p pleaseletmein 'RETURN 1'"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=5
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
env:
|
||||
POSTGRES_USER: cognee
|
||||
POSTGRES_PASSWORD: cognee
|
||||
POSTGRES_DB: cognee_db
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries=5
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Temporal Graph with Neo4j (postgres + pgvector)
|
||||
env:
|
||||
ENV: dev
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.OPENAI_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.OPENAI_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_PROVIDER: 'neo4j'
|
||||
VECTOR_DB_PROVIDER: 'pgvector'
|
||||
DB_PROVIDER: 'postgres'
|
||||
GRAPH_DATABASE_URL: bolt://localhost:7687
|
||||
GRAPH_DATABASE_USERNAME: neo4j
|
||||
GRAPH_DATABASE_PASSWORD: pleaseletmein
|
||||
DB_NAME: cognee_db
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: 5432
|
||||
DB_USERNAME: cognee
|
||||
DB_PASSWORD: cognee
|
||||
run: uv run python ./cognee/tests/test_temporal_graph.py
|
||||
|
|
@ -1,252 +0,0 @@
|
|||
name: Tests to run on different Operating Systems
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-versions:
|
||||
required: false
|
||||
type: string
|
||||
default: '["3.10.x", "3.12.x", "3.13.x"]'
|
||||
os:
|
||||
required: false
|
||||
type: string
|
||||
default: '["ubuntu-22.04", "macos-15", "windows-latest"]'
|
||||
secrets:
|
||||
LLM_PROVIDER:
|
||||
required: true
|
||||
LLM_MODEL:
|
||||
required: true
|
||||
LLM_ENDPOINT:
|
||||
required: true
|
||||
LLM_API_KEY:
|
||||
required: true
|
||||
LLM_API_VERSION:
|
||||
required: true
|
||||
EMBEDDING_PROVIDER:
|
||||
required: true
|
||||
EMBEDDING_MODEL:
|
||||
required: true
|
||||
EMBEDDING_ENDPOINT:
|
||||
required: true
|
||||
EMBEDDING_API_KEY:
|
||||
required: true
|
||||
EMBEDDING_API_VERSION:
|
||||
required: true
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
run-unit-tests:
|
||||
name: Unit tests ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run unit tests
|
||||
shell: bash
|
||||
run: uv run pytest cognee/tests/unit/
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
|
||||
run-integration-tests:
|
||||
name: Integration tests ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run integration tests
|
||||
shell: bash
|
||||
run: uv run pytest cognee/tests/integration/
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
|
||||
run-library-test:
|
||||
name: Library test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run default basic pipeline
|
||||
shell: bash
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
|
||||
EMBEDDING_PROVIDER: openai
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_library.py
|
||||
|
||||
run-build-test:
|
||||
name: Build test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Build with uv
|
||||
shell: bash
|
||||
run: uv build
|
||||
|
||||
- name: Install Package
|
||||
if: ${{ !contains(matrix.os, 'windows-latest') }}
|
||||
run: |
|
||||
cd dist
|
||||
pip install *.whl
|
||||
|
||||
run-soft-deletion-test:
|
||||
name: Soft Delete test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Path setup
|
||||
if: ${{ matrix.os }} == 'windows-latest'
|
||||
shell: bash
|
||||
run: |
|
||||
PATH=$(printf '%s' "$PATH" | tr ':' $'\n' | grep -vi '/git/usr/bin' | paste -sd: -)
|
||||
export PATH
|
||||
|
||||
- name: Run Soft Deletion Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_delete_soft.py
|
||||
|
||||
run-hard-deletion-test:
|
||||
name: Hard Delete test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ${{ fromJSON(inputs.python-versions) }}
|
||||
os: ${{ fromJSON(inputs.os) }}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run Hard Deletion Test
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_delete_hard.py
|
||||
29
.github/workflows/test_gemini.yml
vendored
Normal file
29
.github/workflows/test_gemini.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: test | gemini
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test-gemini:
|
||||
name: Run Gemini Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Gemini Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "gemini"
|
||||
LLM_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
LLM_MODEL: "gemini/gemini-1.5-flash"
|
||||
EMBEDDING_PROVIDER: "gemini"
|
||||
EMBEDDING_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
EMBEDDING_MODEL: "gemini/text-embedding-004"
|
||||
EMBEDDING_DIMENSIONS: "768"
|
||||
EMBEDDING_MAX_TOKENS: "8076"
|
||||
run: poetry run python ./examples/python/simple_example.py
|
||||
176
.github/workflows/test_llms.yml
vendored
176
.github/workflows/test_llms.yml
vendored
|
|
@ -1,176 +0,0 @@
|
|||
name: LLM Test Suites
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
test-gemini:
|
||||
name: Run Gemini Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Gemini Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "gemini"
|
||||
LLM_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
LLM_MODEL: "gemini/gemini-2.0-flash"
|
||||
EMBEDDING_PROVIDER: "gemini"
|
||||
EMBEDDING_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
EMBEDDING_MODEL: "gemini/text-embedding-004"
|
||||
EMBEDDING_DIMENSIONS: "768"
|
||||
EMBEDDING_MAX_TOKENS: "8076"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
|
||||
test-fastembed:
|
||||
name: Run Fastembed Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run Fastembed Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "openai"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_PROVIDER: "fastembed"
|
||||
EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2"
|
||||
EMBEDDING_DIMENSIONS: "384"
|
||||
EMBEDDING_MAX_TOKENS: "256"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
|
||||
test-openrouter:
|
||||
name: Run OpenRouter Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
|
||||
- name: Run OpenRouter Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "custom"
|
||||
LLM_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
||||
LLM_MODEL: "openrouter/x-ai/grok-code-fast-1"
|
||||
LLM_ENDPOINT: "https://openrouter.ai/api/v1"
|
||||
EMBEDDING_PROVIDER: "openai"
|
||||
EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
EMBEDDING_MODEL: "openai/text-embedding-3-large"
|
||||
EMBEDDING_DIMENSIONS: "3072"
|
||||
EMBEDDING_MAX_TOKENS: "8191"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
|
||||
test-bedrock-api-key:
|
||||
name: Run Bedrock API Key Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Run Bedrock API Key Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "bedrock"
|
||||
LLM_API_KEY: ${{ secrets.BEDROCK_API_KEY }}
|
||||
LLM_MODEL: "eu.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
||||
LLM_MAX_TOKENS: "16384"
|
||||
AWS_REGION_NAME: "eu-west-1"
|
||||
EMBEDDING_PROVIDER: "bedrock"
|
||||
EMBEDDING_API_KEY: ${{ secrets.BEDROCK_API_KEY }}
|
||||
EMBEDDING_MODEL: "amazon.titan-embed-text-v2:0"
|
||||
EMBEDDING_DIMENSIONS: "1024"
|
||||
EMBEDDING_MAX_TOKENS: "8191"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
|
||||
test-bedrock-aws-credentials:
|
||||
name: Run Bedrock AWS Credentials Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Run Bedrock AWS Credentials Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "bedrock"
|
||||
LLM_MODEL: "eu.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
||||
LLM_MAX_TOKENS: "16384"
|
||||
AWS_REGION_NAME: "eu-west-1"
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
EMBEDDING_PROVIDER: "bedrock"
|
||||
EMBEDDING_API_KEY: ${{ secrets.BEDROCK_API_KEY }}
|
||||
EMBEDDING_MODEL: "amazon.titan-embed-text-v2:0"
|
||||
EMBEDDING_DIMENSIONS: "1024"
|
||||
EMBEDDING_MAX_TOKENS: "8191"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
|
||||
test-bedrock-aws-profile:
|
||||
name: Run Bedrock AWS Profile Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Configure AWS Profile
|
||||
run: |
|
||||
mkdir -p ~/.aws
|
||||
cat > ~/.aws/credentials << EOF
|
||||
[bedrock-test]
|
||||
aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
EOF
|
||||
|
||||
- name: Run Bedrock AWS Profile Simple Example
|
||||
env:
|
||||
LLM_PROVIDER: "bedrock"
|
||||
LLM_MODEL: "eu.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
||||
LLM_MAX_TOKENS: "16384"
|
||||
AWS_PROFILE_NAME: "bedrock-test"
|
||||
AWS_REGION_NAME: "eu-west-1"
|
||||
EMBEDDING_PROVIDER: "bedrock"
|
||||
EMBEDDING_MODEL: "amazon.titan-embed-text-v2:0"
|
||||
EMBEDDING_DIMENSIONS: "1024"
|
||||
EMBEDDING_MAX_TOKENS: "8191"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
59
.github/workflows/test_memgraph.yml
vendored
Normal file
59
.github/workflows/test_memgraph.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: test | memgraph
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [labeled, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
|
||||
jobs:
|
||||
run_memgraph_integration_test:
|
||||
name: test
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
services:
|
||||
memgraph:
|
||||
image: memgraph/memgraph-mage:latest
|
||||
ports:
|
||||
- 7687:7687
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10.x'
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1.4.1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
installer-parallel: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: poetry install -E neo4j
|
||||
|
||||
- name: Run default Memgraph
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
GRAPH_DATABASE_URL: "bolt://localhost:7687"
|
||||
GRAPH_DATABASE_PASSWORD: "memgraph"
|
||||
GRAPH_DATABASE_USERNAME: "memgraph"
|
||||
run: poetry run python ./cognee/tests/test_memgraph.py
|
||||
27
.github/workflows/test_ollama.yml
vendored
27
.github/workflows/test_ollama.yml
vendored
|
|
@ -7,8 +7,13 @@ jobs:
|
|||
|
||||
run_ollama_test:
|
||||
|
||||
# needs 32 Gb RAM for phi4 in a container
|
||||
runs-on: buildjet-8vcpu-ubuntu-2204
|
||||
# needs 16 Gb RAM for phi4
|
||||
runs-on: buildjet-4vcpu-ubuntu-2204
|
||||
# services:
|
||||
# ollama:
|
||||
# image: ollama/ollama
|
||||
# ports:
|
||||
# - 11434:11434
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
|
@ -21,7 +26,15 @@ jobs:
|
|||
|
||||
- name: Install torch dependency
|
||||
run: |
|
||||
uv add torch
|
||||
poetry add torch
|
||||
|
||||
# - name: Install ollama
|
||||
# run: curl -fsSL https://ollama.com/install.sh | sh
|
||||
# - name: Run ollama
|
||||
# run: |
|
||||
# ollama serve --openai &
|
||||
# ollama pull llama3.2 &
|
||||
# ollama pull avr/sfr-embedding-mistral:latest
|
||||
|
||||
- name: Start Ollama container
|
||||
run: |
|
||||
|
|
@ -62,7 +75,7 @@ jobs:
|
|||
{ "role": "user", "content": "Whatever I say, answer with Yes." }
|
||||
]
|
||||
}'
|
||||
curl -X POST http://127.0.0.1:11434/api/embed \
|
||||
curl -X POST http://127.0.0.1:11434/v1/embeddings \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "avr/sfr-embedding-mistral:latest",
|
||||
|
|
@ -78,6 +91,8 @@ jobs:
|
|||
- name: Run example test
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }}
|
||||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }}
|
||||
PYTHONFAULTHANDLER: 1
|
||||
LLM_PROVIDER: "ollama"
|
||||
LLM_API_KEY: "ollama"
|
||||
|
|
@ -85,7 +100,7 @@ jobs:
|
|||
LLM_MODEL: "phi4"
|
||||
EMBEDDING_PROVIDER: "ollama"
|
||||
EMBEDDING_MODEL: "avr/sfr-embedding-mistral:latest"
|
||||
EMBEDDING_ENDPOINT: "http://localhost:11434/api/embed"
|
||||
EMBEDDING_ENDPOINT: "http://localhost:11434/api/embeddings"
|
||||
EMBEDDING_DIMENSIONS: "4096"
|
||||
HUGGINGFACE_TOKENIZER: "Salesforce/SFR-Embedding-Mistral"
|
||||
run: uv run python ./examples/python/simple_example.py
|
||||
run: poetry run python ./examples/python/simple_example.py
|
||||
|
|
|
|||
44
.github/workflows/test_s3_file_storage.yml
vendored
44
.github/workflows/test_s3_file_storage.yml
vendored
|
|
@ -1,44 +0,0 @@
|
|||
name: test | s3 file storage
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
test-s3-storage:
|
||||
name: Run S3 File Storage Test
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11.x'
|
||||
extra-dependencies: "aws"
|
||||
|
||||
- name: Run S3 File Storage Test
|
||||
env:
|
||||
STORAGE_BACKEND: s3
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: True
|
||||
AWS_REGION: eu-west-1
|
||||
AWS_ENDPOINT_URL: https://s3-eu-west-1.amazonaws.com
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEV_USER_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEV_USER_SECRET_KEY }}
|
||||
STORAGE_BUCKET_NAME: github-runner-cognee-tests
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_s3_file_storage.py
|
||||
84
.github/workflows/test_suites.yml
vendored
84
.github/workflows/test_suites.yml
vendored
|
|
@ -1,6 +1,4 @@
|
|||
name: Test Suites
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -18,32 +16,15 @@ env:
|
|||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
pre-test:
|
||||
name: basic checks
|
||||
uses: ./.github/workflows/pre_test.yml
|
||||
|
||||
jobs:
|
||||
basic-tests:
|
||||
name: Basic Tests
|
||||
uses: ./.github/workflows/basic_tests.yml
|
||||
needs: [ pre-test ]
|
||||
secrets: inherit
|
||||
|
||||
e2e-tests:
|
||||
name: End-to-End Tests
|
||||
uses: ./.github/workflows/e2e_tests.yml
|
||||
needs: [ pre-test ]
|
||||
secrets: inherit
|
||||
|
||||
distributed-tests:
|
||||
name: Distributed Cognee Test
|
||||
needs: [ basic-tests, e2e-tests, graph-db-tests ]
|
||||
uses: ./.github/workflows/distributed_test.yml
|
||||
secrets: inherit
|
||||
|
||||
cli-tests:
|
||||
name: CLI Tests
|
||||
uses: ./.github/workflows/cli_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
docker-compose-test:
|
||||
|
|
@ -64,12 +45,6 @@ jobs:
|
|||
uses: ./.github/workflows/graph_db_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
temporal-graph-tests:
|
||||
name: Temporal Graph Test
|
||||
needs: [ basic-tests, e2e-tests, graph-db-tests ]
|
||||
uses: ./.github/workflows/temporal_graph_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
search-db-tests:
|
||||
name: Search Test on Different DBs
|
||||
needs: [basic-tests, e2e-tests, graph-db-tests]
|
||||
|
|
@ -78,7 +53,7 @@ jobs:
|
|||
|
||||
relational-db-migration-tests:
|
||||
name: Relational DB Migration Tests
|
||||
needs: [basic-tests, e2e-tests, graph-db-tests]
|
||||
needs: [ basic-tests, e2e-tests, graph-db-tests]
|
||||
uses: ./.github/workflows/relational_db_migration_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
|
|
@ -88,22 +63,12 @@ jobs:
|
|||
uses: ./.github/workflows/notebooks_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
different-os-tests-basic:
|
||||
name: OS and Python Tests Ubuntu
|
||||
python-version-tests:
|
||||
name: Python Version Tests
|
||||
needs: [basic-tests, e2e-tests]
|
||||
uses: ./.github/workflows/test_different_operating_systems.yml
|
||||
uses: ./.github/workflows/python_version_tests.yml
|
||||
with:
|
||||
python-versions: '["3.10.x", "3.11.x", "3.12.x", "3.13.x"]'
|
||||
os: '["ubuntu-22.04"]'
|
||||
secrets: inherit
|
||||
|
||||
different-os-tests-extended:
|
||||
name: OS and Python Tests Extended
|
||||
needs: [basic-tests, e2e-tests]
|
||||
uses: ./.github/workflows/test_different_operating_systems.yml
|
||||
with:
|
||||
python-versions: '["3.13.x"]'
|
||||
os: '["macos-15", "windows-latest"]'
|
||||
python-versions: '["3.10.x", "3.11.x", "3.12.x"]'
|
||||
secrets: inherit
|
||||
|
||||
# Matrix-based vector database tests
|
||||
|
|
@ -121,28 +86,22 @@ jobs:
|
|||
secrets: inherit
|
||||
|
||||
mcp-test:
|
||||
name: MCP Tests
|
||||
needs: [basic-tests, e2e-tests]
|
||||
name: Example Tests
|
||||
needs: [ basic-tests, e2e-tests ]
|
||||
uses: ./.github/workflows/test_mcp.yml
|
||||
secrets: inherit
|
||||
|
||||
db-examples-tests:
|
||||
name: DB Examples Tests
|
||||
needs: [vector-db-tests, graph-db-tests, relational-db-migration-tests, distributed-tests]
|
||||
needs: [vector-db-tests, graph-db-tests, relational-db-migration-tests]
|
||||
uses: ./.github/workflows/db_examples_tests.yml
|
||||
secrets: inherit
|
||||
|
||||
s3-file-storage-test:
|
||||
name: S3 File Storage Test
|
||||
needs: [basic-tests, e2e-tests]
|
||||
uses: ./.github/workflows/test_s3_file_storage.yml
|
||||
secrets: inherit
|
||||
|
||||
# Additional LLM tests
|
||||
llm-tests:
|
||||
name: LLM Test Suite
|
||||
needs: [ basic-tests, e2e-tests ]
|
||||
uses: ./.github/workflows/test_llms.yml
|
||||
gemini-tests:
|
||||
name: Gemini Tests
|
||||
needs: [basic-tests, e2e-tests]
|
||||
uses: ./.github/workflows/test_gemini.yml
|
||||
secrets: inherit
|
||||
|
||||
# Ollama tests moved to the end
|
||||
|
|
@ -153,11 +112,10 @@ jobs:
|
|||
e2e-tests,
|
||||
graph-db-tests,
|
||||
notebook-tests,
|
||||
different-os-tests-basic,
|
||||
different-os-tests-extended,
|
||||
python-version-tests,
|
||||
vector-db-tests,
|
||||
example-tests,
|
||||
llm-tests,
|
||||
gemini-tests,
|
||||
mcp-test,
|
||||
relational-db-migration-tests,
|
||||
docker-compose-test,
|
||||
|
|
@ -171,16 +129,14 @@ jobs:
|
|||
needs: [
|
||||
basic-tests,
|
||||
e2e-tests,
|
||||
cli-tests,
|
||||
graph-db-tests,
|
||||
notebook-tests,
|
||||
different-os-tests-basic,
|
||||
different-os-tests-extended,
|
||||
python-version-tests,
|
||||
vector-db-tests,
|
||||
example-tests,
|
||||
db-examples-tests,
|
||||
mcp-test,
|
||||
llm-tests,
|
||||
gemini-tests,
|
||||
ollama-tests,
|
||||
relational-db-migration-tests,
|
||||
docker-compose-test,
|
||||
|
|
@ -193,16 +149,14 @@ jobs:
|
|||
run: |
|
||||
if [[ "${{ needs.basic-tests.result }}" == "success" &&
|
||||
"${{ needs.e2e-tests.result }}" == "success" &&
|
||||
"${{ needs.cli-tests.result }}" == "success" &&
|
||||
"${{ needs.graph-db-tests.result }}" == "success" &&
|
||||
"${{ needs.notebook-tests.result }}" == "success" &&
|
||||
"${{ needs.different-os-tests-basic.result }}" == "success" &&
|
||||
"${{ needs.different-os-tests-extended.result }}" == "success" &&
|
||||
"${{ needs.python-version-tests.result }}" == "success" &&
|
||||
"${{ needs.vector-db-tests.result }}" == "success" &&
|
||||
"${{ needs.example-tests.result }}" == "success" &&
|
||||
"${{ needs.db-examples-tests.result }}" == "success" &&
|
||||
"${{ needs.relational-db-migration-tests.result }}" == "success" &&
|
||||
"${{ needs.llm-tests.result }}" == "success" &&
|
||||
"${{ needs.gemini-tests.result }}" == "success" &&
|
||||
"${{ needs.docker-compose-test.result }}" == "success" &&
|
||||
"${{ needs.docker-ci-test.result }}" == "success" &&
|
||||
"${{ needs.ollama-tests.result }}" == "success" ]]; then
|
||||
|
|
|
|||
166
.github/workflows/vector_db_tests.yml
vendored
166
.github/workflows/vector_db_tests.yml
vendored
|
|
@ -9,7 +9,10 @@ on:
|
|||
default: "all"
|
||||
description: "Which vector databases to test (comma-separated list or 'all')"
|
||||
secrets:
|
||||
|
||||
WEAVIATE_API_URL:
|
||||
required: false
|
||||
WEAVIATE_API_KEY:
|
||||
required: false
|
||||
POSTGRES_PASSWORD:
|
||||
required: false
|
||||
|
||||
|
|
@ -56,8 +59,132 @@ jobs:
|
|||
# EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
# EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
# EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
# run: uv run python ./cognee/tests/test_chromadb.py
|
||||
# run: poetry run python ./cognee/tests/test_chromadb.py
|
||||
|
||||
run-weaviate-tests:
|
||||
name: Weaviate Tests
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'weaviate') }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E weaviate
|
||||
|
||||
- name: Run Weaviate Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
VECTOR_DB_URL: ${{ secrets.WEAVIATE_API_URL }}
|
||||
VECTOR_DB_KEY: ${{ secrets.WEAVIATE_API_KEY }}
|
||||
run: poetry run python ./cognee/tests/test_weaviate.py
|
||||
|
||||
run-milvus-tests:
|
||||
name: Milvus Tests
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'milvus') }}
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E milvus
|
||||
|
||||
- name: Run Milvus Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: poetry run python ./cognee/tests/test_milvus.py
|
||||
|
||||
run_qdrant_integration_test:
|
||||
name: Qdrant Tests
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ inputs.databases == 'all' || contains(inputs.databases, 'qdrant') }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
services:
|
||||
qdrant:
|
||||
image: qdrant/qdrant:v1.14.1
|
||||
env:
|
||||
QDRANT__LOG_LEVEL: ERROR
|
||||
QDRANT__SERVICE__API_KEY: qdrant_api_key
|
||||
QDRANT__SERVICE__ENABLE_TLS: 0
|
||||
ports:
|
||||
- 6333:6333
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E qdrant
|
||||
|
||||
- name: Wait for Qdrant to be healthy
|
||||
run: |
|
||||
for i in {1..10}; do
|
||||
if curl -f http://127.0.0.1:6333/healthz; then
|
||||
echo "Qdrant is healthy!"
|
||||
exit 0
|
||||
fi
|
||||
echo "Waiting for Qdrant to be healthy..."
|
||||
sleep 3
|
||||
done
|
||||
echo "Qdrant failed to become healthy in time"
|
||||
exit 1
|
||||
|
||||
- name: Run default Qdrant
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
VECTOR_DB_URL: 127.0.0.1
|
||||
VECTOR_DB_KEY: qdrant_api_key
|
||||
run: poetry run python ./cognee/tests/test_qdrant.py
|
||||
|
||||
run-postgres-tests:
|
||||
name: PostgreSQL Tests
|
||||
|
|
@ -87,12 +214,14 @@ jobs:
|
|||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
extra-dependencies: "postgres"
|
||||
|
||||
- name: Install specific db dependency
|
||||
run: |
|
||||
poetry install -E postgres
|
||||
|
||||
- name: Run PGVector Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
|
|
@ -101,31 +230,4 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_pgvector.py
|
||||
|
||||
run-lancedb-tests:
|
||||
name: LanceDB Tests
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Run LanceDB Tests
|
||||
env:
|
||||
ENV: 'dev'
|
||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
run: uv run python ./cognee/tests/test_lancedb.py
|
||||
run: poetry run python ./cognee/tests/test_pgvector.py
|
||||
|
|
|
|||
168
.github/workflows/weighted_edges_tests.yml
vendored
168
.github/workflows/weighted_edges_tests.yml
vendored
|
|
@ -1,168 +0,0 @@
|
|||
name: Weighted Edges Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, dev, weighted_edges ]
|
||||
paths:
|
||||
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
||||
- 'cognee/infrastructure/engine/models/Edge.py'
|
||||
- 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py'
|
||||
- 'examples/python/weighted_edges_example.py'
|
||||
- '.github/workflows/weighted_edges_tests.yml'
|
||||
pull_request:
|
||||
branches: [ main, dev ]
|
||||
paths:
|
||||
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
||||
- 'cognee/infrastructure/engine/models/Edge.py'
|
||||
- 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py'
|
||||
- 'examples/python/weighted_edges_example.py'
|
||||
- '.github/workflows/weighted_edges_tests.yml'
|
||||
|
||||
env:
|
||||
RUNTIME__LOG_LEVEL: ERROR
|
||||
ENV: 'dev'
|
||||
|
||||
jobs:
|
||||
test-weighted-edges-functionality:
|
||||
name: Test Weighted Edges Core Functionality
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11', '3.12']
|
||||
env:
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: gpt-5-mini
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Run Weighted Edges Unit Tests
|
||||
run: |
|
||||
uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v --tb=short
|
||||
|
||||
- name: Run Standard Graph Tests (Regression)
|
||||
run: |
|
||||
uv run pytest cognee/tests/unit/interfaces/graph/get_graph_from_model_unit_test.py -v --tb=short
|
||||
|
||||
test-with-different-databases:
|
||||
name: Test Weighted Edges with Different Graph Databases
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
database: ['kuzu', 'neo4j']
|
||||
include:
|
||||
- database: kuzu
|
||||
graph_db_provider: "kuzu"
|
||||
- database: neo4j
|
||||
graph_db_provider: "neo4j"
|
||||
env:
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: gpt-5-mini
|
||||
LLM_ENDPOINT: https://api.openai.com/v1
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_API_VERSION: "2024-02-01"
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Setup Neo4j with GDS
|
||||
uses: ./.github/actions/setup_neo4j
|
||||
id: neo4j
|
||||
|
||||
- name: Dependencies already installed
|
||||
run: echo "Dependencies already installed in setup"
|
||||
|
||||
- name: Run Weighted Edges Tests
|
||||
env:
|
||||
ENABLE_BACKEND_ACCESS_CONTROL: 'false'
|
||||
GRAPH_DATABASE_PROVIDER: ${{ matrix.graph_db_provider }}
|
||||
GRAPH_DATABASE_URL: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-url || '' }}
|
||||
GRAPH_DATABASE_USERNAME: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-username || '' }}
|
||||
GRAPH_DATABASE_PASSWORD: ${{ matrix.graph_db_provider == 'neo4j' && steps.neo4j.outputs.neo4j-password || '' }}
|
||||
run: |
|
||||
uv run pytest cognee/tests/unit/interfaces/graph/test_weighted_edges.py -v --tb=short
|
||||
|
||||
test-examples:
|
||||
name: Test Weighted Edges Examples
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
LLM_PROVIDER: openai
|
||||
LLM_MODEL: gpt-5-mini
|
||||
LLM_ENDPOINT: https://api.openai.com/v1
|
||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
LLM_API_VERSION: "2024-02-01"
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Test Weighted Edges Example
|
||||
run: |
|
||||
uv run python examples/python/weighted_edges_example.py
|
||||
|
||||
- name: Verify Visualization File Created
|
||||
run: |
|
||||
if [ -f "examples/python/weighted_graph_visualization.html" ]; then
|
||||
echo "✅ Visualization file created successfully"
|
||||
ls -la examples/python/weighted_graph_visualization.html
|
||||
else
|
||||
echo "❌ Visualization file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
code-quality:
|
||||
name: Code Quality for Weighted Edges
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cognee Setup
|
||||
uses: ./.github/actions/cognee_setup
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Run Linting on Weighted Edges Files
|
||||
uses: astral-sh/ruff-action@v2
|
||||
with:
|
||||
args: "check cognee/modules/graph/utils/get_graph_from_model.py cognee/tests/unit/interfaces/graph/test_weighted_edges.py examples/python/weighted_edges_example.py"
|
||||
|
||||
- name: Run Formatting Check on Weighted Edges Files
|
||||
uses: astral-sh/ruff-action@v2
|
||||
with:
|
||||
args: "format --check cognee/modules/graph/utils/get_graph_from_model.py cognee/tests/unit/interfaces/graph/test_weighted_edges.py examples/python/weighted_edges_example.py"
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -37,7 +37,6 @@ share/python-wheels/
|
|||
.installed.cfg
|
||||
*.egg
|
||||
.python-version
|
||||
cognee-mcp/.python-version
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
|
|
@ -186,7 +185,6 @@ cognee/cache/
|
|||
# Default cognee system directory, used in development
|
||||
.cognee_system/
|
||||
.data_storage/
|
||||
.cognee_cache/
|
||||
.artifacts/
|
||||
.anon_id
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
pull_request_rules:
|
||||
- name: Backport to main when backport_main label is set
|
||||
conditions:
|
||||
- label=backport_main
|
||||
- base=dev
|
||||
actions:
|
||||
backport:
|
||||
branches:
|
||||
- main
|
||||
132
AGENTS.md
132
AGENTS.md
|
|
@ -1,132 +0,0 @@
|
|||
## Repository Guidelines
|
||||
|
||||
This document summarizes how to work with the cognee repository: how it’s organized, how to build, test, lint, and contribute. It mirrors our actual tooling and CI while providing quick commands for local development.
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
- `cognee/`: Core Python library and API.
|
||||
- `api/`: FastAPI application and versioned routers (add, cognify, memify, search, delete, users, datasets, responses, visualize, settings, sync, update, checks).
|
||||
- `cli/`: CLI entry points and subcommands invoked via `cognee` / `cognee-cli`.
|
||||
- `infrastructure/`: Databases, LLM providers, embeddings, loaders, and storage adapters.
|
||||
- `modules/`: Domain logic (graph, retrieval, ontology, users, processing, observability, etc.).
|
||||
- `tasks/`: Reusable tasks (e.g., code graph, web scraping, storage). Extend with new tasks here.
|
||||
- `eval_framework/`: Evaluation utilities and adapters.
|
||||
- `shared/`: Cross-cutting helpers (logging, settings, utils).
|
||||
- `tests/`: Unit, integration, CLI, and end-to-end tests organized by feature.
|
||||
- `__main__.py`: Entrypoint to route to CLI.
|
||||
- `cognee-mcp/`: Model Context Protocol server exposing cognee as MCP tools (SSE/HTTP/stdio). Contains its own README and Dockerfile.
|
||||
- `cognee-frontend/`: Next.js UI for local development and demos.
|
||||
- `distributed/`: Utilities for distributed execution (Modal, workers, queues).
|
||||
- `examples/`: Example scripts demonstrating the public APIs and features (graph, code graph, multimodal, permissions, etc.).
|
||||
- `notebooks/`: Jupyter notebooks for demos and tutorials.
|
||||
- `alembic/`: Database migrations for relational backends.
|
||||
|
||||
Notes:
|
||||
- Co-locate feature-specific helpers under their respective package (`modules/`, `infrastructure/`, or `tasks/`).
|
||||
- Extend the system by adding new tasks, loaders, or retrievers rather than modifying core pipeline mechanisms.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
Python (root) – requires Python >= 3.10 and < 3.14. We recommend `uv` for speed and reproducibility.
|
||||
|
||||
- Create/refresh env and install dev deps:
|
||||
```bash
|
||||
uv sync --dev --all-extras --reinstall
|
||||
```
|
||||
|
||||
- Run the CLI (examples):
|
||||
```bash
|
||||
uv run cognee-cli add "Cognee turns documents into AI memory."
|
||||
uv run cognee-cli cognify
|
||||
uv run cognee-cli search "What does cognee do?"
|
||||
uv run cognee-cli -ui # Launches UI, backend API, and MCP server together
|
||||
```
|
||||
|
||||
- Start the FastAPI server directly:
|
||||
```bash
|
||||
uv run python -m cognee.api.client
|
||||
```
|
||||
|
||||
- Run tests (CI mirrors these commands):
|
||||
```bash
|
||||
uv run pytest cognee/tests/unit/ -v
|
||||
uv run pytest cognee/tests/integration/ -v
|
||||
```
|
||||
|
||||
- Lint and format (ruff):
|
||||
```bash
|
||||
uv run ruff check .
|
||||
uv run ruff format .
|
||||
```
|
||||
|
||||
- Optional static type checks (mypy):
|
||||
```bash
|
||||
uv run mypy cognee/
|
||||
```
|
||||
|
||||
MCP Server (`cognee-mcp/`):
|
||||
|
||||
- Install and run locally:
|
||||
```bash
|
||||
cd cognee-mcp
|
||||
uv sync --dev --all-extras --reinstall
|
||||
uv run python src/server.py # stdio (default)
|
||||
uv run python src/server.py --transport sse
|
||||
uv run python src/server.py --transport http --host 127.0.0.1 --port 8000 --path /mcp
|
||||
```
|
||||
|
||||
- API Mode (connect to a running Cognee API):
|
||||
```bash
|
||||
uv run python src/server.py --transport sse --api-url http://localhost:8000 --api-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
- Docker quickstart (examples): see `cognee-mcp/README.md` for full details
|
||||
```bash
|
||||
docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main
|
||||
```
|
||||
|
||||
Frontend (`cognee-frontend/`):
|
||||
```bash
|
||||
cd cognee-frontend
|
||||
npm install
|
||||
npm run dev # Next.js dev server
|
||||
npm run lint # ESLint
|
||||
npm run build && npm start
|
||||
```
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Python:
|
||||
- 4-space indentation, modules and functions in `snake_case`, classes in `PascalCase`.
|
||||
- Public APIs should be type-annotated where practical.
|
||||
- Use `ruff format` before committing; `ruff check` enforces import hygiene and style (line-length 100 configured in `pyproject.toml`).
|
||||
- Prefer explicit, structured error handling. Use shared logging utilities in `cognee.shared.logging_utils`.
|
||||
|
||||
MCP server and Frontend:
|
||||
- Follow the local `README.md` and ESLint/TypeScript configuration in `cognee-frontend/`.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
- Place Python tests under `cognee/tests/`.
|
||||
- Unit tests: `cognee/tests/unit/`
|
||||
- Integration tests: `cognee/tests/integration/`
|
||||
- CLI tests: `cognee/tests/cli_tests/`
|
||||
- Name test files `test_*.py`. Use `pytest.mark.asyncio` for async tests.
|
||||
- Avoid external state; rely on test fixtures and the CI-provided env vars when LLM/embedding providers are required. See CI workflows under `.github/workflows/` for expected environment variables.
|
||||
- When adding public APIs, provide/update targeted examples under `examples/python/`.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
- Use clear, imperative subjects (≤ 72 chars) and conventional commit styling in PR titles. Our CI validates semantic PR titles (see `.github/workflows/pr_lint`). Examples:
|
||||
- `feat(graph): add temporal edge weighting`
|
||||
- `fix(api): handle missing auth cookie`
|
||||
- `docs: update installation instructions`
|
||||
- Reference related issues/discussions in the PR body and provide brief context.
|
||||
- PRs should describe scope, list local test commands run, and mention any impacts on MCP server or UI if applicable.
|
||||
- Sign commits and affirm the DCO (see `CONTRIBUTING.md`).
|
||||
|
||||
## CI Mirrors Local Commands
|
||||
|
||||
Our GitHub Actions run the same ruff checks and pytest suites shown above (`.github/workflows/basic_tests.yml` and related workflows). Use the commands in this document locally to minimize CI surprises.
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,6 @@ This guide will help you get started and ensure your contributions can be effici
|
|||
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
||||
- [Discord Community](https://discord.gg/bcy8xFAtfd)
|
||||
- [Issue Tracker](https://github.com/topoteretes/cognee/issues)
|
||||
- [Cognee Docs](https://docs.cognee.ai)
|
||||
|
||||
## 1. 🚀 Ways to Contribute
|
||||
|
||||
|
|
@ -70,13 +69,6 @@ Looking for a place to start? Try filtering for [good first issues](https://gith
|
|||
git clone https://github.com/<your-github-username>/cognee.git
|
||||
cd cognee
|
||||
```
|
||||
In case you are working on Vector and Graph Adapters
|
||||
1. Fork the [**cognee-community**](https://github.com/topoteretes/cognee-community) repository
|
||||
2. Clone your fork:
|
||||
```shell
|
||||
git clone https://github.com/<your-github-username>/cognee-community.git
|
||||
cd cognee-community
|
||||
```
|
||||
|
||||
### Create a Branch
|
||||
|
||||
|
|
@ -97,26 +89,9 @@ git checkout -b feature/your-feature-name
|
|||
python cognee/cognee/tests/test_library.py
|
||||
```
|
||||
|
||||
### Running Simple Example
|
||||
|
||||
Change .env.example into .env and provide your OPENAI_API_KEY as LLM_API_KEY
|
||||
|
||||
Make sure to run ```shell uv sync ``` in the root cloned folder or set up a virtual environment to run cognee
|
||||
|
||||
```shell
|
||||
python cognee/cognee/examples/python/simple_example.py
|
||||
```
|
||||
or
|
||||
|
||||
```shell
|
||||
uv run python cognee/cognee/examples/python/simple_example.py
|
||||
```
|
||||
|
||||
## 4. 📤 Submitting Changes
|
||||
|
||||
1. Install ruff on your system
|
||||
2. Run ```ruff format .``` and ``` ruff check ``` and fix the issues
|
||||
3. Push your changes:
|
||||
1. Push your changes:
|
||||
```shell
|
||||
git add .
|
||||
git commit -s -m "Description of your changes"
|
||||
|
|
@ -124,7 +99,7 @@ git push origin feature/your-feature-name
|
|||
```
|
||||
|
||||
2. Create a Pull Request:
|
||||
- Go to the [**cognee** repository](https://github.com/topoteretes/cognee) or [cognee community repository](https://github.com/topoteretes/cognee-community)
|
||||
- Go to the [**cognee** repository](https://github.com/topoteretes/cognee)
|
||||
- Click "Compare & Pull Request" and open a PR against dev branch
|
||||
- Fill in the PR template with details about your changes
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ RUN apt-get update && apt-get install -y \
|
|||
libpq-dev \
|
||||
git \
|
||||
curl \
|
||||
cmake \
|
||||
clang \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
|
@ -32,7 +31,7 @@ COPY README.md pyproject.toml uv.lock entrypoint.sh ./
|
|||
|
||||
# Install the project's dependencies using the lockfile and settings
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --extra debug --extra api --extra postgres --extra neo4j --extra llama-index --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable
|
||||
uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable
|
||||
|
||||
# Copy Alembic configuration
|
||||
COPY alembic.ini /app/alembic.ini
|
||||
|
|
@ -41,9 +40,8 @@ COPY alembic/ /app/alembic
|
|||
# Then, add the rest of the project source code and install it
|
||||
# Installing separately from its dependencies allows optimal layer caching
|
||||
COPY ./cognee /app/cognee
|
||||
COPY ./distributed /app/distributed
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --extra debug --extra api --extra postgres --extra neo4j --extra llama-index --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable
|
||||
uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable
|
||||
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ FROM python:3.11-slim
|
|||
ENV PIP_NO_CACHE_DIR=true
|
||||
ENV PATH="${PATH}:/root/.poetry/bin"
|
||||
ENV PYTHONPATH=/app
|
||||
ENV RUN_MODE=modal
|
||||
ENV SKIP_MIGRATIONS=true
|
||||
|
||||
# System dependencies
|
||||
|
|
@ -23,7 +24,6 @@ RUN pip install poetry
|
|||
|
||||
RUN poetry config virtualenvs.create false
|
||||
|
||||
RUN poetry install --extras distributed --extras evals --extras deepeval --no-root
|
||||
RUN poetry install --extras neo4j --extras qdrant --no-root
|
||||
|
||||
COPY cognee/ /app/cognee
|
||||
COPY distributed/ /app/distributed
|
||||
193
README.md
193
README.md
|
|
@ -5,43 +5,38 @@
|
|||
|
||||
<br />
|
||||
|
||||
Cognee - Accurate and Persistent AI Memory
|
||||
cognee - Memory for AI Agents in 5 lines of code
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.youtube.com/watch?v=1bezuvLwJmw&t=2s">Demo</a>
|
||||
.
|
||||
<a href="https://docs.cognee.ai/">Docs</a>
|
||||
.
|
||||
<a href="https://cognee.ai">Learn More</a>
|
||||
<a href="https://cognee.ai">Learn more</a>
|
||||
·
|
||||
<a href="https://discord.gg/NQPKmU5CCg">Join Discord</a>
|
||||
·
|
||||
<a href="https://www.reddit.com/r/AIMemory/">Join r/AIMemory</a>
|
||||
.
|
||||
<a href="https://github.com/topoteretes/cognee-community">Community Plugins & Add-ons</a>
|
||||
</p>
|
||||
|
||||
|
||||
[](https://GitHub.com/topoteretes/cognee/network/)
|
||||
[](https://GitHub.com/topoteretes/cognee/stargazers/)
|
||||
[](https://GitHub.com/topoteretes/cognee/commit/)
|
||||
[](https://github.com/topoteretes/cognee/tags/)
|
||||
[](https://github.com/topoteretes/cognee/tags/)
|
||||
[](https://pepy.tech/project/cognee)
|
||||
[](https://github.com/topoteretes/cognee/blob/main/LICENSE)
|
||||
[](https://github.com/topoteretes/cognee/graphs/contributors)
|
||||
<a href="https://github.com/sponsors/topoteretes"><img src="https://img.shields.io/badge/Sponsor-❤️-ff69b4.svg" alt="Sponsor"></a>
|
||||
|
||||
<p>
|
||||
<a href="https://www.producthunt.com/posts/cognee?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-cognee" target="_blank" style="display:inline-block; margin-right:10px;">
|
||||
<img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=946346&theme=light&period=daily&t=1744472480704" alt="cognee - Memory for AI Agents  in 5 lines of code | Product Hunt" width="250" height="54" />
|
||||
</a>
|
||||
<a href="https://www.producthunt.com/posts/cognee?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-cognee" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=946346&theme=light&period=daily&t=1744472480704" alt="cognee - Memory for AI Agents  in 5 lines of code | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
||||
|
||||
<a href="https://trendshift.io/repositories/13955" target="_blank" style="display:inline-block;">
|
||||
<img src="https://trendshift.io/api/badge/repositories/13955" alt="topoteretes%2Fcognee | Trendshift" width="250" height="55" />
|
||||
</a>
|
||||
</p>
|
||||
<a href="https://trendshift.io/repositories/13955" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13955" alt="topoteretes%2Fcognee | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
|
||||
Use your data to build personalized and dynamic memory for AI Agents. Cognee lets you replace RAG with scalable and modular ECL (Extract, Cognify, Load) pipelines.
|
||||
|
||||
**🚀 We are launching Cognee SaaS: Sign up [here](https://www.cognee.ai/waitlist) for the hosted beta!**
|
||||
|
||||
Build dynamic memory for Agents and replace RAG using scalable, modular ECL (Extract, Cognify, Load) pipelines.
|
||||
|
||||
More on [use-cases](https://docs.cognee.ai/use-cases) and [evals](https://github.com/topoteretes/cognee/tree/main/evals)
|
||||
|
||||
<p align="center">
|
||||
🌐 Available Languages
|
||||
|
|
@ -49,7 +44,7 @@ Use your data to build personalized and dynamic memory for AI Agents. Cognee let
|
|||
<!-- Keep these links. Translations will automatically update with the README. -->
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=de">Deutsch</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=es">Español</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=fr">Français</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=fr">français</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=ja">日本語</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=ko">한국어</a> |
|
||||
<a href="https://www.readme-i18n.com/topoteretes/cognee?lang=pt">Português</a> |
|
||||
|
|
@ -63,150 +58,146 @@ Use your data to build personalized and dynamic memory for AI Agents. Cognee let
|
|||
</div>
|
||||
</div>
|
||||
|
||||
## About Cognee
|
||||
|
||||
Cognee is an open-source tool and platform that transforms your raw data into persistent and dynamic AI memory for Agents. It combines vector search with graph databases to make your documents both searchable by meaning and connected by relationships.
|
||||
Cognee offers default memory creation and search which we describe bellow. But with Cognee you can build your own!
|
||||
## 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 <a href="https://colab.research.google.com/drive/1jHbWVypDgCLwjE71GSXhRL3YxYhCZzG1?usp=sharing">notebook</a> , <a href="https://deepnote.com/workspace/cognee-382213d0-0444-4c89-8265-13770e333c02/project/cognee-demo-78ffacb9-5832-4611-bb1a-560386068b30/notebook/Notebook-1-75b24cda566d4c24ab348f7150792601?utm_source=share-modal&utm_medium=product-shared-content&utm_campaign=notebook&utm_content=78ffacb9-5832-4611-bb1a-560386068b30">Deepnote notebook</a> or <a href="https://github.com/topoteretes/cognee-starter">starter repo</a>
|
||||
|
||||
|
||||
### Cognee Open Source:
|
||||
|
||||
- Interconnects any type of data — including past conversations, files, images, and audio transcriptions
|
||||
- Replaces traditional RAG systems with a unified memory layer built on graphs and vectors
|
||||
- Reduces developer effort and infrastructure cost while improving quality and precision
|
||||
- Provides Pythonic data pipelines for ingestion from 30+ data sources
|
||||
- Offers high customizability through user-defined tasks, modular pipelines, and built-in search endpoints
|
||||
## 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`](CONTRIBUTING.md) for more information.
|
||||
|
||||
|
||||
## Basic Usage & Feature Guide
|
||||
|
||||
To learn more, [check out this short, end-to-end Colab walkthrough](https://colab.research.google.com/drive/12Vi9zID-M3fpKpKiaqDBvkk98ElkRPWy?usp=sharing) of Cognee's core features.
|
||||
|
||||
[](https://colab.research.google.com/drive/12Vi9zID-M3fpKpKiaqDBvkk98ElkRPWy?usp=sharing)
|
||||
|
||||
## Quickstart
|
||||
## 📦 Installation
|
||||
|
||||
Let’s try Cognee in just a few lines of code. For detailed setup and configuration, see the [Cognee Docs](https://docs.cognee.ai/getting-started/installation#environment-configuration).
|
||||
You can install Cognee using either **pip**, **poetry**, **uv** or any other python package manager.
|
||||
Cognee supports Python 3.8 to 3.12
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.10 to 3.13
|
||||
|
||||
### Step 1: Install Cognee
|
||||
|
||||
You can install Cognee with **pip**, **poetry**, **uv**, or your preferred Python package manager.
|
||||
### With pip
|
||||
|
||||
```bash
|
||||
uv pip install cognee
|
||||
pip install cognee
|
||||
```
|
||||
|
||||
### Step 2: Configure the LLM
|
||||
```python
|
||||
## 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
|
||||
|
||||
```bash
|
||||
uv sync --all-extras
|
||||
```
|
||||
|
||||
## 💻 Basic Usage
|
||||
|
||||
### Setup
|
||||
|
||||
```
|
||||
import os
|
||||
os.environ["LLM_API_KEY"] = "YOUR OPENAI_API_KEY"
|
||||
|
||||
```
|
||||
Alternatively, create a `.env` file using our [template](https://github.com/topoteretes/cognee/blob/main/.env.template).
|
||||
|
||||
To integrate other LLM providers, see our [LLM Provider Documentation](https://docs.cognee.ai/setup-configuration/llm-providers).
|
||||
You can also set the variables by creating .env file, using our <a href="https://github.com/topoteretes/cognee/blob/main/.env.template">template.</a>
|
||||
To use different LLM providers, for more info check out our <a href="https://docs.cognee.ai">documentation</a>
|
||||
|
||||
### Step 3: Run the Pipeline
|
||||
|
||||
Cognee will take your documents, generate a knowledge graph from them and then query the graph based on combined relationships.
|
||||
### Simple example
|
||||
|
||||
Now, run a minimal pipeline:
|
||||
This script will run the default pipeline:
|
||||
|
||||
```python
|
||||
import cognee
|
||||
import asyncio
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
async def main():
|
||||
# Add text to cognee
|
||||
await cognee.add("Cognee turns documents into AI memory.")
|
||||
await cognee.add("Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval.")
|
||||
|
||||
# Generate the knowledge graph
|
||||
await cognee.cognify()
|
||||
|
||||
# Add memory algorithms to the graph
|
||||
await cognee.memify()
|
||||
|
||||
# Query the knowledge graph
|
||||
results = await cognee.search("What does Cognee do?")
|
||||
results = await cognee.search("Tell me about NLP")
|
||||
|
||||
# Display the results
|
||||
for result in results:
|
||||
pprint(result)
|
||||
print(result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
|
||||
```
|
||||
|
||||
As you can see, the output is generated from the document we previously stored in Cognee:
|
||||
|
||||
```bash
|
||||
Cognee turns documents into AI memory.
|
||||
Example output:
|
||||
```
|
||||
|
||||
### Use the Cognee CLI
|
||||
|
||||
As an alternative, you can get started with these essential commands:
|
||||
|
||||
```bash
|
||||
cognee-cli add "Cognee turns documents into AI memory."
|
||||
|
||||
cognee-cli cognify
|
||||
|
||||
cognee-cli search "What does Cognee do?"
|
||||
cognee-cli delete --all
|
||||
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.
|
||||
|
||||
```
|
||||
|
||||
To open the local UI, run:
|
||||
```bash
|
||||
cognee-cli -ui
|
||||
```
|
||||
## Our paper is out! <a href="https://arxiv.org/abs/2505.24478" target="_blank" rel="noopener noreferrer">Read here</a>
|
||||
|
||||
## Demos & Examples
|
||||
<div style="text-align: center">
|
||||
<img src="assets/cognee-paper.png" alt="cognee paper" width="100%" />
|
||||
</div>
|
||||
|
||||
See Cognee in action:
|
||||
</div>
|
||||
|
||||
### Persistent Agent Memory
|
||||
## Cognee UI
|
||||
|
||||
[Cognee Memory for LangGraph Agents](https://github.com/user-attachments/assets/e113b628-7212-4a2b-b288-0be39a93a1c3)
|
||||
You can also cognify your files and query using cognee UI.
|
||||
|
||||
### Simple GraphRAG
|
||||
<img src="assets/cognee-ui-2.webp" width="100%" alt="Cognee UI 2"></a>
|
||||
|
||||
[Watch Demo](https://github.com/user-attachments/assets/f2186b2e-305a-42b0-9c2d-9f4473f15df8)
|
||||
Try cognee UI out locally [here](https://docs.cognee.ai/how-to-guides/cognee-ui).
|
||||
|
||||
### Cognee with Ollama
|
||||
## Understand our architecture
|
||||
|
||||
[Watch Demo](https://github.com/user-attachments/assets/39672858-f774-4136-b957-1e2de67b8981)
|
||||
<div style="text-align: center">
|
||||
<img src="assets/cognee_diagram.png" alt="cognee concept diagram" width="100%" />
|
||||
</div>
|
||||
|
||||
|
||||
## Community & Support
|
||||
|
||||
### Contributing
|
||||
We welcome contributions from the community! Your input helps make Cognee better for everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) to get started.
|
||||
## Demos
|
||||
|
||||
### Code of Conduct
|
||||
1. What is AI memory:
|
||||
|
||||
We're committed to fostering an inclusive and respectful community. Read our [Code of Conduct](https://github.com/topoteretes/cognee/blob/main/CODE_OF_CONDUCT.md) for guidelines.
|
||||
[Learn about cognee](https://github.com/user-attachments/assets/8b2a0050-5ec4-424c-b417-8269971503f0)
|
||||
|
||||
## Research & Citation
|
||||
2. Simple GraphRAG demo
|
||||
|
||||
We recently published a research paper on optimizing knowledge graphs for LLM reasoning:
|
||||
[Simple GraphRAG demo](https://github.com/user-attachments/assets/d80b0776-4eb9-4b8e-aa22-3691e2d44b8f)
|
||||
|
||||
```bibtex
|
||||
@misc{markovic2025optimizinginterfaceknowledgegraphs,
|
||||
title={Optimizing the Interface Between Knowledge Graphs and LLMs for Complex Reasoning},
|
||||
author={Vasilije Markovic and Lazar Obradovic and Laszlo Hajdu and Jovan Pavlovic},
|
||||
year={2025},
|
||||
eprint={2505.24478},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.AI},
|
||||
url={https://arxiv.org/abs/2505.24478},
|
||||
}
|
||||
```
|
||||
3. cognee with Ollama
|
||||
|
||||
[cognee with local models](https://github.com/user-attachments/assets/8621d3e8-ecb8-4860-afb2-5594f2ee17db)
|
||||
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
We are committed to making open source an enjoyable and respectful experience for our community. See <a href="https://github.com/topoteretes/cognee/blob/main/CODE_OF_CONDUCT.md"><code>CODE_OF_CONDUCT</code></a> for more information.
|
||||
|
||||
## 💫 Contributors
|
||||
|
||||
<a href="https://github.com/topoteretes/cognee/graphs/contributors">
|
||||
<img alt="contributors" src="https://contrib.rocks/image?repo=topoteretes/cognee"/>
|
||||
</a>
|
||||
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://star-history.com/#topoteretes/cognee&Date)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ handlers =
|
|||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = WARN
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import asyncio
|
||||
from alembic import context
|
||||
from logging.config import fileConfig
|
||||
|
||||
from sqlalchemy import pool
|
||||
from sqlalchemy.engine import Connection
|
||||
from sqlalchemy.ext.asyncio import async_engine_from_config
|
||||
|
||||
from cognee.infrastructure.databases.relational import get_relational_engine, Base
|
||||
from cognee.infrastructure.databases.relational import Base
|
||||
from alembic import context
|
||||
from cognee.infrastructure.databases.relational import get_relational_engine, get_relational_config
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
|
|
@ -85,6 +86,12 @@ def run_migrations_online() -> None:
|
|||
|
||||
db_engine = get_relational_engine()
|
||||
|
||||
if db_engine.engine.dialect.name == "sqlite":
|
||||
from cognee.infrastructure.files.storage import LocalStorage
|
||||
|
||||
db_config = get_relational_config()
|
||||
LocalStorage.ensure_directory_exists(db_config.db_path)
|
||||
|
||||
print("Using database:", db_engine.db_uri)
|
||||
|
||||
config.set_section_option(
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
"""incremental_loading
|
||||
|
||||
Revision ID: 1daae0df1866
|
||||
Revises: b9274c27a25a
|
||||
Create Date: 2025-08-12 13:14:12.515935
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.mutable import MutableDict
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "1daae0df1866"
|
||||
down_revision: Union[str, None] = "b9274c27a25a"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
# If column already exists skip migration
|
||||
pipeline_status_column = _get_column(insp, "data", "pipeline_status")
|
||||
if not pipeline_status_column:
|
||||
op.add_column(
|
||||
"data",
|
||||
sa.Column(
|
||||
"pipeline_status",
|
||||
MutableDict.as_mutable(sa.JSON),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("data", "pipeline_status")
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
"""Add sync_operations table
|
||||
|
||||
Revision ID: 211ab850ef3d
|
||||
Revises: 9e7a3cb85175
|
||||
Create Date: 2025-09-10 20:11:13.534829
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "211ab850ef3d"
|
||||
down_revision: Union[str, None] = "45957f0a9849"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
# Check if table already exists (it might be created by Base.metadata.create_all() in initial migration)
|
||||
connection = op.get_bind()
|
||||
inspector = sa.inspect(connection)
|
||||
|
||||
if op.get_context().dialect.name == "postgresql":
|
||||
syncstatus_enum = postgresql.ENUM(
|
||||
"STARTED", "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELLED", name="syncstatus"
|
||||
)
|
||||
syncstatus_enum.create(op.get_bind(), checkfirst=True)
|
||||
|
||||
if "sync_operations" not in inspector.get_table_names():
|
||||
if op.get_context().dialect.name == "postgresql":
|
||||
syncstatus = postgresql.ENUM(
|
||||
"STARTED",
|
||||
"IN_PROGRESS",
|
||||
"COMPLETED",
|
||||
"FAILED",
|
||||
"CANCELLED",
|
||||
name="syncstatus",
|
||||
create_type=False,
|
||||
)
|
||||
else:
|
||||
syncstatus = sa.Enum(
|
||||
"STARTED",
|
||||
"IN_PROGRESS",
|
||||
"COMPLETED",
|
||||
"FAILED",
|
||||
"CANCELLED",
|
||||
name="syncstatus",
|
||||
create_type=False,
|
||||
)
|
||||
|
||||
# Table doesn't exist, create it normally
|
||||
op.create_table(
|
||||
"sync_operations",
|
||||
sa.Column("id", sa.UUID(), nullable=False),
|
||||
sa.Column("run_id", sa.Text(), nullable=True),
|
||||
sa.Column(
|
||||
"status",
|
||||
syncstatus,
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column("progress_percentage", sa.Integer(), nullable=True),
|
||||
sa.Column("dataset_ids", sa.JSON(), nullable=True),
|
||||
sa.Column("dataset_names", sa.JSON(), nullable=True),
|
||||
sa.Column("user_id", sa.UUID(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("started_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("completed_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("total_records_to_sync", sa.Integer(), nullable=True),
|
||||
sa.Column("total_records_to_download", sa.Integer(), nullable=True),
|
||||
sa.Column("total_records_to_upload", sa.Integer(), nullable=True),
|
||||
sa.Column("records_downloaded", sa.Integer(), nullable=True),
|
||||
sa.Column("records_uploaded", sa.Integer(), nullable=True),
|
||||
sa.Column("bytes_downloaded", sa.Integer(), nullable=True),
|
||||
sa.Column("bytes_uploaded", sa.Integer(), nullable=True),
|
||||
sa.Column("dataset_sync_hashes", sa.JSON(), nullable=True),
|
||||
sa.Column("error_message", sa.Text(), nullable=True),
|
||||
sa.Column("retry_count", sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_sync_operations_run_id"), "sync_operations", ["run_id"], unique=True
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_sync_operations_user_id"), "sync_operations", ["user_id"], unique=False
|
||||
)
|
||||
else:
|
||||
# Table already exists, but we might need to add missing columns or indexes
|
||||
# For now, just log that the table already exists
|
||||
print("sync_operations table already exists, skipping creation")
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
# Only drop if table exists (might have been created by Base.metadata.create_all())
|
||||
connection = op.get_bind()
|
||||
inspector = sa.inspect(connection)
|
||||
|
||||
if "sync_operations" in inspector.get_table_names():
|
||||
op.drop_index(op.f("ix_sync_operations_user_id"), table_name="sync_operations")
|
||||
op.drop_index(op.f("ix_sync_operations_run_id"), table_name="sync_operations")
|
||||
op.drop_table("sync_operations")
|
||||
|
||||
# Drop the enum type that was created (only if no other tables are using it)
|
||||
sa.Enum(name="syncstatus").drop(op.get_bind(), checkfirst=True)
|
||||
else:
|
||||
print("sync_operations table doesn't exist, skipping downgrade")
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
"""Add notebook table
|
||||
|
||||
Revision ID: 45957f0a9849
|
||||
Revises: 9e7a3cb85175
|
||||
Create Date: 2025-09-10 17:47:58.201319
|
||||
|
||||
"""
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from uuid import uuid4
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "45957f0a9849"
|
||||
down_revision: Union[str, None] = "9e7a3cb85175"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
|
||||
if "notebooks" not in inspector.get_table_names():
|
||||
# Define table with all necessary columns including primary key
|
||||
op.create_table(
|
||||
"notebooks",
|
||||
sa.Column("id", sa.UUID, primary_key=True, default=uuid4), # Critical for SQLite
|
||||
sa.Column("owner_id", sa.UUID, index=True),
|
||||
sa.Column("name", sa.String(), nullable=False),
|
||||
sa.Column("cells", sa.JSON(), nullable=False),
|
||||
sa.Column("deletable", sa.Boolean(), default=True),
|
||||
sa.Column("created_at", sa.DateTime(), default=lambda: datetime.now(timezone.utc)),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
inspector = sa.inspect(bind)
|
||||
|
||||
if "notebooks" in inspector.get_table_names():
|
||||
op.drop_table("notebooks")
|
||||
|
|
@ -1,333 +0,0 @@
|
|||
"""Expand dataset database with json connection field
|
||||
|
||||
Revision ID: 46a6ce2bd2b2
|
||||
Revises: 76625596c5c3
|
||||
Create Date: 2025-11-25 17:56:28.938931
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "46a6ce2bd2b2"
|
||||
down_revision: Union[str, None] = "76625596c5c3"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
graph_constraint_name = "dataset_database_graph_database_name_key"
|
||||
vector_constraint_name = "dataset_database_vector_database_name_key"
|
||||
TABLE_NAME = "dataset_database"
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def _recreate_table_without_unique_constraint_sqlite(op, insp):
|
||||
"""
|
||||
SQLite cannot drop unique constraints on individual columns. We must:
|
||||
1. Create a new table without the unique constraints.
|
||||
2. Copy data from the old table.
|
||||
3. Drop the old table.
|
||||
4. Rename the new table.
|
||||
"""
|
||||
conn = op.get_bind()
|
||||
|
||||
# Create new table definition (without unique constraints)
|
||||
op.create_table(
|
||||
f"{TABLE_NAME}_new",
|
||||
sa.Column("owner_id", sa.UUID()),
|
||||
sa.Column("dataset_id", sa.UUID(), primary_key=True, nullable=False),
|
||||
sa.Column("vector_database_name", sa.String(), nullable=False),
|
||||
sa.Column("graph_database_name", sa.String(), nullable=False),
|
||||
sa.Column("vector_database_provider", sa.String(), nullable=False),
|
||||
sa.Column("graph_database_provider", sa.String(), nullable=False),
|
||||
sa.Column(
|
||||
"vector_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="lancedb",
|
||||
),
|
||||
sa.Column(
|
||||
"graph_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="kuzu",
|
||||
),
|
||||
sa.Column("vector_database_url", sa.String()),
|
||||
sa.Column("graph_database_url", sa.String()),
|
||||
sa.Column("vector_database_key", sa.String()),
|
||||
sa.Column("graph_database_key", sa.String()),
|
||||
sa.Column(
|
||||
"graph_database_connection_info",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
sa.Column(
|
||||
"vector_database_connection_info",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
sa.Column("created_at", sa.DateTime()),
|
||||
sa.Column("updated_at", sa.DateTime()),
|
||||
sa.ForeignKeyConstraint(["dataset_id"], ["datasets.id"], ondelete="CASCADE"),
|
||||
sa.ForeignKeyConstraint(["owner_id"], ["principals.id"], ondelete="CASCADE"),
|
||||
)
|
||||
|
||||
# Copy data into new table
|
||||
conn.execute(
|
||||
sa.text(f"""
|
||||
INSERT INTO {TABLE_NAME}_new
|
||||
SELECT
|
||||
owner_id,
|
||||
dataset_id,
|
||||
vector_database_name,
|
||||
graph_database_name,
|
||||
vector_database_provider,
|
||||
graph_database_provider,
|
||||
vector_dataset_database_handler,
|
||||
graph_dataset_database_handler,
|
||||
vector_database_url,
|
||||
graph_database_url,
|
||||
vector_database_key,
|
||||
graph_database_key,
|
||||
COALESCE(graph_database_connection_info, '{{}}'),
|
||||
COALESCE(vector_database_connection_info, '{{}}'),
|
||||
created_at,
|
||||
updated_at
|
||||
FROM {TABLE_NAME}
|
||||
""")
|
||||
)
|
||||
|
||||
# Drop old table
|
||||
op.drop_table(TABLE_NAME)
|
||||
|
||||
# Rename new table
|
||||
op.rename_table(f"{TABLE_NAME}_new", TABLE_NAME)
|
||||
|
||||
|
||||
def _recreate_table_with_unique_constraint_sqlite(op, insp):
|
||||
"""
|
||||
SQLite cannot drop unique constraints on individual columns. We must:
|
||||
1. Create a new table without the unique constraints.
|
||||
2. Copy data from the old table.
|
||||
3. Drop the old table.
|
||||
4. Rename the new table.
|
||||
"""
|
||||
conn = op.get_bind()
|
||||
|
||||
# Create new table definition (without unique constraints)
|
||||
op.create_table(
|
||||
f"{TABLE_NAME}_new",
|
||||
sa.Column("owner_id", sa.UUID()),
|
||||
sa.Column("dataset_id", sa.UUID(), primary_key=True, nullable=False),
|
||||
sa.Column("vector_database_name", sa.String(), nullable=False, unique=True),
|
||||
sa.Column("graph_database_name", sa.String(), nullable=False, unique=True),
|
||||
sa.Column("vector_database_provider", sa.String(), nullable=False),
|
||||
sa.Column("graph_database_provider", sa.String(), nullable=False),
|
||||
sa.Column(
|
||||
"vector_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="lancedb",
|
||||
),
|
||||
sa.Column(
|
||||
"graph_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="kuzu",
|
||||
),
|
||||
sa.Column("vector_database_url", sa.String()),
|
||||
sa.Column("graph_database_url", sa.String()),
|
||||
sa.Column("vector_database_key", sa.String()),
|
||||
sa.Column("graph_database_key", sa.String()),
|
||||
sa.Column(
|
||||
"graph_database_connection_info",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
sa.Column(
|
||||
"vector_database_connection_info",
|
||||
sa.JSON(),
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
sa.Column("created_at", sa.DateTime()),
|
||||
sa.Column("updated_at", sa.DateTime()),
|
||||
sa.ForeignKeyConstraint(["dataset_id"], ["datasets.id"], ondelete="CASCADE"),
|
||||
sa.ForeignKeyConstraint(["owner_id"], ["principals.id"], ondelete="CASCADE"),
|
||||
)
|
||||
|
||||
# Copy data into new table
|
||||
conn.execute(
|
||||
sa.text(f"""
|
||||
INSERT INTO {TABLE_NAME}_new
|
||||
SELECT
|
||||
owner_id,
|
||||
dataset_id,
|
||||
vector_database_name,
|
||||
graph_database_name,
|
||||
vector_database_provider,
|
||||
graph_database_provider,
|
||||
vector_dataset_database_handler,
|
||||
graph_dataset_database_handler,
|
||||
vector_database_url,
|
||||
graph_database_url,
|
||||
vector_database_key,
|
||||
graph_database_key,
|
||||
COALESCE(graph_database_connection_info, '{{}}'),
|
||||
COALESCE(vector_database_connection_info, '{{}}'),
|
||||
created_at,
|
||||
updated_at
|
||||
FROM {TABLE_NAME}
|
||||
""")
|
||||
)
|
||||
|
||||
# Drop old table
|
||||
op.drop_table(TABLE_NAME)
|
||||
|
||||
# Rename new table
|
||||
op.rename_table(f"{TABLE_NAME}_new", TABLE_NAME)
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
unique_constraints = insp.get_unique_constraints(TABLE_NAME)
|
||||
|
||||
vector_database_connection_info_column = _get_column(
|
||||
insp, "dataset_database", "vector_database_connection_info"
|
||||
)
|
||||
if not vector_database_connection_info_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"vector_database_connection_info",
|
||||
sa.JSON(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
)
|
||||
|
||||
vector_dataset_database_handler = _get_column(
|
||||
insp, "dataset_database", "vector_dataset_database_handler"
|
||||
)
|
||||
if not vector_dataset_database_handler:
|
||||
# Add LanceDB as the default graph dataset database handler
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"vector_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="lancedb",
|
||||
),
|
||||
)
|
||||
|
||||
graph_database_connection_info_column = _get_column(
|
||||
insp, "dataset_database", "graph_database_connection_info"
|
||||
)
|
||||
if not graph_database_connection_info_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"graph_database_connection_info",
|
||||
sa.JSON(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default=sa.text("'{}'"),
|
||||
),
|
||||
)
|
||||
|
||||
graph_dataset_database_handler = _get_column(
|
||||
insp, "dataset_database", "graph_dataset_database_handler"
|
||||
)
|
||||
if not graph_dataset_database_handler:
|
||||
# Add Kuzu as the default graph dataset database handler
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"graph_dataset_database_handler",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="kuzu",
|
||||
),
|
||||
)
|
||||
|
||||
with op.batch_alter_table("dataset_database", schema=None) as batch_op:
|
||||
# Drop the unique constraint to make unique=False
|
||||
graph_constraint_to_drop = None
|
||||
for uc in unique_constraints:
|
||||
# Check if the constraint covers ONLY the target column
|
||||
if uc["name"] == graph_constraint_name:
|
||||
graph_constraint_to_drop = uc["name"]
|
||||
break
|
||||
|
||||
vector_constraint_to_drop = None
|
||||
for uc in unique_constraints:
|
||||
# Check if the constraint covers ONLY the target column
|
||||
if uc["name"] == vector_constraint_name:
|
||||
vector_constraint_to_drop = uc["name"]
|
||||
break
|
||||
|
||||
if (
|
||||
vector_constraint_to_drop
|
||||
and graph_constraint_to_drop
|
||||
and op.get_context().dialect.name == "postgresql"
|
||||
):
|
||||
# PostgreSQL
|
||||
batch_op.drop_constraint(graph_constraint_name, type_="unique")
|
||||
batch_op.drop_constraint(vector_constraint_name, type_="unique")
|
||||
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
conn = op.get_bind()
|
||||
# Fun fact: SQLite has hidden auto indexes for unique constraints that can't be dropped or accessed directly
|
||||
# So we need to check for them and drop them by recreating the table (altering column also won't work)
|
||||
result = conn.execute(sa.text("PRAGMA index_list('dataset_database')"))
|
||||
rows = result.fetchall()
|
||||
unique_auto_indexes = [row for row in rows if row[3] == "u"]
|
||||
for row in unique_auto_indexes:
|
||||
result = conn.execute(sa.text(f"PRAGMA index_info('{row[1]}')"))
|
||||
index_info = result.fetchall()
|
||||
if index_info[0][2] == "vector_database_name":
|
||||
# In case a unique index exists on vector_database_name, drop it and the graph_database_name one
|
||||
_recreate_table_without_unique_constraint_sqlite(op, insp)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
_recreate_table_with_unique_constraint_sqlite(op, insp)
|
||||
elif op.get_context().dialect.name == "postgresql":
|
||||
with op.batch_alter_table("dataset_database", schema=None) as batch_op:
|
||||
# Re-add the unique constraint to return to unique=True
|
||||
batch_op.create_unique_constraint(graph_constraint_name, ["graph_database_name"])
|
||||
|
||||
with op.batch_alter_table("dataset_database", schema=None) as batch_op:
|
||||
# Re-add the unique constraint to return to unique=True
|
||||
batch_op.create_unique_constraint(vector_constraint_name, ["vector_database_name"])
|
||||
|
||||
op.drop_column("dataset_database", "vector_database_connection_info")
|
||||
op.drop_column("dataset_database", "graph_database_connection_info")
|
||||
op.drop_column("dataset_database", "vector_dataset_database_handler")
|
||||
op.drop_column("dataset_database", "graph_dataset_database_handler")
|
||||
|
|
@ -23,8 +23,11 @@ depends_on: Union[str, Sequence[str], None] = "8057ae7329c2"
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
try:
|
||||
await_only(create_default_user())
|
||||
except UserAlreadyExists:
|
||||
pass # It's fine if the default user already exists
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
await_only(delete_user("default_user@example.com"))
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
"""Expand dataset database for multi user
|
||||
|
||||
Revision ID: 76625596c5c3
|
||||
Revises: 211ab850ef3d
|
||||
Create Date: 2025-10-30 12:55:20.239562
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "76625596c5c3"
|
||||
down_revision: Union[str, None] = "c946955da633"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
vector_database_provider_column = _get_column(
|
||||
insp, "dataset_database", "vector_database_provider"
|
||||
)
|
||||
if not vector_database_provider_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"vector_database_provider",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="lancedb",
|
||||
),
|
||||
)
|
||||
|
||||
graph_database_provider_column = _get_column(
|
||||
insp, "dataset_database", "graph_database_provider"
|
||||
)
|
||||
if not graph_database_provider_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column(
|
||||
"graph_database_provider",
|
||||
sa.String(),
|
||||
unique=False,
|
||||
nullable=False,
|
||||
server_default="kuzu",
|
||||
),
|
||||
)
|
||||
|
||||
vector_database_url_column = _get_column(insp, "dataset_database", "vector_database_url")
|
||||
if not vector_database_url_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column("vector_database_url", sa.String(), unique=False, nullable=True),
|
||||
)
|
||||
|
||||
graph_database_url_column = _get_column(insp, "dataset_database", "graph_database_url")
|
||||
if not graph_database_url_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column("graph_database_url", sa.String(), unique=False, nullable=True),
|
||||
)
|
||||
|
||||
vector_database_key_column = _get_column(insp, "dataset_database", "vector_database_key")
|
||||
if not vector_database_key_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column("vector_database_key", sa.String(), unique=False, nullable=True),
|
||||
)
|
||||
|
||||
graph_database_key_column = _get_column(insp, "dataset_database", "graph_database_key")
|
||||
if not graph_database_key_column:
|
||||
op.add_column(
|
||||
"dataset_database",
|
||||
sa.Column("graph_database_key", sa.String(), unique=False, nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("dataset_database", "vector_database_provider")
|
||||
op.drop_column("dataset_database", "graph_database_provider")
|
||||
op.drop_column("dataset_database", "vector_database_url")
|
||||
op.drop_column("dataset_database", "graph_database_url")
|
||||
op.drop_column("dataset_database", "vector_database_key")
|
||||
op.drop_column("dataset_database", "graph_database_key")
|
||||
|
|
@ -18,8 +18,10 @@ depends_on: Union[str, Sequence[str], None] = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
db_engine = get_relational_engine()
|
||||
await_only(db_engine.create_database())
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
db_engine = get_relational_engine()
|
||||
await_only(db_engine.delete_database())
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
"""loader_separation
|
||||
|
||||
Revision ID: 9e7a3cb85175
|
||||
Revises: 1daae0df1866
|
||||
Create Date: 2025-08-14 19:18:11.406907
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "9e7a3cb85175"
|
||||
down_revision: Union[str, None] = "1daae0df1866"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
# Define table with all necessary columns including primary key
|
||||
data = sa.table(
|
||||
"data",
|
||||
sa.Column("id", sa.UUID, primary_key=True), # Critical for SQLite
|
||||
sa.Column("original_extension", sa.String()),
|
||||
sa.Column("original_mime_type", sa.String()),
|
||||
sa.Column("original_data_location", sa.String()),
|
||||
sa.Column("extension", sa.String()),
|
||||
sa.Column("mime_type", sa.String()),
|
||||
sa.Column("raw_data_location", sa.String()),
|
||||
)
|
||||
|
||||
original_extension_column = _get_column(insp, "data", "original_extension")
|
||||
if not original_extension_column:
|
||||
op.add_column("data", sa.Column("original_extension", sa.String(), nullable=True))
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
# If column doesn't exist create new original_extension column and update from values of extension column
|
||||
with op.batch_alter_table("data") as batch_op:
|
||||
batch_op.execute(
|
||||
data.update().values(
|
||||
original_extension=data.c.extension,
|
||||
)
|
||||
)
|
||||
else:
|
||||
conn = op.get_bind()
|
||||
conn.execute(data.update().values(original_extension=data.c.extension))
|
||||
|
||||
original_mime_type = _get_column(insp, "data", "original_mime_type")
|
||||
if not original_mime_type:
|
||||
# If column doesn't exist create new original_mime_type column and update from values of mime_type column
|
||||
op.add_column("data", sa.Column("original_mime_type", sa.String(), nullable=True))
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
with op.batch_alter_table("data") as batch_op:
|
||||
batch_op.execute(
|
||||
data.update().values(
|
||||
original_mime_type=data.c.mime_type,
|
||||
)
|
||||
)
|
||||
else:
|
||||
conn = op.get_bind()
|
||||
conn.execute(data.update().values(original_mime_type=data.c.mime_type))
|
||||
|
||||
loader_engine = _get_column(insp, "data", "loader_engine")
|
||||
if not loader_engine:
|
||||
op.add_column("data", sa.Column("loader_engine", sa.String(), nullable=True))
|
||||
|
||||
original_data_location = _get_column(insp, "data", "original_data_location")
|
||||
if not original_data_location:
|
||||
# If column doesn't exist create new original data column and update from values of raw_data_location column
|
||||
op.add_column("data", sa.Column("original_data_location", sa.String(), nullable=True))
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
with op.batch_alter_table("data") as batch_op:
|
||||
batch_op.execute(
|
||||
data.update().values(
|
||||
original_data_location=data.c.raw_data_location,
|
||||
)
|
||||
)
|
||||
else:
|
||||
conn = op.get_bind()
|
||||
conn.execute(data.update().values(original_data_location=data.c.raw_data_location))
|
||||
|
||||
raw_content_hash = _get_column(insp, "data", "raw_content_hash")
|
||||
if not raw_content_hash:
|
||||
op.add_column("data", sa.Column("raw_content_hash", sa.String(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("data", "raw_content_hash")
|
||||
op.drop_column("data", "original_data_location")
|
||||
op.drop_column("data", "loader_engine")
|
||||
op.drop_column("data", "original_mime_type")
|
||||
op.drop_column("data", "original_extension")
|
||||
|
|
@ -144,58 +144,44 @@ def _create_data_permission(conn, user_id, data_id, permission_name):
|
|||
)
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
dataset_id_column = _get_column(insp, "acls", "dataset_id")
|
||||
if not dataset_id_column:
|
||||
# Recreate ACLs table with default permissions set to datasets instead of documents
|
||||
op.drop_table("acls")
|
||||
# Recreate ACLs table with default permissions set to datasets instead of documents
|
||||
op.drop_table("acls")
|
||||
|
||||
acls_table = op.create_table(
|
||||
"acls",
|
||||
sa.Column("id", UUID, primary_key=True, default=uuid4),
|
||||
sa.Column(
|
||||
"created_at", sa.DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
onupdate=lambda: datetime.now(timezone.utc),
|
||||
),
|
||||
sa.Column("principal_id", UUID, sa.ForeignKey("principals.id")),
|
||||
sa.Column("permission_id", UUID, sa.ForeignKey("permissions.id")),
|
||||
sa.Column("dataset_id", UUID, sa.ForeignKey("datasets.id", ondelete="CASCADE")),
|
||||
)
|
||||
acls_table = op.create_table(
|
||||
"acls",
|
||||
sa.Column("id", UUID, primary_key=True, default=uuid4),
|
||||
sa.Column(
|
||||
"created_at", sa.DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at", sa.DateTime(timezone=True), onupdate=lambda: datetime.now(timezone.utc)
|
||||
),
|
||||
sa.Column("principal_id", UUID, sa.ForeignKey("principals.id")),
|
||||
sa.Column("permission_id", UUID, sa.ForeignKey("permissions.id")),
|
||||
sa.Column("dataset_id", UUID, sa.ForeignKey("datasets.id", ondelete="CASCADE")),
|
||||
)
|
||||
|
||||
# Note: We can't use any Cognee model info to gather data (as it can change) in database so we must use our own table
|
||||
# definition or load what is in the database
|
||||
dataset_table = _define_dataset_table()
|
||||
datasets = conn.execute(sa.select(dataset_table)).fetchall()
|
||||
# Note: We can't use any Cognee model info to gather data (as it can change) in database so we must use our own table
|
||||
# definition or load what is in the database
|
||||
dataset_table = _define_dataset_table()
|
||||
datasets = conn.execute(sa.select(dataset_table)).fetchall()
|
||||
|
||||
if not datasets:
|
||||
return
|
||||
if not datasets:
|
||||
return
|
||||
|
||||
acl_list = []
|
||||
acl_list = []
|
||||
|
||||
for dataset in datasets:
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "read"))
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "write"))
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "share"))
|
||||
acl_list.append(
|
||||
_create_dataset_permission(conn, dataset.owner_id, dataset.id, "delete")
|
||||
)
|
||||
for dataset in datasets:
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "read"))
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "write"))
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "share"))
|
||||
acl_list.append(_create_dataset_permission(conn, dataset.owner_id, dataset.id, "delete"))
|
||||
|
||||
if acl_list:
|
||||
op.bulk_insert(acls_table, acl_list)
|
||||
if acl_list:
|
||||
op.bulk_insert(acls_table, acl_list)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
"""kuzu-11-migration
|
||||
|
||||
Revision ID: b9274c27a25a
|
||||
Revises: e4ebee1091e7
|
||||
Create Date: 2025-07-24 17:11:52.174737
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Sequence, Union
|
||||
|
||||
from cognee.infrastructure.databases.graph.kuzu.kuzu_migrate import (
|
||||
kuzu_migration,
|
||||
read_kuzu_storage_version,
|
||||
)
|
||||
import kuzu
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "b9274c27a25a"
|
||||
down_revision: Union[str, None] = "e4ebee1091e7"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# This migration is only for multi-user Cognee mode
|
||||
if os.getenv("ENABLE_BACKEND_ACCESS_CONTROL", "false").lower() == "true":
|
||||
from cognee.base_config import get_base_config
|
||||
|
||||
base_config = get_base_config()
|
||||
|
||||
databases_root = os.path.join(base_config.system_root_directory, "databases")
|
||||
if not os.path.isdir(databases_root):
|
||||
raise FileNotFoundError(f"Directory not found: {databases_root}")
|
||||
|
||||
for current_path, dirnames, _ in os.walk(databases_root):
|
||||
# If file is kuzu graph database
|
||||
if ".pkl" in current_path[-4:]:
|
||||
kuzu_db_version = read_kuzu_storage_version(current_path)
|
||||
if (
|
||||
kuzu_db_version == "0.9.0" or kuzu_db_version == "0.8.2"
|
||||
) and kuzu_db_version != kuzu.__version__:
|
||||
# Try to migrate kuzu database to latest version
|
||||
kuzu_migration(
|
||||
new_db=current_path + "_new",
|
||||
old_db=current_path,
|
||||
new_version=kuzu.__version__,
|
||||
old_version=kuzu_db_version,
|
||||
overwrite=True,
|
||||
)
|
||||
else:
|
||||
from cognee.infrastructure.databases.graph import get_graph_config
|
||||
|
||||
graph_config = get_graph_config()
|
||||
if graph_config.graph_database_provider.lower() == "kuzu":
|
||||
if os.path.exists(graph_config.graph_file_path):
|
||||
kuzu_db_version = read_kuzu_storage_version(graph_config.graph_file_path)
|
||||
if (
|
||||
kuzu_db_version == "0.9.0" or kuzu_db_version == "0.8.2"
|
||||
) and kuzu_db_version != kuzu.__version__:
|
||||
# Try to migrate kuzu database to latest version
|
||||
kuzu_migration(
|
||||
new_db=graph_config.graph_file_path + "_new",
|
||||
old_db=graph_config.graph_file_path,
|
||||
new_version=kuzu.__version__,
|
||||
old_version=kuzu_db_version,
|
||||
overwrite=True,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# To downgrade you will have to manually change the backup old kuzu graph databases
|
||||
# stored in the user folder to its previous name and remove the new kuzu graph
|
||||
# database that replaced it
|
||||
pass
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
"""Multi Tenant Support
|
||||
|
||||
Revision ID: c946955da633
|
||||
Revises: 211ab850ef3d
|
||||
Create Date: 2025-11-04 18:11:09.325158
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
from datetime import datetime, timezone
|
||||
from uuid import uuid4
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "c946955da633"
|
||||
down_revision: Union[str, None] = "211ab850ef3d"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _now():
|
||||
return datetime.now(timezone.utc)
|
||||
|
||||
|
||||
def _define_user_table() -> sa.Table:
|
||||
table = sa.Table(
|
||||
"users",
|
||||
sa.MetaData(),
|
||||
sa.Column(
|
||||
"id",
|
||||
sa.UUID,
|
||||
sa.ForeignKey("principals.id", ondelete="CASCADE"),
|
||||
primary_key=True,
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("tenant_id", sa.UUID, sa.ForeignKey("tenants.id"), index=True, nullable=True),
|
||||
)
|
||||
return table
|
||||
|
||||
|
||||
def _define_dataset_table() -> sa.Table:
|
||||
# Note: We can't use any Cognee model info to gather data (as it can change) in database so we must use our own table
|
||||
# definition or load what is in the database
|
||||
table = sa.Table(
|
||||
"datasets",
|
||||
sa.MetaData(),
|
||||
sa.Column("id", sa.UUID, primary_key=True, default=uuid4),
|
||||
sa.Column("name", sa.Text),
|
||||
sa.Column(
|
||||
"created_at",
|
||||
sa.DateTime(timezone=True),
|
||||
default=lambda: datetime.now(timezone.utc),
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
onupdate=lambda: datetime.now(timezone.utc),
|
||||
),
|
||||
sa.Column("owner_id", sa.UUID(), sa.ForeignKey("principals.id"), index=True),
|
||||
sa.Column("tenant_id", sa.UUID(), sa.ForeignKey("tenants.id"), index=True, nullable=True),
|
||||
)
|
||||
|
||||
return table
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
|
||||
dataset = _define_dataset_table()
|
||||
user = _define_user_table()
|
||||
|
||||
if "user_tenants" not in insp.get_table_names():
|
||||
# Define table with all necessary columns including primary key
|
||||
user_tenants = op.create_table(
|
||||
"user_tenants",
|
||||
sa.Column("user_id", sa.UUID, sa.ForeignKey("users.id"), primary_key=True),
|
||||
sa.Column("tenant_id", sa.UUID, sa.ForeignKey("tenants.id"), primary_key=True),
|
||||
sa.Column(
|
||||
"created_at", sa.DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||
),
|
||||
)
|
||||
|
||||
# Get all users with their tenant_id
|
||||
user_data = conn.execute(
|
||||
sa.select(user.c.id, user.c.tenant_id).where(user.c.tenant_id.isnot(None))
|
||||
).fetchall()
|
||||
|
||||
# Insert into user_tenants table
|
||||
if user_data:
|
||||
op.bulk_insert(
|
||||
user_tenants,
|
||||
[
|
||||
{"user_id": user_id, "tenant_id": tenant_id, "created_at": _now()}
|
||||
for user_id, tenant_id in user_data
|
||||
],
|
||||
)
|
||||
|
||||
tenant_id_column = _get_column(insp, "datasets", "tenant_id")
|
||||
if not tenant_id_column:
|
||||
op.add_column("datasets", sa.Column("tenant_id", sa.UUID(), nullable=True))
|
||||
|
||||
# Build subquery, select users.tenant_id for each dataset.owner_id
|
||||
tenant_id_from_dataset_owner = (
|
||||
sa.select(user.c.tenant_id).where(user.c.id == dataset.c.owner_id).scalar_subquery()
|
||||
)
|
||||
|
||||
if op.get_context().dialect.name == "sqlite":
|
||||
# If column doesn't exist create new original_extension column and update from values of extension column
|
||||
with op.batch_alter_table("datasets") as batch_op:
|
||||
batch_op.execute(
|
||||
dataset.update().values(
|
||||
tenant_id=tenant_id_from_dataset_owner,
|
||||
)
|
||||
)
|
||||
else:
|
||||
conn = op.get_bind()
|
||||
conn.execute(dataset.update().values(tenant_id=tenant_id_from_dataset_owner))
|
||||
|
||||
op.create_index(op.f("ix_datasets_tenant_id"), "datasets", ["tenant_id"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table("user_tenants")
|
||||
op.drop_index(op.f("ix_datasets_tenant_id"), table_name="datasets")
|
||||
op.drop_column("datasets", "tenant_id")
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
"""Expand data model info
|
||||
|
||||
Revision ID: e4ebee1091e7
|
||||
Revises: ab7e313804ae
|
||||
Create Date: 2025-07-24 13:21:30.738486
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "e4ebee1091e7"
|
||||
down_revision: Union[str, None] = "ab7e313804ae"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def _get_column(inspector, table, name, schema=None):
|
||||
for col in inspector.get_columns(table, schema=schema):
|
||||
if col["name"] == name:
|
||||
return col
|
||||
return None
|
||||
|
||||
|
||||
def _index_exists(inspector, table, name, schema=None):
|
||||
return any(ix["name"] == name for ix in inspector.get_indexes(table, schema=schema))
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
TABLES_TO_DROP = [
|
||||
"file_metadata",
|
||||
"_dlt_loads",
|
||||
"_dlt_version",
|
||||
"_dlt_pipeline_state",
|
||||
]
|
||||
|
||||
conn = op.get_bind()
|
||||
insp = sa.inspect(conn)
|
||||
existing = set(insp.get_table_names())
|
||||
|
||||
for tbl in TABLES_TO_DROP:
|
||||
if tbl in existing:
|
||||
op.drop_table(tbl)
|
||||
|
||||
DATA_TABLE = "data"
|
||||
DATA_TENANT_COL = "tenant_id"
|
||||
DATA_SIZE_COL = "data_size"
|
||||
DATA_TENANT_IDX = "ix_data_tenant_id"
|
||||
|
||||
# --- tenant_id ---
|
||||
col = _get_column(insp, DATA_TABLE, DATA_TENANT_COL)
|
||||
if col is None:
|
||||
op.add_column(
|
||||
DATA_TABLE,
|
||||
sa.Column(DATA_TENANT_COL, postgresql.UUID(as_uuid=True), nullable=True),
|
||||
)
|
||||
else:
|
||||
# Column exists – fix nullability if needed
|
||||
if col.get("nullable", True) is False:
|
||||
op.alter_column(
|
||||
DATA_TABLE,
|
||||
DATA_TENANT_COL,
|
||||
existing_type=postgresql.UUID(as_uuid=True),
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# --- data_size ---
|
||||
col = _get_column(insp, DATA_TABLE, DATA_SIZE_COL)
|
||||
if col is None:
|
||||
op.add_column(DATA_TABLE, sa.Column(DATA_SIZE_COL, sa.Integer(), nullable=True))
|
||||
else:
|
||||
# If you also need to change nullability for data_size, do it here
|
||||
if col.get("nullable", True) is False:
|
||||
op.alter_column(
|
||||
DATA_TABLE,
|
||||
DATA_SIZE_COL,
|
||||
existing_type=sa.Integer(),
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# --- index on tenant_id ---
|
||||
if not _index_exists(insp, DATA_TABLE, DATA_TENANT_IDX):
|
||||
op.create_index(DATA_TENANT_IDX, DATA_TABLE, [DATA_TENANT_COL], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_data_tenant_id"), table_name="data")
|
||||
op.drop_column("data", "data_size")
|
||||
op.drop_column("data", "tenant_id")
|
||||
op.create_table(
|
||||
"_dlt_pipeline_state",
|
||||
sa.Column("version", sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("engine_version", sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("pipeline_name", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("state", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column(
|
||||
"created_at", postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("version_hash", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("_dlt_load_id", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("_dlt_id", sa.VARCHAR(length=128), autoincrement=False, nullable=False),
|
||||
)
|
||||
op.create_table(
|
||||
"_dlt_version",
|
||||
sa.Column("version", sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("engine_version", sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column(
|
||||
"inserted_at", postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("schema_name", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("version_hash", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("schema", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
)
|
||||
op.create_table(
|
||||
"_dlt_loads",
|
||||
sa.Column("load_id", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("schema_name", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("status", sa.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column(
|
||||
"inserted_at", postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("schema_version_hash", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.create_table(
|
||||
"file_metadata",
|
||||
sa.Column("id", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("name", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("file_path", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("extension", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("mime_type", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("content_hash", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("owner_id", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column("_dlt_load_id", sa.TEXT(), autoincrement=False, nullable=False),
|
||||
sa.Column("_dlt_id", sa.VARCHAR(length=128), autoincrement=False, nullable=False),
|
||||
sa.Column("node_set", sa.TEXT(), autoincrement=False, nullable=True),
|
||||
)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 446 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 2.3 MiB |
|
|
@ -1 +0,0 @@
|
|||
NEXT_PUBLIC_BACKEND_API_URL=http://localhost:8000/api
|
||||
|
|
@ -9,7 +9,7 @@ COPY package.json package-lock.json ./
|
|||
|
||||
# Install any needed packages specified in package.json
|
||||
RUN npm ci
|
||||
RUN npm rebuild lightningcss
|
||||
# RUN npm rebuild lightningcss
|
||||
|
||||
# Copy the rest of the application code to the working directory
|
||||
COPY src ./src
|
||||
|
|
|
|||
3379
cognee-frontend/package-lock.json
generated
3379
cognee-frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -9,13 +9,13 @@
|
|||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@auth0/nextjs-auth0": "^4.13.1",
|
||||
"@auth0/nextjs-auth0": "^4.6.0",
|
||||
"classnames": "^2.5.1",
|
||||
"culori": "^4.0.1",
|
||||
"d3-force-3d": "^3.0.6",
|
||||
"next": "16.1.1",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"next": "15.3.3",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-force-graph-2d": "^1.27.1",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
"@tailwindcss/postcss": "^4.1.7",
|
||||
"@types/culori": "^4.0.0",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "^16.0.4",
|
||||
"eslint-config-next": "^15.3.3",
|
||||
"eslint-config-prettier": "^10.1.5",
|
||||
"tailwindcss": "^4.1.7",
|
||||
"typescript": "^5"
|
||||
|
|
|
|||
1
cognee-frontend/public/next.svg
Normal file
1
cognee-frontend/public/next.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
cognee-frontend/public/vercel.svg
Normal file
1
cognee-frontend/public/vercel.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
||||
|
After Width: | Height: | Size: 629 B |
Binary file not shown.
|
|
@ -26,10 +26,9 @@ export interface NodesAndEdges {
|
|||
|
||||
interface CogneeAddWidgetProps {
|
||||
onData: (data: NodesAndLinks) => void;
|
||||
useCloud?: boolean;
|
||||
}
|
||||
|
||||
export default function CogneeAddWidget({ onData, useCloud = false }: CogneeAddWidgetProps) {
|
||||
export default function CogneeAddWidget({ onData }: CogneeAddWidgetProps) {
|
||||
const {
|
||||
datasets,
|
||||
refreshDatasets,
|
||||
|
|
@ -77,18 +76,17 @@ export default function CogneeAddWidget({ onData, useCloud = false }: CogneeAddW
|
|||
|
||||
return addData(dataset, files)
|
||||
.then(() => {
|
||||
// const onUpdate = (data: NodesAndEdges) => {
|
||||
// onData({
|
||||
// nodes: data.nodes,
|
||||
// links: data.edges,
|
||||
// });
|
||||
// setProcessingFilesDone();
|
||||
// };
|
||||
const onUpdate = (data: NodesAndEdges) => {
|
||||
onData({
|
||||
nodes: data.nodes,
|
||||
links: data.edges,
|
||||
});
|
||||
setProcessingFilesDone();
|
||||
};
|
||||
|
||||
return cognifyDataset(dataset, useCloud)
|
||||
return cognifyDataset(dataset, onUpdate)
|
||||
.then(() => {
|
||||
refreshDatasets();
|
||||
setProcessingFilesDone();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
116
cognee-frontend/src/app/(graph)/CrewAITrigger.tsx
Normal file
116
cognee-frontend/src/app/(graph)/CrewAITrigger.tsx
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import { useState } from "react";
|
||||
import { fetch } from "@/utils";
|
||||
import { v4 as uuid4 } from "uuid";
|
||||
import { LoadingIndicator } from "@/ui/App";
|
||||
import { CTAButton, Input } from "@/ui/elements";
|
||||
|
||||
interface CrewAIFormPayload extends HTMLFormElement {
|
||||
username1: HTMLInputElement;
|
||||
username2: HTMLInputElement;
|
||||
}
|
||||
|
||||
interface CrewAITriggerProps {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
onData: (data: any) => void;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
onActivity: (activities: any) => void;
|
||||
}
|
||||
|
||||
export default function CrewAITrigger({ onData, onActivity }: CrewAITriggerProps) {
|
||||
const [isCrewAIRunning, setIsCrewAIRunning] = useState(false);
|
||||
|
||||
const handleRunCrewAI = (event: React.FormEvent<CrewAIFormPayload>) => {
|
||||
event.preventDefault();
|
||||
const formElements = event.currentTarget;
|
||||
|
||||
const crewAIConfig = {
|
||||
username1: formElements.username1.value,
|
||||
username2: formElements.username2.value,
|
||||
};
|
||||
|
||||
const websocket = new WebSocket("ws://localhost:8000/api/v1/crewai/subscribe");
|
||||
|
||||
onActivity([{ id: uuid4(), timestamp: Date.now(), activity: "Dispatching hiring crew agents" }]);
|
||||
|
||||
websocket.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
|
||||
if (data.status === "PipelineRunActivity") {
|
||||
onActivity([data.payload]);
|
||||
return;
|
||||
}
|
||||
|
||||
onData({
|
||||
nodes: data.payload.nodes,
|
||||
links: data.payload.edges,
|
||||
});
|
||||
|
||||
const nodes_type_map: { [key: string]: number } = {};
|
||||
|
||||
for (let i = 0; i < data.payload.nodes.length; i++) {
|
||||
const node = data.payload.nodes[i];
|
||||
if (!nodes_type_map[node.type]) {
|
||||
nodes_type_map[node.type] = 0;
|
||||
}
|
||||
nodes_type_map[node.type] += 1;
|
||||
}
|
||||
|
||||
const activityMessage = Object.entries(nodes_type_map).reduce((message, [type, count]) => {
|
||||
return `${message}\n | ${type}: ${count}`;
|
||||
}, "Graph updated:");
|
||||
|
||||
onActivity([{
|
||||
id: uuid4(),
|
||||
timestamp: Date.now(),
|
||||
activity: activityMessage,
|
||||
}]);
|
||||
|
||||
if (data.status === "PipelineRunCompleted") {
|
||||
websocket.close();
|
||||
}
|
||||
};
|
||||
|
||||
onData(null);
|
||||
setIsCrewAIRunning(true);
|
||||
|
||||
return fetch("/v1/crewai/run", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(crewAIConfig),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(() => {
|
||||
onActivity([{ id: uuid4(), timestamp: Date.now(), activity: "Hiring crew agents made a decision" }]);
|
||||
})
|
||||
.catch(() => {
|
||||
onActivity([{ id: uuid4(), timestamp: Date.now(), activity: "Hiring crew agents had problems while executing" }]);
|
||||
})
|
||||
.finally(() => {
|
||||
websocket.close();
|
||||
setIsCrewAIRunning(false);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<form className="w-full flex flex-col gap-2" onSubmit={handleRunCrewAI}>
|
||||
<h1 className="text-2xl text-white">Cognee Dev Mexican Standoff</h1>
|
||||
<span className="text-white">Agents compare GitHub profiles, and make a decision who is a better developer</span>
|
||||
<div className="flex flex-row gap-2">
|
||||
<div className="flex flex-col w-full flex-1/2">
|
||||
<label className="block mb-1 text-white" htmlFor="username1">GitHub username</label>
|
||||
<Input name="username1" type="text" placeholder="Github Username" required defaultValue="hajdul88" />
|
||||
</div>
|
||||
<div className="flex flex-col w-full flex-1/2">
|
||||
<label className="block mb-1 text-white" htmlFor="username2">GitHub username</label>
|
||||
<Input name="username2" type="text" placeholder="Github Username" required defaultValue="lxobr" />
|
||||
</div>
|
||||
</div>
|
||||
<CTAButton type="submit" disabled={isCrewAIRunning} className="whitespace-nowrap">
|
||||
Start Mexican Standoff
|
||||
{isCrewAIRunning && <LoadingIndicator />}
|
||||
</CTAButton>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import { NodeObject, LinkObject } from "react-force-graph-2d";
|
|||
import { ChangeEvent, useEffect, useImperativeHandle, useRef, useState } from "react";
|
||||
|
||||
import { DeleteIcon } from "@/ui/Icons";
|
||||
// import { FeedbackForm } from "@/ui/Partials";
|
||||
import { CTAButton, Input, NeutralButton, Select } from "@/ui/elements";
|
||||
|
||||
interface GraphControlsProps {
|
||||
|
|
@ -110,7 +111,7 @@ export default function GraphControls({ data, isAddNodeFormOpen, onGraphShapeCha
|
|||
};
|
||||
|
||||
const [isAuthShapeChangeEnabled, setIsAuthShapeChangeEnabled] = useState(true);
|
||||
const shapeChangeTimeout = useRef<number | null>(null);
|
||||
const shapeChangeTimeout = useRef<number | null>();
|
||||
|
||||
useEffect(() => {
|
||||
onGraphShapeChange(DEFAULT_GRAPH_SHAPE);
|
||||
|
|
@ -229,6 +230,12 @@ export default function GraphControls({ data, isAddNodeFormOpen, onGraphShapeCha
|
|||
)}
|
||||
</>
|
||||
{/* )} */}
|
||||
|
||||
{/* {selectedTab === "feedback" && (
|
||||
<div className="flex flex-col gap-2">
|
||||
<FeedbackForm onSuccess={() => {}} />
|
||||
</div>
|
||||
)} */}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import { useCallback, useRef, useState, RefObject } from "react";
|
||||
import { useCallback, useRef, useState, MutableRefObject } from "react";
|
||||
|
||||
import Link from "next/link";
|
||||
import { TextLogo } from "@/ui/App";
|
||||
|
|
@ -47,11 +47,11 @@ export default function GraphView() {
|
|||
updateData(newData);
|
||||
}, []);
|
||||
|
||||
const graphRef = useRef<GraphVisualizationAPI>(null);
|
||||
const graphRef = useRef<GraphVisualizationAPI>();
|
||||
|
||||
const graphControls = useRef<GraphControlsAPI>(null);
|
||||
const graphControls = useRef<GraphControlsAPI>();
|
||||
|
||||
const activityLog = useRef<ActivityLogAPI>(null);
|
||||
const activityLog = useRef<ActivityLogAPI>();
|
||||
|
||||
return (
|
||||
<main className="flex flex-col h-full">
|
||||
|
|
@ -74,18 +74,21 @@ export default function GraphView() {
|
|||
<div className="w-full h-full relative overflow-hidden">
|
||||
<GraphVisualization
|
||||
key={data?.nodes.length}
|
||||
ref={graphRef as RefObject<GraphVisualizationAPI>}
|
||||
ref={graphRef as MutableRefObject<GraphVisualizationAPI>}
|
||||
data={data}
|
||||
graphControls={graphControls as RefObject<GraphControlsAPI>}
|
||||
graphControls={graphControls as MutableRefObject<GraphControlsAPI>}
|
||||
/>
|
||||
|
||||
<div className="absolute top-2 left-2 flex flex-col gap-2">
|
||||
<div className="bg-gray-500 pt-4 pr-4 pb-4 pl-4 rounded-md w-sm">
|
||||
<CogneeAddWidget onData={onDataChange} />
|
||||
</div>
|
||||
{/* <div className="bg-gray-500 pt-4 pr-4 pb-4 pl-4 rounded-md w-sm">
|
||||
<CrewAITrigger onData={onDataChange} onActivity={(activities) => activityLog.current?.updateActivityLog(activities)} />
|
||||
</div> */}
|
||||
<div className="bg-gray-500 pt-4 pr-4 pb-4 pl-4 rounded-md w-sm">
|
||||
<h2 className="text-xl text-white mb-4">Activity Log</h2>
|
||||
<ActivityLog ref={activityLog as RefObject<ActivityLogAPI>} />
|
||||
<ActivityLog ref={activityLog as MutableRefObject<ActivityLogAPI>} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -93,7 +96,7 @@ export default function GraphView() {
|
|||
<div className="bg-gray-500 pt-4 pr-4 pb-4 pl-4 rounded-md w-110">
|
||||
<GraphControls
|
||||
data={data}
|
||||
ref={graphControls as RefObject<GraphControlsAPI>}
|
||||
ref={graphControls as MutableRefObject<GraphControlsAPI>}
|
||||
isAddNodeFormOpen={isAddNodeFormOpen}
|
||||
onFitIntoView={() => graphRef.current!.zoomToFit(1000, 50)}
|
||||
onGraphShapeChange={(shape) => graphRef.current!.setGraphShape(shape)}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,15 @@
|
|||
"use client";
|
||||
|
||||
import classNames from "classnames";
|
||||
import { RefObject, useEffect, useImperativeHandle, useRef, useState, useCallback } from "react";
|
||||
import { MutableRefObject, useEffect, useImperativeHandle, useRef, useState } from "react";
|
||||
import { forceCollide, forceManyBody } from "d3-force-3d";
|
||||
import dynamic from "next/dynamic";
|
||||
import ForceGraph, { ForceGraphMethods, GraphData, LinkObject, NodeObject } from "react-force-graph-2d";
|
||||
import { GraphControlsAPI } from "./GraphControls";
|
||||
import getColorForNodeType from "./getColorForNodeType";
|
||||
|
||||
// Dynamically import ForceGraph to prevent SSR issues
|
||||
const ForceGraph = dynamic(() => import("react-force-graph-2d"), {
|
||||
ssr: false,
|
||||
loading: () => <div className="w-full h-full flex items-center justify-center">Loading graph...</div>
|
||||
});
|
||||
|
||||
import type { ForceGraphMethods, GraphData, LinkObject, NodeObject } from "react-force-graph-2d";
|
||||
|
||||
interface GraphVisuzaliationProps {
|
||||
ref: RefObject<GraphVisualizationAPI>;
|
||||
ref: MutableRefObject<GraphVisualizationAPI>;
|
||||
data?: GraphData<NodeObject, LinkObject>;
|
||||
graphControls: RefObject<GraphControlsAPI>;
|
||||
className?: string;
|
||||
graphControls: MutableRefObject<GraphControlsAPI>;
|
||||
}
|
||||
|
||||
export interface GraphVisualizationAPI {
|
||||
|
|
@ -27,50 +17,11 @@ export interface GraphVisualizationAPI {
|
|||
setGraphShape: (shape: string) => void;
|
||||
}
|
||||
|
||||
export default function GraphVisualization({ ref, data, graphControls, className }: GraphVisuzaliationProps) {
|
||||
export default function GraphVisualization({ ref, data, graphControls }: GraphVisuzaliationProps) {
|
||||
const textSize = 6;
|
||||
const nodeSize = 15;
|
||||
// const addNodeDistanceFromSourceNode = 15;
|
||||
|
||||
// State for tracking container dimensions
|
||||
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Handle resize
|
||||
const handleResize = useCallback(() => {
|
||||
if (containerRef.current) {
|
||||
const { clientWidth, clientHeight } = containerRef.current;
|
||||
setDimensions({ width: clientWidth, height: clientHeight });
|
||||
|
||||
// Trigger graph refresh after resize
|
||||
if (graphRef.current) {
|
||||
// Small delay to ensure DOM has updated
|
||||
setTimeout(() => {
|
||||
graphRef.current?.zoomToFit(1000,50);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Set up resize observer
|
||||
useEffect(() => {
|
||||
// Initial size calculation
|
||||
handleResize();
|
||||
|
||||
// ResizeObserver
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
handleResize();
|
||||
});
|
||||
|
||||
if (containerRef.current) {
|
||||
resizeObserver.observe(containerRef.current);
|
||||
}
|
||||
|
||||
return () => {
|
||||
resizeObserver.disconnect();
|
||||
};
|
||||
}, [handleResize]);
|
||||
|
||||
const handleNodeClick = (node: NodeObject) => {
|
||||
graphControls.current?.setSelectedNode(node);
|
||||
// ref.current?.d3ReheatSimulation()
|
||||
|
|
@ -205,68 +156,71 @@ export default function GraphVisualization({ ref, data, graphControls, className
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function handleDagError(loopNodeIds: (string | number)[]) {}
|
||||
|
||||
const graphRef = useRef<ForceGraphMethods>(null);
|
||||
const graphRef = useRef<ForceGraphMethods>();
|
||||
|
||||
useEffect(() => {
|
||||
if (data && graphRef.current) {
|
||||
if (typeof window !== "undefined" && data && graphRef.current) {
|
||||
// add collision force
|
||||
graphRef.current.d3Force("collision", forceCollide(nodeSize * 1.5));
|
||||
graphRef.current.d3Force("charge", forceManyBody().strength(-10).distanceMin(10).distanceMax(50));
|
||||
graphRef.current.d3Force("charge", forceManyBody().strength(-1500).distanceMin(300).distanceMax(900));
|
||||
}
|
||||
}, [data, graphRef]);
|
||||
|
||||
const [graphShape, setGraphShape] = useState<string>();
|
||||
|
||||
const zoomToFit: ForceGraphMethods["zoomToFit"] = (
|
||||
durationMs?: number,
|
||||
padding?: number,
|
||||
nodeFilter?: (node: NodeObject) => boolean
|
||||
) => {
|
||||
if (!graphRef.current) {
|
||||
console.warn("GraphVisualization: graphRef not ready yet");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return undefined as any;
|
||||
}
|
||||
|
||||
return graphRef.current.zoomToFit?.(durationMs, padding, nodeFilter);
|
||||
};
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
zoomToFit,
|
||||
setGraphShape,
|
||||
zoomToFit: graphRef.current!.zoomToFit,
|
||||
setGraphShape: setGraphShape,
|
||||
}));
|
||||
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className={classNames("w-full h-full", className)} id="graph-container">
|
||||
<ForceGraph
|
||||
ref={graphRef as RefObject<ForceGraphMethods>}
|
||||
width={dimensions.width}
|
||||
height={dimensions.height}
|
||||
dagMode={graphShape as unknown as undefined}
|
||||
dagLevelDistance={data ? 300 : 100}
|
||||
onDagError={handleDagError}
|
||||
graphData={data || {
|
||||
nodes: [{ id: 1, label: "Add" }, { id: 2, label: "Cognify" }, { id: 3, label: "Search" }],
|
||||
links: [{ source: 1, target: 2, label: "but don't forget to" }, { source: 2, target: 3, label: "and after that you can" }],
|
||||
}}
|
||||
<div className="w-full h-full" id="graph-container">
|
||||
{(data && typeof window !== "undefined") ? (
|
||||
<ForceGraph
|
||||
ref={graphRef}
|
||||
dagMode={graphShape as unknown as undefined}
|
||||
dagLevelDistance={300}
|
||||
onDagError={handleDagError}
|
||||
graphData={data}
|
||||
|
||||
nodeLabel="label"
|
||||
nodeRelSize={data ? nodeSize : 20}
|
||||
nodeCanvasObject={data ? renderNode : renderInitialNode}
|
||||
nodeCanvasObjectMode={() => data ? "replace" : "after"}
|
||||
nodeAutoColorBy={data ? undefined : "type"}
|
||||
nodeLabel="label"
|
||||
nodeRelSize={nodeSize}
|
||||
nodeCanvasObject={renderNode}
|
||||
nodeCanvasObjectMode={() => "replace"}
|
||||
|
||||
linkLabel="label"
|
||||
linkCanvasObject={renderLink}
|
||||
linkCanvasObjectMode={() => "after"}
|
||||
linkDirectionalArrowLength={3.5}
|
||||
linkDirectionalArrowRelPos={1}
|
||||
linkLabel="label"
|
||||
linkCanvasObject={renderLink}
|
||||
linkCanvasObjectMode={() => "after"}
|
||||
linkDirectionalArrowLength={3.5}
|
||||
linkDirectionalArrowRelPos={1}
|
||||
|
||||
onNodeClick={handleNodeClick}
|
||||
onBackgroundClick={handleBackgroundClick}
|
||||
d3VelocityDecay={data ? 0.3 : undefined}
|
||||
/>
|
||||
onNodeClick={handleNodeClick}
|
||||
onBackgroundClick={handleBackgroundClick}
|
||||
d3VelocityDecay={0.3}
|
||||
/>
|
||||
) : (
|
||||
<ForceGraph
|
||||
ref={graphRef}
|
||||
dagMode={graphShape as unknown as undefined}
|
||||
dagLevelDistance={100}
|
||||
graphData={{
|
||||
nodes: [{ id: 1, label: "Add" }, { id: 2, label: "Cognify" }, { id: 3, label: "Search" }],
|
||||
links: [{ source: 1, target: 2, label: "but don't forget to" }, { source: 2, target: 3, label: "and after that you can" }],
|
||||
}}
|
||||
|
||||
nodeLabel="label"
|
||||
nodeRelSize={20}
|
||||
nodeCanvasObject={renderInitialNode}
|
||||
nodeCanvasObjectMode={() => "after"}
|
||||
nodeAutoColorBy="type"
|
||||
|
||||
linkLabel="label"
|
||||
linkCanvasObject={renderLink}
|
||||
linkCanvasObjectMode={() => "after"}
|
||||
linkDirectionalArrowLength={3.5}
|
||||
linkDirectionalArrowRelPos={1}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@ import colors from "tailwindcss/colors";
|
|||
import { formatHex } from "culori";
|
||||
|
||||
const NODE_COLORS = {
|
||||
TextDocument: formatHex(colors.stone[200]),
|
||||
DocumentChunk: formatHex(colors.stone[300]),
|
||||
TextSummary: formatHex(colors.blue[300]),
|
||||
Entity: formatHex(colors.indigo[300]),
|
||||
EntityType: formatHex(colors.indigo[400]),
|
||||
NodeSet: formatHex(colors.indigo[400]),
|
||||
GitHubUser: formatHex(colors.gray[200]),
|
||||
Comment: formatHex(colors.blue[300]),
|
||||
Issue: formatHex(colors.red[200]),
|
||||
Repository: formatHex(colors.stone[200]),
|
||||
Commit: formatHex(colors.teal[300]),
|
||||
File: formatHex(colors.emerald[300]),
|
||||
FileChange: formatHex(colors.sky[300]),
|
||||
TextDocument: formatHex(colors.blue[500]),
|
||||
DocumentChunk: formatHex(colors.green[500]),
|
||||
TextSummary: formatHex(colors.orange[500]),
|
||||
Entity: formatHex(colors.yellow[300]),
|
||||
EntityType: formatHex(colors.purple[800]),
|
||||
NodeSet: formatHex(colors.indigo[300]),
|
||||
GitHubUser: formatHex(colors.gray[300]),
|
||||
Comment: formatHex(colors.amber[500]),
|
||||
Issue: formatHex(colors.red[500]),
|
||||
Repository: formatHex(colors.stone[400]),
|
||||
Commit: formatHex(colors.teal[500]),
|
||||
File: formatHex(colors.emerald[500]),
|
||||
FileChange: formatHex(colors.sky[500]),
|
||||
};
|
||||
|
||||
export default function getColorForNodeType(type: string) {
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { BackIcon } from "@/ui/Icons";
|
||||
import { CTAButton } from "@/ui/elements";
|
||||
import Header from "@/ui/Layout/Header";
|
||||
import { useAuthenticatedUser } from "@/modules/auth";
|
||||
|
||||
export default function Account() {
|
||||
const { user } = useAuthenticatedUser();
|
||||
const account = {
|
||||
name: user ? user.name || user.email : "NN",
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-full max-w-[1920px] mx-auto">
|
||||
{/* <video
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
className="fixed inset-0 z-0 object-cover w-full h-full"
|
||||
>
|
||||
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
|
||||
Your browser does not support the video tag.
|
||||
</video> */}
|
||||
|
||||
<Header user={user} />
|
||||
|
||||
<div className="relative flex flex-row items-start gap-2.5">
|
||||
<Link href="/dashboard" className="flex-1/5 py-4 px-5 flex flex-row items-center gap-5">
|
||||
<BackIcon />
|
||||
<span>back</span>
|
||||
</Link>
|
||||
<div className="flex-1/5 flex flex-col gap-2.5">
|
||||
<div className="py-4 px-5 rounded-xl bg-white">
|
||||
<div>Account</div>
|
||||
<div className="text-sm text-gray-400 mb-8">Manage your account's settings.</div>
|
||||
<div>{account.name}</div>
|
||||
</div>
|
||||
<div className="py-4 px-5 rounded-xl bg-white">
|
||||
<div>Plan</div>
|
||||
<div className="text-sm text-gray-400 mb-8">You are using open-source version. Subscribe to get access to hosted cognee with your data!</div>
|
||||
<Link href="/plan">
|
||||
<CTAButton className="w-full"><span className="">Select a plan</span></CTAButton>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1/5 py-4 px-5 rounded-xl">
|
||||
</div>
|
||||
<div className="flex-1/5 py-4 px-5 rounded-xl">
|
||||
</div>
|
||||
<div className="flex-1/5 py-4 px-5 rounded-xl">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export { default } from "./Account";
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
import { FormEvent, useCallback, useState } from "react";
|
||||
|
||||
import { LoadingIndicator } from "@/ui/App";
|
||||
import { useModal } from "@/ui/elements/Modal";
|
||||
import { CloseIcon, MinusIcon, PlusIcon } from "@/ui/Icons";
|
||||
import { CTAButton, GhostButton, IconButton, Modal, NeutralButton, Select } from "@/ui/elements";
|
||||
|
||||
import addData from "@/modules/ingestion/addData";
|
||||
import { Dataset } from "@/modules/ingestion/useDatasets";
|
||||
import cognifyDataset from "@/modules/datasets/cognifyDataset";
|
||||
|
||||
interface AddDataToCogneeProps {
|
||||
datasets: Dataset[];
|
||||
refreshDatasets: () => void;
|
||||
useCloud?: boolean;
|
||||
}
|
||||
|
||||
export default function AddDataToCognee({ datasets, refreshDatasets, useCloud = false }: AddDataToCogneeProps) {
|
||||
const [filesForUpload, setFilesForUpload] = useState<File[]>([]);
|
||||
|
||||
const addFiles = useCallback((event: FormEvent<HTMLInputElement>) => {
|
||||
const formElements = event.currentTarget;
|
||||
const newFiles = formElements.files;
|
||||
|
||||
if (newFiles?.length) {
|
||||
setFilesForUpload((oldFiles) => [...oldFiles, ...Array.from(newFiles)]);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const removeFile = useCallback((file: File) => {
|
||||
setFilesForUpload((oldFiles) => oldFiles.filter((f) => f !== file));
|
||||
}, []);
|
||||
|
||||
const processDataWithCognee = useCallback((state?: object, event?: FormEvent<HTMLFormElement>) => {
|
||||
event!.preventDefault();
|
||||
|
||||
if (!filesForUpload) {
|
||||
return;
|
||||
}
|
||||
|
||||
const formElements = event!.currentTarget;
|
||||
const datasetId = formElements.datasetName.value;
|
||||
|
||||
return addData(
|
||||
datasetId ? {
|
||||
id: datasetId,
|
||||
} : {
|
||||
name: "main_dataset",
|
||||
},
|
||||
filesForUpload,
|
||||
useCloud
|
||||
)
|
||||
.then(({ dataset_id, dataset_name }) => {
|
||||
refreshDatasets();
|
||||
|
||||
return cognifyDataset(
|
||||
{
|
||||
id: dataset_id,
|
||||
name: dataset_name,
|
||||
data: [], // not important, just to mimick Dataset
|
||||
status: "", // not important, just to mimick Dataset
|
||||
},
|
||||
useCloud,
|
||||
)
|
||||
.then(() => {
|
||||
setFilesForUpload([]);
|
||||
});
|
||||
});
|
||||
}, [filesForUpload, refreshDatasets, useCloud]);
|
||||
|
||||
const {
|
||||
isModalOpen: isAddDataModalOpen,
|
||||
openModal: openAddDataModal,
|
||||
closeModal: closeAddDataModal,
|
||||
isActionLoading: isProcessingDataWithCognee,
|
||||
confirmAction: submitDataToCognee,
|
||||
} = useModal(false, processDataWithCognee);
|
||||
|
||||
return (
|
||||
<>
|
||||
<GhostButton onClick={openAddDataModal} className="mb-5 py-1.5 !px-2 text-sm w-full items-center justify-start">
|
||||
<PlusIcon />
|
||||
Add data to cognee
|
||||
</GhostButton>
|
||||
|
||||
<Modal isOpen={isAddDataModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Add new data to a dataset?</span>
|
||||
<IconButton disabled={isProcessingDataWithCognee} onClick={closeAddDataModal}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Please select a {useCloud ? "cloud" : "local"} dataset to add data in.<br/> If you don't have any, don't worry, we will create one for you.</div>
|
||||
<form onSubmit={submitDataToCognee}>
|
||||
<div className="max-w-md flex flex-col gap-4">
|
||||
<Select defaultValue={datasets.length ? datasets[0].id : ""} name="datasetName">
|
||||
{!datasets.length && <option value="">main_dataset</option>}
|
||||
{datasets.map((dataset: Dataset) => (
|
||||
<option key={dataset.id} value={dataset.id}>{dataset.name}</option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
<NeutralButton className="w-full relative justify-start pl-4">
|
||||
<input onChange={addFiles} required name="files" tabIndex={-1} type="file" multiple className="absolute w-full h-full cursor-pointer opacity-0" />
|
||||
<span>select files</span>
|
||||
</NeutralButton>
|
||||
|
||||
{!!filesForUpload.length && (
|
||||
<div className="pt-4 mt-4 border-t-1 border-t-gray-100">
|
||||
<div className="mb-1.5">selected files:</div>
|
||||
{filesForUpload.map((file) => (
|
||||
<div key={file.name} className="py-1.5 pl-2 flex flex-row items-center justify-between w-full">
|
||||
<span className="text-sm">{file.name}</span>
|
||||
<IconButton onClick={removeFile.bind(null, file)}><MinusIcon /></IconButton>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton disabled={isProcessingDataWithCognee} type="button" onClick={() => closeAddDataModal()}>cancel</GhostButton>
|
||||
<CTAButton disabled={isProcessingDataWithCognee} type="submit">
|
||||
{isProcessingDataWithCognee && <LoadingIndicator color="white" />}
|
||||
add
|
||||
</CTAButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { useBoolean } from "@/utils";
|
||||
import { Accordion } from "@/ui/elements";
|
||||
|
||||
interface CogneeInstancesAccordionProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function CogneeInstancesAccordion({
|
||||
children,
|
||||
}: CogneeInstancesAccordionProps) {
|
||||
const {
|
||||
value: isInstancesPanelOpen,
|
||||
setTrue: openInstancesPanel,
|
||||
setFalse: closeInstancesPanel,
|
||||
} = useBoolean(true);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Accordion
|
||||
title={<span>Cognee Instances</span>}
|
||||
isOpen={isInstancesPanelOpen}
|
||||
openAccordion={openInstancesPanel}
|
||||
closeAccordion={closeInstancesPanel}
|
||||
>
|
||||
{children}
|
||||
</Accordion>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
import { Header } from "@/ui/Layout";
|
||||
import { SearchIcon } from "@/ui/Icons";
|
||||
import { CTAButton, Notebook } from "@/ui/elements";
|
||||
import { fetch, isCloudEnvironment } from "@/utils";
|
||||
import { Notebook as NotebookType } from "@/ui/elements/Notebook/types";
|
||||
import { useAuthenticatedUser } from "@/modules/auth";
|
||||
import { Dataset } from "@/modules/ingestion/useDatasets";
|
||||
import useNotebooks from "@/modules/notebooks/useNotebooks";
|
||||
|
||||
import AddDataToCognee from "./AddDataToCognee";
|
||||
import NotebooksAccordion from "./NotebooksAccordion";
|
||||
import CogneeInstancesAccordion from "./CogneeInstancesAccordion";
|
||||
import InstanceDatasetsAccordion from "./InstanceDatasetsAccordion";
|
||||
|
||||
interface DashboardProps {
|
||||
user?: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
picture: string;
|
||||
};
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
export default function Dashboard({ accessToken }: DashboardProps) {
|
||||
fetch.setAccessToken(accessToken);
|
||||
const { user } = useAuthenticatedUser();
|
||||
|
||||
const {
|
||||
notebooks,
|
||||
refreshNotebooks,
|
||||
runCell,
|
||||
addNotebook,
|
||||
updateNotebook,
|
||||
saveNotebook,
|
||||
removeNotebook,
|
||||
} = useNotebooks();
|
||||
|
||||
useEffect(() => {
|
||||
if (!notebooks.length) {
|
||||
refreshNotebooks()
|
||||
.then((notebooks) => {
|
||||
if (notebooks[0]) {
|
||||
setSelectedNotebookId(notebooks[0].id);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [notebooks.length, refreshNotebooks]);
|
||||
|
||||
const [selectedNotebookId, setSelectedNotebookId] = useState<string | null>(null);
|
||||
|
||||
const handleNotebookRemove = useCallback((notebookId: string) => {
|
||||
return removeNotebook(notebookId)
|
||||
.then(() => {
|
||||
setSelectedNotebookId((currentSelectedNotebookId) => (
|
||||
currentSelectedNotebookId === notebookId ? null : currentSelectedNotebookId
|
||||
));
|
||||
});
|
||||
}, [removeNotebook]);
|
||||
|
||||
const saveNotebookTimeoutRef = useRef<number | null>(null);
|
||||
const saveNotebookThrottled = useCallback((notebook: NotebookType) => {
|
||||
const throttleTime = 1000;
|
||||
|
||||
if (saveNotebookTimeoutRef.current) {
|
||||
clearTimeout(saveNotebookTimeoutRef.current);
|
||||
saveNotebookTimeoutRef.current = null;
|
||||
}
|
||||
|
||||
saveNotebookTimeoutRef.current = setTimeout(() => {
|
||||
saveNotebook(notebook);
|
||||
}, throttleTime) as unknown as number;
|
||||
}, [saveNotebook]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (saveNotebookTimeoutRef.current) {
|
||||
clearTimeout(saveNotebookTimeoutRef.current);
|
||||
saveNotebookTimeoutRef.current = null;
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleNotebookUpdate = useCallback((notebook: NotebookType) => {
|
||||
updateNotebook(notebook);
|
||||
saveNotebookThrottled(notebook);
|
||||
}, [saveNotebookThrottled, updateNotebook]);
|
||||
|
||||
const selectedNotebook = notebooks.find((notebook) => notebook.id === selectedNotebookId);
|
||||
|
||||
// ############################
|
||||
// Datasets logic
|
||||
|
||||
const [datasets, setDatasets] = useState<Dataset[]>([]);
|
||||
const refreshDatasetsRef = useRef(() => {});
|
||||
|
||||
const handleDatasetsChange = useCallback((payload: { datasets: Dataset[], refreshDatasets: () => void }) => {
|
||||
const {
|
||||
datasets,
|
||||
refreshDatasets,
|
||||
} = payload;
|
||||
|
||||
refreshDatasetsRef.current = refreshDatasets;
|
||||
setDatasets(datasets);
|
||||
}, []);
|
||||
|
||||
const isCloudEnv = isCloudEnvironment();
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
{/* <video
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
className="fixed inset-0 z-0 object-cover w-full h-full"
|
||||
>
|
||||
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
|
||||
Your browser does not support the video tag.
|
||||
</video> */}
|
||||
|
||||
<Header user={user} />
|
||||
|
||||
<div className="relative flex-1 flex flex-row gap-2.5 items-start w-full max-w-[1920px] max-h-[calc(100% - 3.5rem)] overflow-hidden mx-auto px-2.5 pb-2.5">
|
||||
<div className="px-5 py-4 lg:w-96 bg-white rounded-xl h-[calc(100%-2.75rem)]">
|
||||
<div className="relative mb-2">
|
||||
<label htmlFor="search-input"><SearchIcon className="absolute left-3 top-[10px] cursor-text" /></label>
|
||||
<input id="search-input" className="text-xs leading-3 w-full h-8 flex flex-row items-center gap-2.5 rounded-3xl pl-9 placeholder-gray-300 border-gray-300 border-[1px] focus:outline-indigo-600" placeholder="Search datasets..." />
|
||||
</div>
|
||||
|
||||
<AddDataToCognee
|
||||
datasets={datasets}
|
||||
refreshDatasets={refreshDatasetsRef.current}
|
||||
useCloud={isCloudEnv}
|
||||
/>
|
||||
|
||||
<NotebooksAccordion
|
||||
notebooks={notebooks}
|
||||
addNotebook={addNotebook}
|
||||
removeNotebook={handleNotebookRemove}
|
||||
openNotebook={setSelectedNotebookId}
|
||||
/>
|
||||
|
||||
<div className="mt-7 mb-14">
|
||||
<CogneeInstancesAccordion>
|
||||
<InstanceDatasetsAccordion
|
||||
onDatasetsChange={handleDatasetsChange}
|
||||
/>
|
||||
</CogneeInstancesAccordion>
|
||||
</div>
|
||||
|
||||
<div className="fixed bottom-2.5 w-[calc(min(1920px,100%)/5)] lg:w-96 ml-[-1.25rem] mx-auto">
|
||||
<a href="/plan">
|
||||
<CTAButton className="w-full">Select a plan</CTAButton>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 flex flex-col justify-between h-full overflow-y-auto">
|
||||
{selectedNotebook && (
|
||||
<Notebook
|
||||
key={selectedNotebook.id}
|
||||
notebook={selectedNotebook}
|
||||
updateNotebook={handleNotebookUpdate}
|
||||
runCell={runCell}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,346 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { ChangeEvent, useCallback, useEffect, useState } from "react";
|
||||
import { useBoolean } from "@/utils";
|
||||
import { Accordion, CTAButton, GhostButton, IconButton, Input, Modal, PopupMenu } from "@/ui/elements";
|
||||
import { AccordionProps } from "@/ui/elements/Accordion";
|
||||
import { CloseIcon, DatasetIcon, MinusIcon, PlusIcon } from "@/ui/Icons";
|
||||
import useDatasets, { Dataset } from "@/modules/ingestion/useDatasets";
|
||||
import addData from "@/modules/ingestion/addData";
|
||||
import cognifyDataset from "@/modules/datasets/cognifyDataset";
|
||||
import { DataFile } from "@/modules/ingestion/useData";
|
||||
import { LoadingIndicator } from "@/ui/App";
|
||||
|
||||
interface DatasetsChangePayload {
|
||||
datasets: Dataset[]
|
||||
refreshDatasets: () => void;
|
||||
}
|
||||
|
||||
export interface DatasetsAccordionProps extends Omit<AccordionProps, "isOpen" | "openAccordion" | "closeAccordion" | "children"> {
|
||||
onDatasetsChange?: (payload: DatasetsChangePayload) => void;
|
||||
useCloud?: boolean;
|
||||
}
|
||||
|
||||
export default function DatasetsAccordion({
|
||||
title,
|
||||
tools,
|
||||
switchCaretPosition = false,
|
||||
className,
|
||||
contentClassName,
|
||||
onDatasetsChange,
|
||||
useCloud = false,
|
||||
}: DatasetsAccordionProps) {
|
||||
const {
|
||||
value: isDatasetsPanelOpen,
|
||||
setTrue: openDatasetsPanel,
|
||||
setFalse: closeDatasetsPanel,
|
||||
} = useBoolean(true);
|
||||
|
||||
const {
|
||||
datasets,
|
||||
refreshDatasets,
|
||||
addDataset,
|
||||
removeDataset,
|
||||
getDatasetData,
|
||||
removeDatasetData,
|
||||
} = useDatasets(useCloud);
|
||||
|
||||
useEffect(() => {
|
||||
if (datasets.length === 0) {
|
||||
refreshDatasets();
|
||||
}
|
||||
}, [datasets.length, refreshDatasets]);
|
||||
|
||||
const [openDatasets, openDataset] = useState<Set<string>>(new Set());
|
||||
|
||||
const toggleDataset = (id: string) => {
|
||||
openDataset((prev) => {
|
||||
const newState = new Set(prev);
|
||||
|
||||
if (newState.has(id)) {
|
||||
newState.delete(id)
|
||||
} else {
|
||||
getDatasetData(id)
|
||||
.then(() => {
|
||||
newState.add(id);
|
||||
});
|
||||
}
|
||||
|
||||
return newState;
|
||||
});
|
||||
};
|
||||
|
||||
const refreshOpenDatasetsData = useCallback(() => {
|
||||
return Promise.all(
|
||||
openDatasets.values().map(
|
||||
(datasetId) => getDatasetData(datasetId)
|
||||
)
|
||||
);
|
||||
}, [getDatasetData, openDatasets]);
|
||||
|
||||
const refreshDatasetsAndData = useCallback(() => {
|
||||
refreshDatasets()
|
||||
.then(refreshOpenDatasetsData);
|
||||
}, [refreshDatasets, refreshOpenDatasetsData]);
|
||||
|
||||
useEffect(() => {
|
||||
onDatasetsChange?.({
|
||||
datasets,
|
||||
refreshDatasets: refreshDatasetsAndData,
|
||||
});
|
||||
}, [datasets, onDatasetsChange, refreshDatasets, refreshDatasetsAndData]);
|
||||
|
||||
const {
|
||||
value: isNewDatasetModalOpen,
|
||||
setTrue: openNewDatasetModal,
|
||||
setFalse: closeNewDatasetModal,
|
||||
} = useBoolean(false);
|
||||
|
||||
const handleDatasetAdd = () => {
|
||||
openNewDatasetModal();
|
||||
};
|
||||
|
||||
const [newDatasetError, setNewDatasetError] = useState("");
|
||||
|
||||
const handleNewDatasetSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
setNewDatasetError("");
|
||||
|
||||
const formElements = event.currentTarget;
|
||||
|
||||
const datasetName = formElements.datasetName.value;
|
||||
|
||||
if (datasetName.trim().length === 0) {
|
||||
setNewDatasetError("Dataset name cannot be empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (datasetName.includes(" ") || datasetName.includes(".")) {
|
||||
setNewDatasetError("Dataset name cannot contain spaces or periods.");
|
||||
return;
|
||||
}
|
||||
|
||||
addDataset(datasetName)
|
||||
.then(() => {
|
||||
closeNewDatasetModal();
|
||||
refreshDatasetsAndData();
|
||||
});
|
||||
};
|
||||
|
||||
const {
|
||||
value: isRemoveDatasetModalOpen,
|
||||
setTrue: openRemoveDatasetModal,
|
||||
setFalse: closeRemoveDatasetModal,
|
||||
} = useBoolean(false);
|
||||
|
||||
const [datasetToRemove, setDatasetToRemove] = useState<Dataset | null>(null);
|
||||
|
||||
const handleDatasetRemove = (dataset: Dataset) => {
|
||||
setDatasetToRemove(dataset);
|
||||
openRemoveDatasetModal();
|
||||
};
|
||||
|
||||
const handleDatasetRemoveCancel = () => {
|
||||
setDatasetToRemove(null);
|
||||
closeRemoveDatasetModal();
|
||||
};
|
||||
|
||||
const handleRemoveDatasetConfirm = (event: React.FormEvent<HTMLButtonElement>) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (datasetToRemove) {
|
||||
removeDataset(datasetToRemove.id)
|
||||
.then(() => {
|
||||
closeRemoveDatasetModal();
|
||||
setDatasetToRemove(null);
|
||||
refreshDatasetsAndData();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const [datasetInProcessing, setProcessingDataset] = useState<Dataset | null>(null);
|
||||
|
||||
const handleAddFiles = (dataset: Dataset, event: ChangeEvent<HTMLInputElement>) => {
|
||||
event.stopPropagation();
|
||||
|
||||
if (datasetInProcessing) {
|
||||
return;
|
||||
}
|
||||
|
||||
setProcessingDataset(dataset);
|
||||
|
||||
if (!event.target.files) {
|
||||
return;
|
||||
}
|
||||
|
||||
const files: File[] = Array.from(event.target.files);
|
||||
|
||||
if (!files.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
return addData(dataset, files, useCloud)
|
||||
.then(async () => {
|
||||
await getDatasetData(dataset.id);
|
||||
|
||||
return cognifyDataset(dataset, useCloud)
|
||||
.finally(() => {
|
||||
setProcessingDataset(null);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const [dataToRemove, setDataToRemove] = useState<DataFile | null>(null);
|
||||
const {
|
||||
value: isRemoveDataModalOpen,
|
||||
setTrue: openRemoveDataModal,
|
||||
setFalse: closeRemoveDataModal,
|
||||
} = useBoolean(false);
|
||||
|
||||
const handleDataRemove = (data: DataFile) => {
|
||||
setDataToRemove(data);
|
||||
|
||||
openRemoveDataModal();
|
||||
};
|
||||
const handleDataRemoveCancel = () => {
|
||||
setDataToRemove(null);
|
||||
closeRemoveDataModal();
|
||||
};
|
||||
const handleDataRemoveConfirm = (event: React.FormEvent<HTMLButtonElement>) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (dataToRemove) {
|
||||
removeDatasetData(dataToRemove.datasetId, dataToRemove.id)
|
||||
.then(() => {
|
||||
closeRemoveDataModal();
|
||||
setDataToRemove(null);
|
||||
refreshDatasetsAndData();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Accordion
|
||||
title={title || <span>Datasets</span>}
|
||||
isOpen={isDatasetsPanelOpen}
|
||||
openAccordion={openDatasetsPanel}
|
||||
closeAccordion={closeDatasetsPanel}
|
||||
tools={(
|
||||
<div className="flex flex-row gap-4 items-center">
|
||||
{tools}
|
||||
<IconButton onClick={handleDatasetAdd}><PlusIcon /></IconButton>
|
||||
</div>
|
||||
)}
|
||||
switchCaretPosition={switchCaretPosition}
|
||||
className={className}
|
||||
contentClassName={contentClassName}
|
||||
>
|
||||
<div className="flex flex-col">
|
||||
{datasets.length === 0 && (
|
||||
<div className="flex flex-row items-baseline-last text-sm text-gray-400 mt-2 px-2">
|
||||
<span>No datasets here, add one by clicking +</span>
|
||||
</div>
|
||||
)}
|
||||
{datasets.map((dataset) => {
|
||||
return (
|
||||
<Accordion
|
||||
key={dataset.id}
|
||||
title={(
|
||||
<div className="flex flex-row gap-2 items-center py-1.5 cursor-pointer">
|
||||
{datasetInProcessing?.id == dataset.id ? <LoadingIndicator /> : <DatasetIcon />}
|
||||
<span className="text-xs">{dataset.name}</span>
|
||||
</div>
|
||||
)}
|
||||
isOpen={openDatasets.has(dataset.id)}
|
||||
openAccordion={() => toggleDataset(dataset.id)}
|
||||
closeAccordion={() => toggleDataset(dataset.id)}
|
||||
tools={(
|
||||
<IconButton className="relative">
|
||||
<PopupMenu>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="hover:bg-gray-100 w-full text-left px-2 cursor-pointer relative">
|
||||
<input tabIndex={-1} type="file" multiple onChange={handleAddFiles.bind(null, dataset)} className="absolute w-full h-full cursor-pointer opacity-0" />
|
||||
<span>add data</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5 items-start">
|
||||
<div onClick={() => handleDatasetRemove(dataset)} className="hover:bg-gray-100 w-full text-left px-2 cursor-pointer">delete</div>
|
||||
</div>
|
||||
</PopupMenu>
|
||||
</IconButton>
|
||||
)}
|
||||
className="first:pt-1.5"
|
||||
switchCaretPosition={true}
|
||||
>
|
||||
<>
|
||||
{dataset.data?.length === 0 && (
|
||||
<div className="flex flex-row items-baseline-last text-sm text-gray-400 mt-2 px-2">
|
||||
<span>No data in a dataset, add by clicking "add data" in a dropdown menu</span>
|
||||
</div>
|
||||
)}
|
||||
{dataset.data?.map((data) => (
|
||||
<div key={data.id} className="flex flex-row gap-2 items-center justify-between py-1.5 pl-6 last:pb-2.5">
|
||||
<span className="text-xs">{data.name}</span>
|
||||
<div>
|
||||
<IconButton onClick={() => handleDataRemove(data)}><MinusIcon /></IconButton>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
</Accordion>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Accordion>
|
||||
|
||||
<Modal isOpen={isNewDatasetModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Create a new dataset?</span>
|
||||
<IconButton onClick={closeNewDatasetModal}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Please provide a name for the dataset being created.</div>
|
||||
<form onSubmit={handleNewDatasetSubmit}>
|
||||
<div className="max-w-md">
|
||||
<Input name="datasetName" type="text" placeholder="Dataset name" required />
|
||||
{newDatasetError && <span className="text-sm pl-4 text-gray-400">{newDatasetError}</span>}
|
||||
</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={() => closeNewDatasetModal()}>cancel</GhostButton>
|
||||
<CTAButton type="submit">create</CTAButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal isOpen={isRemoveDatasetModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Delete <span className="text-indigo-600">{datasetToRemove?.name}</span> dataset?</span>
|
||||
<IconButton onClick={handleDatasetRemoveCancel}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Are you sure you want to delete <span className="text-indigo-600">{datasetToRemove?.name}</span>? This action cannot be undone.</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={handleDatasetRemoveCancel}>cancel</GhostButton>
|
||||
<CTAButton onClick={handleRemoveDatasetConfirm} type="submit">delete</CTAButton>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal isOpen={isRemoveDataModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Delete <span className="text-indigo-600">{dataToRemove?.name}</span> data?</span>
|
||||
<IconButton onClick={handleDataRemoveCancel}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Are you sure you want to delete <span className="text-indigo-600">{dataToRemove?.name}</span>? This action cannot be undone.</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={handleDataRemoveCancel}>cancel</GhostButton>
|
||||
<CTAButton onClick={handleDataRemoveConfirm} type="submit">delete</CTAButton>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
import classNames from "classnames";
|
||||
import { useCallback, useEffect } from "react";
|
||||
|
||||
import { fetch, isCloudEnvironment, useBoolean } from "@/utils";
|
||||
import { checkCloudConnection } from "@/modules/cloud";
|
||||
import { CaretIcon, CloseIcon, CloudIcon, LocalCogneeIcon } from "@/ui/Icons";
|
||||
import { CTAButton, GhostButton, IconButton, Input, Modal } from "@/ui/elements";
|
||||
|
||||
import DatasetsAccordion, { DatasetsAccordionProps } from "./DatasetsAccordion";
|
||||
|
||||
type InstanceDatasetsAccordionProps = Omit<DatasetsAccordionProps, "title">;
|
||||
|
||||
export default function InstanceDatasetsAccordion({ onDatasetsChange }: InstanceDatasetsAccordionProps) {
|
||||
const {
|
||||
value: isLocalCogneeConnected,
|
||||
setTrue: setLocalCogneeConnected,
|
||||
} = useBoolean(false);
|
||||
|
||||
const {
|
||||
value: isCloudCogneeConnected,
|
||||
setTrue: setCloudCogneeConnected,
|
||||
} = useBoolean(isCloudEnvironment());
|
||||
|
||||
const checkConnectionToCloudCognee = useCallback((apiKey?: string) => {
|
||||
if (apiKey) {
|
||||
fetch.setApiKey(apiKey);
|
||||
}
|
||||
return checkCloudConnection()
|
||||
.then(setCloudCogneeConnected)
|
||||
}, [setCloudCogneeConnected]);
|
||||
|
||||
useEffect(() => {
|
||||
const checkConnectionToLocalCognee = () => {
|
||||
fetch.checkHealth()
|
||||
.then(setLocalCogneeConnected)
|
||||
};
|
||||
|
||||
checkConnectionToLocalCognee();
|
||||
checkConnectionToCloudCognee();
|
||||
}, [checkConnectionToCloudCognee, setCloudCogneeConnected, setLocalCogneeConnected]);
|
||||
|
||||
const {
|
||||
value: isCloudConnectedModalOpen,
|
||||
setTrue: openCloudConnectionModal,
|
||||
setFalse: closeCloudConnectionModal,
|
||||
} = useBoolean(false);
|
||||
|
||||
const handleCloudConnectionConfirm = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
|
||||
const apiKeyValue = event.currentTarget.apiKey.value;
|
||||
|
||||
checkConnectionToCloudCognee(apiKeyValue)
|
||||
.then(() => {
|
||||
closeCloudConnectionModal();
|
||||
});
|
||||
};
|
||||
|
||||
const isCloudEnv = isCloudEnvironment();
|
||||
|
||||
return (
|
||||
<div className={classNames("flex flex-col", {
|
||||
"flex-col-reverse": isCloudEnv,
|
||||
})}>
|
||||
<DatasetsAccordion
|
||||
title={(
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<LocalCogneeIcon className="text-indigo-700" />
|
||||
<span className="text-xs">local cognee</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
tools={isLocalCogneeConnected ? <span className="text-xs text-indigo-600">Connected</span> : <span className="text-xs text-gray-400">Not connected</span>}
|
||||
switchCaretPosition={true}
|
||||
className="pt-3 pb-1.5"
|
||||
contentClassName="pl-4"
|
||||
onDatasetsChange={!isCloudEnv ? onDatasetsChange : () => {}}
|
||||
/>
|
||||
|
||||
{isCloudCogneeConnected ? (
|
||||
<DatasetsAccordion
|
||||
title={(
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<LocalCogneeIcon className="text-indigo-700" />
|
||||
<span className="text-xs">cloud cognee</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
tools={<span className="text-xs text-indigo-600">Connected</span>}
|
||||
switchCaretPosition={true}
|
||||
className="pt-3 pb-1.5"
|
||||
contentClassName="pl-4"
|
||||
onDatasetsChange={isCloudEnv ? onDatasetsChange : () => {}}
|
||||
useCloud={true}
|
||||
/>
|
||||
) : (
|
||||
<button className="w-full flex flex-row items-center justify-between py-1.5 cursor-pointer pt-3" onClick={!isCloudCogneeConnected ? openCloudConnectionModal : () => {}}>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<CaretIcon className="rotate-[-90deg]" />
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<CloudIcon color="#000000" />
|
||||
<span className="text-xs">cloud cognee</span>
|
||||
</div>
|
||||
</div>
|
||||
<span className="text-xs text-gray-400">Not connected</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
<Modal isOpen={isCloudConnectedModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Connect to cloud?</span>
|
||||
<IconButton onClick={closeCloudConnectionModal}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Please provide your API key. You can find it on <a className="!text-indigo-600" href="https://platform.cognee.ai">our platform.</a></div>
|
||||
<form onSubmit={handleCloudConnectionConfirm}>
|
||||
<div className="max-w-md">
|
||||
<Input name="apiKey" type="text" placeholder="cloud API key" required />
|
||||
</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={() => closeCloudConnectionModal()}>cancel</GhostButton>
|
||||
<CTAButton type="submit">connect</CTAButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { FormEvent, useCallback, useState } from "react";
|
||||
import { useBoolean } from "@/utils";
|
||||
import { Accordion, CTAButton, GhostButton, IconButton, Input, Modal } from "@/ui/elements";
|
||||
import { CloseIcon, MinusIcon, NotebookIcon, PlusIcon } from "@/ui/Icons";
|
||||
import { Notebook } from "@/ui/elements/Notebook/types";
|
||||
import { useModal } from "@/ui/elements/Modal";
|
||||
import { LoadingIndicator } from "@/ui/App";
|
||||
|
||||
interface NotebooksAccordionProps {
|
||||
notebooks: Notebook[];
|
||||
addNotebook: (name: string) => Promise<Notebook>;
|
||||
removeNotebook: (id: string) => Promise<void>;
|
||||
openNotebook: (id: string) => void;
|
||||
}
|
||||
|
||||
export default function NotebooksAccordion({
|
||||
notebooks,
|
||||
addNotebook,
|
||||
removeNotebook,
|
||||
openNotebook,
|
||||
}: NotebooksAccordionProps) {
|
||||
const {
|
||||
value: isNotebookPanelOpen,
|
||||
setTrue: openNotebookPanel,
|
||||
setFalse: closeNotebookPanel,
|
||||
} = useBoolean(true);
|
||||
|
||||
const {
|
||||
value: isNotebookLoading,
|
||||
setTrue: notebookLoading,
|
||||
setFalse: notebookLoaded,
|
||||
} = useBoolean(false);
|
||||
|
||||
// Notebook removal modal
|
||||
const [notebookToRemove, setNotebookToRemove] = useState<Notebook | null>(null);
|
||||
|
||||
const handleNotebookRemove = (notebook: Notebook) => {
|
||||
setNotebookToRemove(notebook);
|
||||
openRemoveNotebookModal();
|
||||
};
|
||||
|
||||
const {
|
||||
value: isRemoveNotebookModalOpen,
|
||||
setTrue: openRemoveNotebookModal,
|
||||
setFalse: closeRemoveNotebookModal,
|
||||
} = useBoolean(false);
|
||||
|
||||
const handleNotebookRemoveCancel = () => {
|
||||
closeRemoveNotebookModal();
|
||||
setNotebookToRemove(null);
|
||||
};
|
||||
|
||||
const handleNotebookRemoveConfirm = () => {
|
||||
notebookLoading();
|
||||
removeNotebook(notebookToRemove!.id)
|
||||
.finally(notebookLoaded)
|
||||
.finally(closeRemoveNotebookModal)
|
||||
.finally(() => setNotebookToRemove(null));
|
||||
};
|
||||
|
||||
const handleNotebookAdd = useCallback((_: Notebook, formEvent?: FormEvent<HTMLFormElement>) => {
|
||||
if (!formEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
formEvent.preventDefault();
|
||||
|
||||
const formElements = formEvent.currentTarget;
|
||||
const notebookName = formElements.notebookName.value.trim();
|
||||
|
||||
return addNotebook(notebookName)
|
||||
.then(() => {});
|
||||
}, [addNotebook]);
|
||||
|
||||
const {
|
||||
isModalOpen: isNewNotebookModalOpen,
|
||||
openModal: openNewNotebookModal,
|
||||
closeModal: closeNewNotebookModal,
|
||||
confirmAction: handleNewNotebookSubmit,
|
||||
isActionLoading: isNewDatasetLoading,
|
||||
} = useModal<Notebook>(false, handleNotebookAdd);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Accordion
|
||||
title={<span>Notebooks</span>}
|
||||
isOpen={isNotebookPanelOpen}
|
||||
openAccordion={openNotebookPanel}
|
||||
closeAccordion={closeNotebookPanel}
|
||||
tools={isNewDatasetLoading ? (
|
||||
<LoadingIndicator />
|
||||
) : (
|
||||
<IconButton onClick={() => openNewNotebookModal()}><PlusIcon /></IconButton>
|
||||
)}
|
||||
>
|
||||
{notebooks.length === 0 && (
|
||||
<div className="flex flex-row items-baseline-last text-sm text-gray-400 mt-2 px-2">
|
||||
<span>No notebooks here, add one by clicking +</span>
|
||||
</div>
|
||||
)}
|
||||
{notebooks.map((notebook: Notebook) => (
|
||||
<div key={notebook.id} className="flex flex-row gap-2.5 items-center justify-between py-1.5 first:pt-3">
|
||||
<button onClick={() => openNotebook(notebook.id)} className="flex flex-row gap-2 items-center cursor-pointer">
|
||||
{isNotebookLoading ? <LoadingIndicator /> : <NotebookIcon />}
|
||||
<span className="text-xs">{notebook.name}</span>
|
||||
</button>
|
||||
<div>
|
||||
{notebook.deletable && <IconButton onClick={() => handleNotebookRemove(notebook)}><MinusIcon /></IconButton>}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</Accordion>
|
||||
|
||||
<Modal isOpen={isNewNotebookModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Create a new notebook?</span>
|
||||
<IconButton onClick={closeNewNotebookModal}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Please provide a name for the notebook being created.</div>
|
||||
<form onSubmit={handleNewNotebookSubmit}>
|
||||
<div className="max-w-md">
|
||||
<Input name="notebookName" type="text" placeholder="Notebook name" required />
|
||||
{/* {newDatasetError && <span className="text-sm pl-4 text-gray-400">{newDatasetError}</span>} */}
|
||||
</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={() => closeNewNotebookModal()}>cancel</GhostButton>
|
||||
<CTAButton type="submit">create</CTAButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal isOpen={isRemoveNotebookModalOpen}>
|
||||
<div className="w-full max-w-2xl">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<span className="text-2xl">Delete <span className="text-indigo-600">{notebookToRemove?.name}</span> notebook?</span>
|
||||
<IconButton onClick={handleNotebookRemoveCancel}><CloseIcon /></IconButton>
|
||||
</div>
|
||||
<div className="mt-8 mb-6">Are you sure you want to delete <span className="text-indigo-600">{notebookToRemove?.name}</span>? This action cannot be undone.</div>
|
||||
<div className="flex flex-row gap-4 mt-4 justify-end">
|
||||
<GhostButton type="button" onClick={handleNotebookRemoveCancel}>cancel</GhostButton>
|
||||
<CTAButton onClick={handleNotebookRemoveConfirm} type="submit">delete</CTAButton>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import Dashboard from "./Dashboard";
|
||||
|
||||
export default function Page() {
|
||||
const accessToken = "";
|
||||
|
||||
return (
|
||||
<Dashboard accessToken={accessToken} />
|
||||
);
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
--global-color-primary-active: #500cc5 !important;
|
||||
--global-color-primary-text: white !important;
|
||||
--global-color-secondary: #0DFF00 !important;
|
||||
--global-background-default: #F4F4F4;
|
||||
--global-background-default: #0D051C;
|
||||
--textarea-default-color: #0D051C !important;
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,6 @@ body {
|
|||
height: 100%;
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
background-color: var(--global-background-default);
|
||||
}
|
||||
|
||||
a {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export { default } from "./dashboard/page";
|
||||
export { default } from "./(graph)/GraphView";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
|
|
|||
|
|
@ -1,186 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { BackIcon, CheckIcon } from "@/ui/Icons";
|
||||
import { CTAButton, NeutralButton } from "@/ui/elements";
|
||||
import Header from "@/ui/Layout/Header";
|
||||
import { useAuthenticatedUser } from "@/modules/auth";
|
||||
|
||||
export default function Plan() {
|
||||
const { user } = useAuthenticatedUser();
|
||||
|
||||
return (
|
||||
<div className="h-full max-w-[1920px] mx-auto">
|
||||
{/* <video
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
className="fixed inset-0 z-0 object-cover w-full h-full"
|
||||
>
|
||||
<source src="/videos/background-video-blur.mp4" type="video/mp4" />
|
||||
Your browser does not support the video tag.
|
||||
</video> */}
|
||||
|
||||
<Header user={user} />
|
||||
|
||||
<div className="relative flex flex-row items-start justify-stretch gap-2.5">
|
||||
<div className="flex-1/5 h-full">
|
||||
<div className="flex flex-col justify-between">
|
||||
<Link href="/dashboard" className="py-4 px-5 flex flex-row items-center gap-5">
|
||||
<BackIcon />
|
||||
<span>back</span>
|
||||
</Link>
|
||||
|
||||
{/* <div className="fixed bottom-6 w-[calc(min(1920px,100%)/5)] mx-auto">
|
||||
<div className="text-sm mb-2"></div>
|
||||
<a href="/plan">
|
||||
<CTAButton className="w-full">Select a plan</CTAButton>
|
||||
</a>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-3/5">
|
||||
<div className="bg-white rounded-xl px-5 py-5 mb-2">
|
||||
Affordable and transparent pricing
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-3 gap-x-2.5">
|
||||
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full">
|
||||
<div>Basic</div>
|
||||
<div className="text-[1.75rem] mb-4 font-bold">Free</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-5 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full border-indigo-600 border-1 border-b-0">
|
||||
<div className="text-indigo-600 mb-5 text-xs font-black">Most Popular</div>
|
||||
<div>On-prem Subscription</div>
|
||||
<div className="mb-2"><span className="text-[1.75rem] font-bold">$2470</span><span className="text-gray-400"> /per month</span></div>
|
||||
<div className=""><span className="font-black">Save 20% </span>yearly</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-13 py-4 px-5 mb-2.5 rounded-tl-xl rounded-tr-xl bg-white h-full">
|
||||
<div>Cloud Subscription</div>
|
||||
<div className="mb-2"><span className="text-[1.75rem] font-bold">$25</span><span className="text-gray-400"> /per month</span></div>
|
||||
<div className=" text-gray-400">(beta pricing)</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-bl-xl rounded-br-xl h-full py-4 px-5">
|
||||
<div className="mb-2 invisible">Everything in the free plan, plus...</div>
|
||||
<div className="flex flex-col gap-3 mb-28">
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />License to use Cognee open source</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Cognee tasks and pipelines</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Custom schema and ontology generation</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Integrated evaluations</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />More than 28 data sources supported</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-bl-xl rounded-br-xl border-indigo-600 border-1 border-t-0 h-full py-4 px-5">
|
||||
<div className="mb-2 text-gray-400">Everything in the free plan, plus...</div>
|
||||
<div className="flex flex-col gap-3 mb-4">
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />License to use Cognee open source and Cognee Platform</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />1 day SLA</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />On-prem deployment</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Hands-on support</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Architecture review</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Roadmap prioritization</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Knowledge transfer</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-bl-xl rounded-br-xl h-full py-4 px-5">
|
||||
<div className="mb-2 text-gray-400">Everything in the free plan, plus...</div>
|
||||
<div className="flex flex-col gap-3 mb-4">
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Fully hosted cloud platform</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Multi-tenant architecture</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Comprehensive API endpoints</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Automated scaling and parallel processing</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Ability to group memories per user and domain</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />Automatic updates and priority support</div>
|
||||
<div className="flex flex-row gap-2 leading-5"><CheckIcon className="mt-1 shrink-0" />1 GB ingestion + 10,000 API calls</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-4 pb-14 mb-2.5">
|
||||
<a href="https://www.github.com/topoteretes/cognee" target="_blank">
|
||||
<NeutralButton className="w-full">Try for free</NeutralButton>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="pt-4 pb-14 mb-2.5">
|
||||
<a href="https://www.cognee.ai/contact-us" target="_blank">
|
||||
<CTAButton className="w-full">Talk to us</CTAButton>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="pt-4 pb-14 mb-2.5">
|
||||
<a href="https://platform.cognee.ai" target="_blank">
|
||||
<NeutralButton className="w-full">Sign up for Cogwit Beta</NeutralButton>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-4 py-4 px-5 mb-4">
|
||||
<div>Feature Comparison</div>
|
||||
<div className="text-center">Basic</div>
|
||||
<div className="text-center">On-prem</div>
|
||||
<div className="text-center">Cloud</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-4 py-1 px-5 mb-12 bg-white rounded-xl leading-[1]">
|
||||
<div className="border-b-[1px] border-b-gray-100 py-3">Data Sources</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">28+</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">28+</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">28+</div>
|
||||
|
||||
<div className="border-b-[1px] border-b-gray-100 py-3">Deployment</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Self-hosted</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">On-premise</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Cloud</div>
|
||||
|
||||
<div className="border-b-[1px] border-b-gray-100 py-3">API Calls</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Limited</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Unlimited</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">10,000</div>
|
||||
|
||||
<div className="border-b-[1px] border-b-gray-100 py-3">Support</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Community</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Hands-on</div>
|
||||
<div className="text-center border-b-[1px] border-b-gray-100 py-3">Priority</div>
|
||||
|
||||
<div className="py-3">SLA</div>
|
||||
<div className="text-center py-3">—</div>
|
||||
<div className="text-center py-3">1 day</div>
|
||||
<div className="text-center py-3">Standard</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-x-2.5 gap-y-2.5 mb-12">
|
||||
<div className="bg-white py-4 px-5 rounded-xl">
|
||||
<div>Can I change my plan anytime?</div>
|
||||
<div className="text-gray-500 mt-6">Yes, you can upgrade or downgrade your plan at any time. Changes take effect immediately.</div>
|
||||
</div>
|
||||
<div className="bg-white py-4 px-5 rounded-xl">
|
||||
<div>What happens to my data if I downgrade?</div>
|
||||
<div className="text-gray-500 mt-6">Your data is preserved, but features may be limited based on your new plan constraints.</div>
|
||||
</div>
|
||||
<div className="bg-white py-4 px-5 rounded-xl">
|
||||
<div>Do you offer educational discounts?</div>
|
||||
<div className="text-gray-500 mt-6">Yes, we offer special pricing for educational institutions and students. Contact us for details.</div>
|
||||
</div>
|
||||
<div className="bg-white py-4 px-5 rounded-xl">
|
||||
<div>Is there a free trial for paid plans?</div>
|
||||
<div className="text-gray-500 mt-6">All new accounts start with a 14-day free trial of our Pro plan features.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1/5 h-full text-center flex flex-col self-end mb-12 max-w-[1920px]">
|
||||
<div className="fixed bottom-6 w-[calc(min(1920px,100%)/5)] mx-auto">
|
||||
<div className="text-sm mb-2">Need a custom solution?</div>
|
||||
<CTAButton className="w-full">Contact us</CTAButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export { default } from "./Plan";
|
||||
|
|
@ -2,7 +2,7 @@ import { NextResponse, type NextRequest } from "next/server";
|
|||
// import { auth0 } from "./modules/auth/auth0";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export async function proxy(request: NextRequest) {
|
||||
export async function middleware(request: NextRequest) {
|
||||
// if (process.env.USE_AUTH0_AUTHORIZATION?.toLowerCase() === "true") {
|
||||
// if (request.nextUrl.pathname === "/auth/token") {
|
||||
// return NextResponse.next();
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import fetch from "@/utils/fetch";
|
||||
|
||||
export default function getUser() {
|
||||
return fetch("/v1/auth/me")
|
||||
.then((response) => response.json());
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export { type User } from "./types";
|
||||
export { default as useAuthenticatedUser } from "./useAuthenticatedUser";
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
export interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
picture: string;
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { fetch } from "@/utils";
|
||||
import { User } from "./types";
|
||||
|
||||
export default function useAuthenticatedUser() {
|
||||
const [user, setUser] = useState<User>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) {
|
||||
fetch("/v1/auth/me")
|
||||
.then((response) => response.json())
|
||||
.then((data) => setUser(data));
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
return { user };
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ const fetchMessages = () => {
|
|||
.then(response => response.json());
|
||||
};
|
||||
|
||||
const sendMessage = (message: string, searchType: string, topK: number) => {
|
||||
const sendMessage = (message: string, searchType: string) => {
|
||||
return fetch("/v1/search/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
@ -24,7 +24,6 @@ const sendMessage = (message: string, searchType: string, topK: number) => {
|
|||
query: message,
|
||||
searchType,
|
||||
datasets: ["main_dataset"],
|
||||
top_k: topK,
|
||||
}),
|
||||
})
|
||||
.then(response => response.json());
|
||||
|
|
@ -46,7 +45,7 @@ export default function useChat(dataset: Dataset) {
|
|||
return setMessages(data);
|
||||
}, []);
|
||||
|
||||
const handleMessageSending = useCallback((message: string, searchType: string, topK: number) => {
|
||||
const handleMessageSending = useCallback((message: string, searchType: string) => {
|
||||
const sentMessageId = v4();
|
||||
|
||||
setMessages((messages) => [
|
||||
|
|
@ -60,7 +59,7 @@ export default function useChat(dataset: Dataset) {
|
|||
|
||||
disableSearchRun();
|
||||
|
||||
return sendMessage(message, searchType, topK)
|
||||
return sendMessage(message, searchType)
|
||||
.then(newMessages => {
|
||||
setMessages((messages) => [
|
||||
...messages,
|
||||
|
|
@ -89,6 +88,15 @@ export default function useChat(dataset: Dataset) {
|
|||
}
|
||||
|
||||
|
||||
interface Node {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Relationship {
|
||||
relationship_name: string;
|
||||
}
|
||||
|
||||
type InsightMessage = [Node, Relationship, Node];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function convertToSearchTypeOutput(systemMessage: any[] | any, searchType: string): string {
|
||||
|
|
@ -97,6 +105,14 @@ function convertToSearchTypeOutput(systemMessage: any[] | any, searchType: strin
|
|||
}
|
||||
|
||||
switch (searchType) {
|
||||
case "INSIGHTS":
|
||||
return systemMessage.map((message: InsightMessage) => {
|
||||
const [node1, relationship, node2] = message;
|
||||
if (node1.name && node2.name) {
|
||||
return `${node1.name} ${relationship.relationship_name} ${node2.name}.`;
|
||||
}
|
||||
return "";
|
||||
}).join("\n");
|
||||
case "SUMMARIES":
|
||||
return systemMessage.map((message: { text: string }) => message.text).join("\n");
|
||||
case "CHUNKS":
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import { fetch } from "@/utils";
|
||||
|
||||
export default function checkCloudConnection() {
|
||||
return fetch("/v1/checks/connection", {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export { default as syncData } from "./syncData";
|
||||
export { default as checkCloudConnection } from "./checkCloudConnection";
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { fetch } from "@/utils";
|
||||
|
||||
export default function syncData(datasetId?: string) {
|
||||
return fetch("/v1/sync", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
...(datasetId ? { body: JSON.stringify({ datasetId }) } : { body: "{}" }),
|
||||
});
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue