added flight assesment agent withj third party free api
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -16,5 +16,6 @@ class ChatRequest(BaseModel):
|
||||
|
||||
|
||||
|
||||
|
||||
class SurveyRequest(BaseModel):
|
||||
job_id: str
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# api/models/responses.py
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
from typing import Dict
|
||||
class ChatResponse(BaseModel):
|
||||
status: str
|
||||
message: str
|
||||
|
||||
|
||||
|
||||
class SurveyAgentResponse(BaseModel):
|
||||
status: str
|
||||
result: Dict
|
||||
Binary file not shown.
+27
-4
@@ -1,17 +1,19 @@
|
||||
# api/routes/chat_ai.py
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from api.models.requests import ChatRequest, ChatMessage
|
||||
from api.models.responses import ChatResponse
|
||||
from api.models.requests import ChatRequest, ChatMessage,SurveyRequest
|
||||
from api.models.responses import ChatResponse,SurveyAgentResponse
|
||||
from api.dependencies.auth import get_api_key
|
||||
from src.llm.orchestrator import DroneBot, Message # Adjust import as needed
|
||||
from src.llm.agent.flight_assesment import DroneAssessmentAgent
|
||||
import json
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/chat-ai",
|
||||
prefix="/chat",
|
||||
tags=["chat"]
|
||||
)
|
||||
|
||||
@router.post("", response_model=ChatResponse)
|
||||
@router.post("/booking-assistant", response_model=ChatResponse)
|
||||
async def chat_ai(
|
||||
request: ChatRequest,
|
||||
_: str = Depends(get_api_key)
|
||||
@@ -36,3 +38,24 @@ async def chat_ai(
|
||||
status_code=500,
|
||||
detail=str(e)
|
||||
)
|
||||
|
||||
|
||||
@router.post("/analyse-survey", response_model=SurveyAgentResponse)
|
||||
async def run_survey_agent(
|
||||
request: SurveyRequest,
|
||||
_: str = Depends(get_api_key)
|
||||
):
|
||||
"""Chat with DroneBot using query and history."""
|
||||
try:
|
||||
from test2 import booking_form_input
|
||||
agent = DroneAssessmentAgent()
|
||||
result = await agent.run(booking_form_input)
|
||||
return SurveyAgentResponse(
|
||||
status="success",
|
||||
result=result
|
||||
)
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail=str(e)
|
||||
)
|
||||
Reference in New Issue
Block a user