-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter_schemas.py
More file actions
85 lines (65 loc) · 3.31 KB
/
Copy pathrouter_schemas.py
File metadata and controls
85 lines (65 loc) · 3.31 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
import datetime
from pydantic import BaseModel, Field
from typing import Union, List, Any, Tuple, Dict
from fastapi import FastAPI, File, UploadFile, Form
from typing_extensions import Annotated
class EmbeddingRequest(BaseModel):
text: Union[str, List[str]]
token: str
model: str
class EmbeddingResponse(BaseModel):
request_id: str = Field(description="请求ID")
vector: List[List[float]] = Field(description="文本对应的向量表示")
response_code: int = Field(description="响应代码,用于表示成功或错误状态")
response_msg: str = Field(description="响应信息,详细描述响应状态或错误信息")
process_status: str = Field(description="处理状态,例如 'completed'、'pending' 或 'failed'")
processing_time: float = Field(description="处理请求的耗时(秒)")
class RerankRequest(BaseModel):
text_pair: List[Tuple[str, str]]
token: str
model: str
class RerankResponse(BaseModel):
request_id: str = Field(description="请求ID")
vector: List[float]
response_code: int = Field(description="响应代码,用于表示成功或错误状态")
response_msg: str = Field(description="响应信息,详细描述响应状态或错误信息")
process_status: str = Field(description="处理状态,例如 'completed'、'pending' 或 'failed'")
processing_time: float = Field(description="处理请求的耗时(秒)")
class KnowledgeRequest(BaseModel):
category: str
title: str
class KnowledgeResponse(BaseModel):
request_id: str = Field(description="请求ID")
knowledge_id: int
category: str
title: str
response_code: int = Field(description="响应代码,用于表示成功或错误状态")
response_msg: str = Field(description="响应信息,详细描述响应状态或错误信息")
process_status: str = Field(description="处理状态,例如 'completed'、'pending' 或 'failed'")
processing_time: float = Field(description="处理请求的耗时(秒)")
class DocumentRequest(BaseModel):
knowledge_id: int = Annotated[str, Form()],
title: str = Annotated[str, Form()],
category: str = Annotated[str, Form()],
file: UploadFile = Annotated[str, File(...)]
class DocumentResponse(BaseModel):
request_id: str = Field(description="请求ID")
document_id: int
category: str
title: str
knowledge_id: int
file_type: str
response_code: int = Field(description="响应代码,用于表示成功或错误状态")
response_msg: str = Field(description="响应信息,详细描述响应状态或错误信息")
process_status: str = Field(description="处理状态,例如 'completed'、'pending' 或 'failed'")
processing_time: float = Field(description="处理请求的耗时(秒)")
class RAGRequest(BaseModel):
knowledge_id: int
message: List[Dict]
class RAGResponse(BaseModel):
request_id: str = Field(description="请求ID")
message: List[Dict]
response_code: int = Field(description="响应代码,用于表示成功或错误状态")
response_msg: str = Field(description="响应信息,详细描述响应状态或错误信息")
process_status: str = Field(description="处理状态,例如 'completed'、'pending' 或 'failed'")
processing_time: float = Field(description="处理请求的耗时(秒)")