routing.py
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from pydantic import BaseModel, Field
from typing import Optional, List, Dict, Any
from datetime import datetime
class ChatCompletionRequest(BaseModel):
session_id: str = Field(..., max_length=64)
user_id: str = Field(..., max_length=64)
channel: str = Field(..., max_length=64)
query: str = Field(..., min_length=1, max_length=5000)
mentioned_agent_code: Optional[str] = Field(None, max_length=100)
file_url: Optional[str] = Field(None, max_length=500)
class RoutingInfo(BaseModel):
agent_id: int
agent_code: str
agent_name: str
routing_reason: str
class IntentInfo(BaseModel):
intent: str
confidence: float = 0.0
class HandoffInfo(BaseModel):
from_agent_id: Optional[int] = None
from_agent_name: Optional[str] = None
to_agent_id: int
to_agent_name: str
handoff_message: str
class ChatCompletionResponse(BaseModel):
session_id: str
routing: RoutingInfo
intent: Optional[IntentInfo] = None
handoff: Optional[HandoffInfo] = None
response_content: Optional[str] = None
created_at: datetime
class FileUploadResponse(BaseModel):
file_url: str
file_name: str
file_size: int
extracted_text: Optional[str] = None
session_id: str