Spaces:
Runtime error
Runtime error
Add initial project structure with environment configuration, README, and core functionality
5606ca5 Download app.py from MukeshKapoor25/rca_sqlagent: direct link, hf CLI and curl.
- Browser
- Download file 587 Bytes
-
https://huggingface.co/spaces/MukeshKapoor25/rca_sqlagent/resolve/main/app.py
- Command line
-
hf download hf://spaces/MukeshKapoor25/rca_sqlagent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/MukeshKapoor25/rca_sqlagent/resolve/main/app.py
587 Bytes
| 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': ...}"} | |