Spaces:
Runtime error
Runtime error
Add initial project structure with environment configuration, README, and core functionality
5606ca5 | from fastapi import FastAPI, HTTPException | |
| from pydantic import BaseModel | |
| import os | |
| from agent_core import get_sql_agent | |
| _db_chain = get_sql_agent(verbose=True) | |
| app = FastAPI() | |
| class QueryRequest(BaseModel): | |
| question: str | |
| def query_sql_agent(request: QueryRequest): | |
| try: | |
| result = _db_chain.invoke(request.question) | |
| return {"result": result} | |
| except Exception as e: | |
| raise HTTPException(status_code=500, detail=str(e)) | |
| def root(): | |
| return {"message": "RCA SQL Agent API. POST to /query with {'question': ...}"} | |