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 uvicorn
|
||||
import sentry_sdk
|
||||
from traceback import format_exc
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import Request
|
||||
|
|
@ -37,11 +36,18 @@ from cognee.api.v1.users.routers import (
|
|||
logger = get_logger()
|
||||
|
||||
if os.getenv("ENV", "prod") == "prod":
|
||||
sentry_sdk.init(
|
||||
dsn=os.getenv("SENTRY_REPORTING_URL"),
|
||||
traces_sample_rate=1.0,
|
||||
profiles_sample_rate=1.0,
|
||||
)
|
||||
try:
|
||||
import sentry_sdk
|
||||
|
||||
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")
|
||||
|
|
|
|||
|
|
@ -6,6 +6,15 @@ def get_observe():
|
|||
monitoring = get_base_config().monitoring_tool
|
||||
|
||||
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 json
|
||||
import networkx
|
||||
|
||||
from cognee.shared.logging_utils import get_logger
|
||||
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):
|
||||
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
|
||||
|
||||
G = networkx.DiGraph()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
import requests
|
||||
from datetime import datetime, timezone
|
||||
import matplotlib.pyplot as plt
|
||||
import http.server
|
||||
import socketserver
|
||||
from threading import Thread
|
||||
|
|
|
|||
|
|
@ -34,15 +34,12 @@ dependencies = [
|
|||
"tiktoken>=0.8.0,<1.0.0",
|
||||
"litellm>=1.71.0, <2.0.0",
|
||||
"instructor>=1.9.1,<2.0.0",
|
||||
"langfuse>=2.32.0,<3",
|
||||
"filetype>=1.2.0,<2.0.0",
|
||||
"aiohttp>=3.11.14,<4.0.0",
|
||||
"aiofiles>=23.2.1,<24.0.0",
|
||||
"rdflib>=7.1.4,<7.2.0",
|
||||
"pypdf>=4.1.0,<6.0.0",
|
||||
"jinja2>=3.1.3,<4",
|
||||
"matplotlib>=3.8.3,<4",
|
||||
"networkx>=3.4.2,<4",
|
||||
"lancedb>=0.24.0,<1.0.0",
|
||||
"alembic>=1.13.3,<2",
|
||||
"pre-commit>=4.0.1,<5",
|
||||
|
|
@ -51,10 +48,7 @@ dependencies = [
|
|||
"fastapi>=0.115.7,<1.0.0",
|
||||
"python-multipart>=0.0.20,<1.0.0",
|
||||
"fastapi-users[sqlalchemy]>=14.0.1,<15.0.0",
|
||||
|
||||
"sentry-sdk[fastapi]>=2.9.0,<3",
|
||||
"structlog>=25.2.0,<26",
|
||||
|
||||
"pympler>=1.1,<2.0.0",
|
||||
"onnxruntime>=1.0.0,<2.0.0",
|
||||
"pylance>=0.22.0,<1.0.0",
|
||||
|
|
@ -141,6 +135,8 @@ dev = [
|
|||
"mkdocstrings[python]>=0.26.2,<0.27",
|
||||
]
|
||||
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]
|
||||
Homepage = "https://www.cognee.ai"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue