-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodels.py
More file actions
90 lines (78 loc) · 3 KB
/
Copy pathmodels.py
File metadata and controls
90 lines (78 loc) · 3 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from pydantic import BaseModel, Field
from typing import Optional, List, Dict, Any
class QueryRequest(BaseModel):
"""쿼리 요청 모델"""
query: str = Field(..., description="처리할 쿼리", min_length=1)
class Config:
json_schema_extra = {
"example": {
"query": "컨테이너 하역 시 안전 규정에 대해 알려주세요"
}
}
class ToolCall(BaseModel):
tool: str
source_file: Optional[str] = None
# 최종 응답을 위한 모델
class QueryResponse(BaseModel):
answer: str
query: str
tool_calls: List[ToolCall]
iterations: int
success: bool
# class ToolCall(BaseModel):
# """도구 호출 정보 모델"""
# tool: str = Field(..., description="사용된 도구명")
# arguments: Optional[Dict[str, Any]] = Field(None, description="도구 인자")
# class Config:
# json_schema_extra = {
# "example": {
# "tool": "regulation_search",
# "arguments": {"keyword": "안전규정"}
# }
# }
# class QueryResponse(BaseModel):
# """쿼리 응답 모델"""
# answer: str = Field(..., description="Agent의 답변")
# query: str = Field(..., description="원본 쿼리")
# tool_calls: List[ToolCall] = Field(default_factory=list, description="사용된 도구들")
# iterations: int = Field(default=1, description="처리 반복 횟수")
# success: bool = Field(default=True, description="처리 성공 여부")
# class Config:
# json_schema_extra = {
# "example": {
# "answer": "컨테이너 하역 시에는 다음과 같은 안전 규정을 준수해야 합니다...",
# "query": "컨테이너 하역 시 안전 규정에 대해 알려주세요",
# "tool_calls": [
# {
# "tool": "regulation_search",
# "arguments": {"keyword": "안전규정"}
# }
# ],
# "iterations": 2,
# "success": True
# }
# }
class HealthResponse(BaseModel):
"""헬스 체크 응답 모델"""
status: str = Field(..., description="서버 상태")
agent_status: str = Field(..., description="Agent 상태")
api_version: str = Field(..., description="API 버전")
class Config:
json_schema_extra = {
"example": {
"status": "healthy",
"agent_status": "ready",
"api_version": "1.0.0"
}
}
class ErrorResponse(BaseModel):
"""에러 응답 모델"""
detail: str = Field(..., description="에러 상세 정보")
error_code: Optional[str] = Field(None, description="에러 코드")
class Config:
json_schema_extra = {
"example": {
"detail": "쿼리 처리 중 오류가 발생했습니다",
"error_code": "QUERY_PROCESSING_ERROR"
}
}