added new optionals
This commit is contained in:
parent
5bc4a6cc02
commit
64d6d6ede2
5 changed files with 32 additions and 16 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
import sentry_sdk
|
|
||||||
from traceback import format_exc
|
from traceback import format_exc
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
|
|
@ -37,11 +36,18 @@ from cognee.api.v1.users.routers import (
|
||||||
logger = get_logger()
|
logger = get_logger()
|
||||||
|
|
||||||
if os.getenv("ENV", "prod") == "prod":
|
if os.getenv("ENV", "prod") == "prod":
|
||||||
sentry_sdk.init(
|
try:
|
||||||
dsn=os.getenv("SENTRY_REPORTING_URL"),
|
import sentry_sdk
|
||||||
traces_sample_rate=1.0,
|
|
||||||
profiles_sample_rate=1.0,
|
sentry_sdk.init(
|
||||||
)
|
dsn=os.getenv("SENTRY_REPORTING_URL"),
|
||||||
|
traces_sample_rate=1.0,
|
||||||
|
profiles_sample_rate=1.0,
|
||||||
|
)
|
||||||
|
except ImportError:
|
||||||
|
logger.info(
|
||||||
|
"Sentry SDK not available. Install with 'pip install cognee[monitoring]' to enable error monitoring."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
app_environment = os.getenv("ENV", "prod")
|
app_environment = os.getenv("ENV", "prod")
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@ def get_observe():
|
||||||
monitoring = get_base_config().monitoring_tool
|
monitoring = get_base_config().monitoring_tool
|
||||||
|
|
||||||
if monitoring == Observer.LANGFUSE:
|
if monitoring == Observer.LANGFUSE:
|
||||||
from langfuse.decorators import observe
|
try:
|
||||||
|
from langfuse.decorators import observe
|
||||||
|
|
||||||
return observe
|
return observe
|
||||||
|
except ImportError:
|
||||||
|
# Return a no-op decorator if Langfuse is not available
|
||||||
|
def noop_observe(func=None, **kwargs):
|
||||||
|
if func is None:
|
||||||
|
return lambda f: f
|
||||||
|
return func
|
||||||
|
|
||||||
|
return noop_observe
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import networkx
|
|
||||||
|
|
||||||
from cognee.shared.logging_utils import get_logger
|
from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.infrastructure.files.storage.LocalFileStorage import LocalFileStorage
|
from cognee.infrastructure.files.storage.LocalFileStorage import LocalFileStorage
|
||||||
|
|
@ -9,6 +8,13 @@ logger = get_logger()
|
||||||
|
|
||||||
|
|
||||||
async def cognee_network_visualization(graph_data, destination_file_path: str = None):
|
async def cognee_network_visualization(graph_data, destination_file_path: str = None):
|
||||||
|
try:
|
||||||
|
import networkx
|
||||||
|
except ImportError:
|
||||||
|
raise ImportError(
|
||||||
|
"NetworkX is not installed. Please install with 'pip install cognee[visualization]' to use graph visualization features."
|
||||||
|
)
|
||||||
|
|
||||||
nodes_data, edges_data = graph_data
|
nodes_data, edges_data = graph_data
|
||||||
|
|
||||||
G = networkx.DiGraph()
|
G = networkx.DiGraph()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import http.server
|
import http.server
|
||||||
import socketserver
|
import socketserver
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,12 @@ dependencies = [
|
||||||
"tiktoken>=0.8.0,<1.0.0",
|
"tiktoken>=0.8.0,<1.0.0",
|
||||||
"litellm>=1.71.0, <2.0.0",
|
"litellm>=1.71.0, <2.0.0",
|
||||||
"instructor>=1.9.1,<2.0.0",
|
"instructor>=1.9.1,<2.0.0",
|
||||||
"langfuse>=2.32.0,<3",
|
|
||||||
"filetype>=1.2.0,<2.0.0",
|
"filetype>=1.2.0,<2.0.0",
|
||||||
"aiohttp>=3.11.14,<4.0.0",
|
"aiohttp>=3.11.14,<4.0.0",
|
||||||
"aiofiles>=23.2.1,<24.0.0",
|
"aiofiles>=23.2.1,<24.0.0",
|
||||||
"rdflib>=7.1.4,<7.2.0",
|
"rdflib>=7.1.4,<7.2.0",
|
||||||
"pypdf>=4.1.0,<6.0.0",
|
"pypdf>=4.1.0,<6.0.0",
|
||||||
"jinja2>=3.1.3,<4",
|
"jinja2>=3.1.3,<4",
|
||||||
"matplotlib>=3.8.3,<4",
|
|
||||||
"networkx>=3.4.2,<4",
|
|
||||||
"lancedb>=0.24.0,<1.0.0",
|
"lancedb>=0.24.0,<1.0.0",
|
||||||
"alembic>=1.13.3,<2",
|
"alembic>=1.13.3,<2",
|
||||||
"pre-commit>=4.0.1,<5",
|
"pre-commit>=4.0.1,<5",
|
||||||
|
|
@ -51,10 +48,7 @@ dependencies = [
|
||||||
"fastapi>=0.115.7,<1.0.0",
|
"fastapi>=0.115.7,<1.0.0",
|
||||||
"python-multipart>=0.0.20,<1.0.0",
|
"python-multipart>=0.0.20,<1.0.0",
|
||||||
"fastapi-users[sqlalchemy]>=14.0.1,<15.0.0",
|
"fastapi-users[sqlalchemy]>=14.0.1,<15.0.0",
|
||||||
|
|
||||||
"sentry-sdk[fastapi]>=2.9.0,<3",
|
|
||||||
"structlog>=25.2.0,<26",
|
"structlog>=25.2.0,<26",
|
||||||
|
|
||||||
"pympler>=1.1,<2.0.0",
|
"pympler>=1.1,<2.0.0",
|
||||||
"onnxruntime>=1.0.0,<2.0.0",
|
"onnxruntime>=1.0.0,<2.0.0",
|
||||||
"pylance>=0.22.0,<1.0.0",
|
"pylance>=0.22.0,<1.0.0",
|
||||||
|
|
@ -141,6 +135,8 @@ dev = [
|
||||||
"mkdocstrings[python]>=0.26.2,<0.27",
|
"mkdocstrings[python]>=0.26.2,<0.27",
|
||||||
]
|
]
|
||||||
debug = ["debugpy>=1.8.9,<2.0.0"]
|
debug = ["debugpy>=1.8.9,<2.0.0"]
|
||||||
|
visualization = ["networkx>=3.4.2,<4", "matplotlib>=3.8.3,<4"]
|
||||||
|
monitoring = ["sentry-sdk[fastapi]>=2.9.0,<3", "langfuse>=2.32.0,<3"]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://www.cognee.ai"
|
Homepage = "https://www.cognee.ai"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue