ka1kuk commited on
Commit
9603906
1 Parent(s): 125cf33

Update apis/chat_api.py

Browse files
Files changed (1) hide show
  1. apis/chat_api.py +12 -1
apis/chat_api.py CHANGED
@@ -116,6 +116,17 @@ class ChatAPIApp:
116
  model_name: str = Field(..., example="bert-base-uncased")
117
  api_key: str = Field(..., example="your_hf_api_key_here")
118
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  class ChatCompletionsPostItem(BaseModel):
121
  model: str = Field(
@@ -237,7 +248,7 @@ class ChatAPIApp:
237
  prefix + "/embedding", # Use the specific prefix for this route
238
  summary="Generate embeddings for the given texts",
239
  include_in_schema=include_in_schema,
240
- response_model=List # Adapt based on your actual response model
241
  )(self.embedding)
242
 
243
 
 
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(
 
248
  prefix + "/embedding", # Use the specific prefix for this route
249
  summary="Generate embeddings for the given texts",
250
  include_in_schema=include_in_schema,
251
+ response_model=EmbeddingResponse # Adapt based on your actual response model
252
  )(self.embedding)
253
 
254