Spaces:
Sleeping
Sleeping
Update apis/chat_api.py
Browse files- apis/chat_api.py +8 -1
apis/chat_api.py
CHANGED
@@ -208,6 +208,13 @@ class ChatAPIApp:
|
|
208 |
)
|
209 |
|
210 |
data_response = streamer.chat_return_dict(stream_response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
return data_response
|
212 |
except HfApiException as e:
|
213 |
raise HTTPException(status_code=e.status_code, detail=e.detail)
|
@@ -342,7 +349,7 @@ class ChatAPIApp:
|
|
342 |
return {
|
343 |
"object":"list",
|
344 |
"data":[
|
345 |
-
"object": "embedding", "index": 0, "embedding": embeddings.tolist()
|
346 |
],
|
347 |
"model": model,
|
348 |
"usage":{},
|
|
|
208 |
)
|
209 |
|
210 |
data_response = streamer.chat_return_dict(stream_response)
|
211 |
+
print(data_response)
|
212 |
+
data_response = {
|
213 |
+
"model": data_response.get('model'),
|
214 |
+
"created_at": data_response.get('created'),
|
215 |
+
"response": data_response["choices"][0]["message"]["content"],
|
216 |
+
"done": True,
|
217 |
+
}
|
218 |
return data_response
|
219 |
except HfApiException as e:
|
220 |
raise HTTPException(status_code=e.status_code, detail=e.detail)
|
|
|
349 |
return {
|
350 |
"object":"list",
|
351 |
"data":[
|
352 |
+
{"object": "embedding", "index": 0, "embedding": embeddings.tolist()}
|
353 |
],
|
354 |
"model": model,
|
355 |
"usage":{},
|