Spaces:
Sleeping
Sleeping
from fastapi import APIRouter | |
from llama_index.core.settings import Settings | |
from src.models.workflow_graph import GraphInputSchema, GraphOutputSchema | |
from src.workflows.graph_workflow import DesignGraphWorkflow | |
# configurations | |
router = APIRouter() | |
async def read_root(): | |
return {'desc':"Graph Creation Workflow on User Intent is up!"} | |
async def interview_user(data: GraphInputSchema): | |
try: | |
graph_workflow = DesignGraphWorkflow(timeout=60, verbose=True) | |
graph_result = await graph_workflow.run(_project_description=data.desc, llm=Settings._llm) | |
return GraphOutputSchema(graph=graph_result) | |
except Exception as e: | |
return {"detail": f"Error processing {e}"} | |