Update get_cognify_router.py
This commit is contained in:
parent
2f2aa81194
commit
dc37646df3
1 changed files with 4 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ from fastapi.responses import JSONResponse
|
|||
from cognee.modules.users.methods import get_authenticated_user
|
||||
from fastapi import Depends
|
||||
|
||||
|
||||
class CognifyPayloadDTO(BaseModel):
|
||||
datasets: List[str]
|
||||
|
||||
|
|
@ -13,15 +14,15 @@ def get_cognify_router() -> APIRouter:
|
|||
router = APIRouter()
|
||||
|
||||
@router.post("/", response_model=None)
|
||||
async def cognify(payload: CognifyPayloadDTO, user: User = Depends(get_authenticated_user)):
|
||||
async def cognify(payload: CognifyPayloadDTO, user: User = Depends(get_authenticated_user), graph_model:BaseModel):
|
||||
""" This endpoint is responsible for the cognitive processing of the content."""
|
||||
from cognee.api.v1.cognify.cognify_v2 import cognify as cognee_cognify
|
||||
try:
|
||||
await cognee_cognify(payload.datasets, user)
|
||||
await cognee_cognify(payload.datasets, user, payload.graph_model)
|
||||
except Exception as error:
|
||||
return JSONResponse(
|
||||
status_code=409,
|
||||
content={"error": str(error)}
|
||||
)
|
||||
|
||||
return router
|
||||
return router
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue