ka1kuk commited on
Commit
50d64a6
1 Parent(s): 9603906

Update apis/chat_api.py

Browse files
Files changed (1) hide show
  1. apis/chat_api.py +13 -12
apis/chat_api.py CHANGED
@@ -20,6 +20,19 @@ from mocks.stream_chat_mocker import stream_chat_mock
20
 
21
  from fastapi.middleware.cors import CORSMiddleware
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  class ChatAPIApp:
24
  def __init__(self):
25
  self.app = FastAPI(
@@ -116,18 +129,6 @@ class ChatAPIApp:
116
  model_name: str = Field(..., example="bert-base-uncased")
117
  api_key: str = Field(..., example="your_hf_api_key_here")
118
 
119
- class EmbeddingResponseItem(BaseModel):
120
- object: str
121
- index: int
122
- embedding: List[List[List[float]]] # Adjust this based on the actual structure
123
-
124
- class EmbeddingResponse(BaseModel):
125
- object: str
126
- data: List[EmbeddingResponseItem]
127
- model: str
128
- usage: dict
129
-
130
-
131
  class ChatCompletionsPostItem(BaseModel):
132
  model: str = Field(
133
  default="mixtral-8x7b",
 
20
 
21
  from fastapi.middleware.cors import CORSMiddleware
22
 
23
+
24
+ class EmbeddingResponseItem(BaseModel):
25
+ object: str = "embedding"
26
+ index: int
27
+ embedding: List[float] # Adjust if your structure is different
28
+
29
+ class EmbeddingResponse(BaseModel):
30
+ object: str = "list"
31
+ data: List[EmbeddingResponseItem]
32
+ model: str
33
+ usage: Dict[str, Any]
34
+
35
+
36
  class ChatAPIApp:
37
  def __init__(self):
38
  self.app = FastAPI(
 
129
  model_name: str = Field(..., example="bert-base-uncased")
130
  api_key: str = Field(..., example="your_hf_api_key_here")
131
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  class ChatCompletionsPostItem(BaseModel):
133
  model: str = Field(
134
  default="mixtral-8x7b",