fix: Resolve syntax issue with cognify router
Resolve syntax issue with cognify router Fix
This commit is contained in:
parent
57ae93b3cd
commit
a42ab3e215
1 changed files with 6 additions and 4 deletions
|
|
@ -6,6 +6,8 @@ from fastapi.responses import JSONResponse
|
||||||
from cognee.modules.users.methods import get_authenticated_user
|
from cognee.modules.users.methods import get_authenticated_user
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
|
|
||||||
|
from cognee.shared.data_models import KnowledgeGraph
|
||||||
|
|
||||||
|
|
||||||
class CognifyPayloadDTO(BaseModel):
|
class CognifyPayloadDTO(BaseModel):
|
||||||
datasets: List[str]
|
datasets: List[str]
|
||||||
|
|
@ -32,10 +34,10 @@ def get_cognify_router() -> APIRouter:
|
||||||
GraphModelDynamic = json_to_pydantic_model("GraphModelDynamic", graph_model_schema)
|
GraphModelDynamic = json_to_pydantic_model("GraphModelDynamic", graph_model_schema)
|
||||||
graph_model_instance = GraphModelDynamic(**graph_model_schema)
|
graph_model_instance = GraphModelDynamic(**graph_model_schema)
|
||||||
print(graph_model_instance)
|
print(graph_model_instance)
|
||||||
else:
|
else:
|
||||||
graph_model_instance = None
|
graph_model_instance = KnowledgeGraph
|
||||||
try:
|
|
||||||
await cognee_cognify(payload.datasets, user, payload.graph_model)
|
await cognee_cognify(payload.datasets, user, graph_model_instance)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=409,
|
status_code=409,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue