Merge remote-tracking branch 'origin/dev' into dataset-permissions-auth-refactor
This commit is contained in:
commit
e644c3b86d
19 changed files with 5169 additions and 20 deletions
|
|
@ -27,9 +27,9 @@ EMBEDDING_API_VERSION=""
|
||||||
EMBEDDING_DIMENSIONS=3072
|
EMBEDDING_DIMENSIONS=3072
|
||||||
EMBEDDING_MAX_TOKENS=8191
|
EMBEDDING_MAX_TOKENS=8191
|
||||||
|
|
||||||
# "neo4j", "networkx" or "kuzu"
|
# "neo4j", "networkx", "kuzu" or "memgraph"
|
||||||
GRAPH_DATABASE_PROVIDER="networkx"
|
GRAPH_DATABASE_PROVIDER="networkx"
|
||||||
# Only needed if using neo4j
|
# Only needed if using neo4j or memgraph
|
||||||
GRAPH_DATABASE_URL=
|
GRAPH_DATABASE_URL=
|
||||||
GRAPH_DATABASE_USERNAME=
|
GRAPH_DATABASE_USERNAME=
|
||||||
GRAPH_DATABASE_PASSWORD=
|
GRAPH_DATABASE_PASSWORD=
|
||||||
|
|
|
||||||
12
CONTRIBUTORS.md
Normal file
12
CONTRIBUTORS.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
## 💫 Contributors
|
||||||
|
|
||||||
|
Thanks to our amazing contributors! 💖
|
||||||
|
|
||||||
|
<a href="https://github.com/topoteretes/cognee/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=topoteretes/cognee" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
## 🏆 Top Contributors
|
||||||
|
|
||||||
|
| Rank | Contributor | Contributions |
|
||||||
|
|------|------------|---------------|
|
||||||
|
|
@ -45,6 +45,10 @@ uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdra
|
||||||
|
|
||||||
FROM python:3.12-slim-bookworm
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq5 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=uv /app /app
|
COPY --from=uv /app /app
|
||||||
|
|
@ -57,5 +61,7 @@ RUN chmod +x /app/entrypoint.sh
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
|
# ENV LOG_LEVEL=ERROR
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@ depends_on: Union[str, Sequence[str], None] = "8057ae7329c2"
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
try:
|
|
||||||
await_only(create_default_user())
|
await_only(create_default_user())
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
|
||||||
FROM python:3.12-slim-bookworm
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq5 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=uv /root/.local /root/.local
|
COPY --from=uv /root/.local /root/.local
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,22 @@ echo "Environment: $ENVIRONMENT"
|
||||||
# inconsistencies and should cause the startup to fail. This check allows for
|
# inconsistencies and should cause the startup to fail. This check allows for
|
||||||
# smooth redeployments and container restarts while maintaining data integrity.
|
# smooth redeployments and container restarts while maintaining data integrity.
|
||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
MIGRATION_OUTPUT=$(uv run alembic upgrade head 2>&1) || {
|
|
||||||
if [[ $MIGRATION_OUTPUT == *"UserAlreadyExists"* ]] || [[ $MIGRATION_OUTPUT == *"User default_user@example.com already exists"* ]]; then
|
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1)
|
||||||
|
MIGRATION_EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
||||||
|
if [[ "$MIGRATION_OUTPUT" == *"UserAlreadyExists"* ]] || [[ "$MIGRATION_OUTPUT" == *"User default_user@example.com already exists"* ]]; then
|
||||||
echo "Warning: Default user already exists, continuing startup..."
|
echo "Warning: Default user already exists, continuing startup..."
|
||||||
else
|
else
|
||||||
echo "Migration failed with unexpected error:"
|
echo "Migration failed with unexpected error."
|
||||||
echo "$MIGRATION_OUTPUT"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
echo "Starting Cognee MCP Server"
|
echo "Database migrations done."
|
||||||
|
|
||||||
|
echo "Starting Cognee MCP Server..."
|
||||||
|
|
||||||
# Add startup delay to ensure DB is ready
|
# Add startup delay to ensure DB is ready
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
||||||
5087
cognee-mcp/uv.lock
generated
Normal file
5087
cognee-mcp/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,2 +1,3 @@
|
||||||
from .config import get_graph_config
|
from .config import get_graph_config
|
||||||
from .get_graph_engine import get_graph_engine
|
from .get_graph_engine import get_graph_engine
|
||||||
|
from .use_graph_adapter import use_graph_adapter
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from functools import lru_cache
|
||||||
|
|
||||||
from .config import get_graph_context_config
|
from .config import get_graph_context_config
|
||||||
from .graph_db_interface import GraphDBInterface
|
from .graph_db_interface import GraphDBInterface
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
async def get_graph_engine() -> GraphDBInterface:
|
async def get_graph_engine() -> GraphDBInterface:
|
||||||
|
|
@ -61,6 +62,15 @@ def create_graph_engine(
|
||||||
specified.
|
specified.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if graph_database_provider in supported_databases:
|
||||||
|
adapter = supported_databases[graph_database_provider]
|
||||||
|
|
||||||
|
return adapter(
|
||||||
|
graph_database_url=graph_database_url,
|
||||||
|
graph_database_username=graph_database_username,
|
||||||
|
graph_database_password=graph_database_password,
|
||||||
|
)
|
||||||
|
|
||||||
if graph_database_provider == "neo4j":
|
if graph_database_provider == "neo4j":
|
||||||
if not (graph_database_url and graph_database_username and graph_database_password):
|
if not (graph_database_url and graph_database_username and graph_database_password):
|
||||||
raise EnvironmentError("Missing required Neo4j credentials.")
|
raise EnvironmentError("Missing required Neo4j credentials.")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
supported_databases = {}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
|
def use_graph_adapter(vector_db_name, vector_db_adapter):
|
||||||
|
supported_databases[vector_db_name] = vector_db_adapter
|
||||||
|
|
@ -3,3 +3,4 @@ from .models.CollectionConfig import CollectionConfig
|
||||||
from .vector_db_interface import VectorDBInterface
|
from .vector_db_interface import VectorDBInterface
|
||||||
from .config import get_vectordb_config
|
from .config import get_vectordb_config
|
||||||
from .get_vector_engine import get_vector_engine
|
from .get_vector_engine import get_vector_engine
|
||||||
|
from .use_vector_adapter import use_vector_adapter
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
from .embeddings import get_embedding_engine
|
from .embeddings import get_embedding_engine
|
||||||
|
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
@ -38,6 +39,15 @@ def create_vector_engine(
|
||||||
"""
|
"""
|
||||||
embedding_engine = get_embedding_engine()
|
embedding_engine = get_embedding_engine()
|
||||||
|
|
||||||
|
if vector_db_provider in supported_databases:
|
||||||
|
adapter = supported_databases[vector_db_provider]
|
||||||
|
|
||||||
|
return adapter(
|
||||||
|
utl=vector_db_url,
|
||||||
|
api_key=vector_db_key,
|
||||||
|
embedding_engine=embedding_engine,
|
||||||
|
)
|
||||||
|
|
||||||
if vector_db_provider == "weaviate":
|
if vector_db_provider == "weaviate":
|
||||||
from .weaviate_db import WeaviateAdapter
|
from .weaviate_db import WeaviateAdapter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
supported_databases = {}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
|
def use_vector_adapter(vector_db_name, vector_db_adapter):
|
||||||
|
supported_databases[vector_db_name] = vector_db_adapter
|
||||||
|
|
@ -13,7 +13,7 @@ services:
|
||||||
- DEBUG=false # Change to true if debugging
|
- DEBUG=false # Change to true if debugging
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- ENVIRONMENT=local
|
- ENVIRONMENT=local
|
||||||
- PYTHONPATH=.
|
- LOG_LEVEL=ERROR
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
# Allows the container to reach your local machine using "host.docker.internal" instead of "localhost"
|
# Allows the container to reach your local machine using "host.docker.internal" instead of "localhost"
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,19 @@ echo "Environment: $ENVIRONMENT"
|
||||||
# inconsistencies and should cause the startup to fail. This check allows for
|
# inconsistencies and should cause the startup to fail. This check allows for
|
||||||
# smooth redeployments and container restarts while maintaining data integrity.
|
# smooth redeployments and container restarts while maintaining data integrity.
|
||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1) || {
|
|
||||||
if [[ $MIGRATION_OUTPUT == *"UserAlreadyExists"* ]] || [[ $MIGRATION_OUTPUT == *"User default_user@example.com already exists"* ]]; then
|
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1)
|
||||||
|
MIGRATION_EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
||||||
|
if [[ "$MIGRATION_OUTPUT" == *"UserAlreadyExists"* ]] || [[ "$MIGRATION_OUTPUT" == *"User default_user@example.com already exists"* ]]; then
|
||||||
echo "Warning: Default user already exists, continuing startup..."
|
echo "Warning: Default user already exists, continuing startup..."
|
||||||
else
|
else
|
||||||
echo "Migration failed with unexpected error:"
|
echo "Migration failed with unexpected error."
|
||||||
echo "$MIGRATION_OUTPUT"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
echo "Database migrations done."
|
echo "Database migrations done."
|
||||||
|
|
||||||
echo "Starting server..."
|
echo "Starting server..."
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "cognee"
|
name = "cognee"
|
||||||
version = "0.1.40"
|
version = "0.1.41"
|
||||||
description = "Cognee - is a library for enriching LLM context with a semantic layer for better understanding and reasoning."
|
description = "Cognee - is a library for enriching LLM context with a semantic layer for better understanding and reasoning."
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Vasilije Markovic" },
|
{ name = "Vasilije Markovic" },
|
||||||
|
|
|
||||||
2
uv.lock
generated
2
uv.lock
generated
|
|
@ -859,7 +859,7 @@ wheels = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cognee"
|
name = "cognee"
|
||||||
version = "0.1.40"
|
version = "0.1.41"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "aiofiles" },
|
{ name = "aiofiles" },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue