-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_schema.py
121 lines (69 loc) · 2.3 KB
/
api_schema.py
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
from typing import List, Optional
from pydantic import BaseModel
from DATABASE.schemas import Index # type: ignore
IndexStatusDict = {
-1: "FAILED",
0: "INDEXED",
1: "INDEXING",
}
class BaseResponse(BaseModel):
error: Optional[str]
class BaseSearchRequest(BaseModel):
index_name: str
limit: int = 3
class GetTextEmbeddingsRequest(BaseModel):
text: List[str]
class GetTextEmbeddingsResponse(BaseResponse):
embeddings: Optional[List[List[float]]]
class GetImageEmbeddingsRequest(BaseModel):
image_paths: List[str]
class GetImageEmbeddingsResponse(BaseResponse):
embeddings: Optional[List[List[float]]]
class GetImageCaptionRequest(BaseModel):
image_path: List[str]
class GetImageCaptionResponse(BaseResponse):
caption: Optional[List[str]]
class GetCaptionWithEmbeddingsRequest(BaseModel):
image_paths: List[str]
class GetCaptionWithEmbeddingsResponse(BaseResponse):
caption: Optional[List[str]]
text_embeddings: Optional[List[List[float]]]
image_embeddings: Optional[List[List[float]]]
class CreateIndexingTaskRequest(BaseModel):
folder_path: str
class GetIndexingTaskRequest(BaseModel):
task_id: str
class TaskData(BaseResponse):
status: str
caption_embeddings: Optional[List[List[float]]]
image_embeddings: Optional[List[List[float]]]
file_paths: Optional[List[str]]
folder_path: str
class GetIndexingTaskResponse(BaseResponse):
task_id: str
status: str
data: Optional[TaskData]
class IndexDirRequest(BaseModel):
dir_path: str
class CreateIndexingTaskResponse(BaseResponse):
task_id: Optional[str]
class IndexDirResponse(BaseResponse):
index_id: Optional[str]
class GetAllIndexResponse(BaseResponse):
data: Optional[List[Index]]
class GetIndexStatusResponse(BaseResponse):
data: Optional[int]
status_name: Optional[str]
class SearchByTextRequest(BaseSearchRequest):
search_string: str
class SearchResultDataResponse(BaseModel):
img_paths: Optional[List[str]]
img_distances: Optional[List[float]]
class BaseSearchResultResponse(BaseResponse):
data: Optional[SearchResultDataResponse]
class SearchByImageRequest(BaseSearchRequest):
pass
class DeleteIndexRequest(BaseModel):
index_id: str
class DeleteIndexResponse(BaseResponse):
data: Optional[str]