Update apis/chat_api.py
Browse files- apis/chat_api.py +9 -2
apis/chat_api.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import argparse
|
| 2 |
import os
|
| 3 |
import sys
|
|
|
|
|
|
|
| 4 |
import uvicorn
|
| 5 |
|
| 6 |
from fastapi import FastAPI, Depends
|
|
@@ -15,6 +17,11 @@ from mocks.stream_chat_mocker import stream_chat_mock
|
|
| 15 |
|
| 16 |
|
| 17 |
class ChatAPIApp:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
def __init__(self):
|
| 19 |
self.app = FastAPI(
|
| 20 |
docs_url="/",
|
|
@@ -34,14 +41,14 @@ class ChatAPIApp:
|
|
| 34 |
"id": "mixtral-8x7b",
|
| 35 |
"description": "[mistralai/Mixtral-8x7B-Instruct-v0.1]: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 36 |
"object": "model",
|
| 37 |
-
"created":
|
| 38 |
"owned_by": "mistralai",
|
| 39 |
},
|
| 40 |
{
|
| 41 |
"id": "mistral-7b",
|
| 42 |
"description": "[mistralai/Mistral-7B-Instruct-v0.2]: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2",
|
| 43 |
"object": "model",
|
| 44 |
-
"created":
|
| 45 |
"owned_by": "mistralai",
|
| 46 |
},
|
| 47 |
],
|
|
|
|
| 1 |
import argparse
|
| 2 |
import os
|
| 3 |
import sys
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
import time
|
| 6 |
import uvicorn
|
| 7 |
|
| 8 |
from fastapi import FastAPI, Depends
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
class ChatAPIApp:
|
| 20 |
+
# Get the current datetime
|
| 21 |
+
now = datetime.now()
|
| 22 |
+
|
| 23 |
+
# Convert the current datetime to a timestamp
|
| 24 |
+
timestamp = int(time.mktime(now.timetuple()))
|
| 25 |
def __init__(self):
|
| 26 |
self.app = FastAPI(
|
| 27 |
docs_url="/",
|
|
|
|
| 41 |
"id": "mixtral-8x7b",
|
| 42 |
"description": "[mistralai/Mixtral-8x7B-Instruct-v0.1]: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 43 |
"object": "model",
|
| 44 |
+
"created": str(timestamp),
|
| 45 |
"owned_by": "mistralai",
|
| 46 |
},
|
| 47 |
{
|
| 48 |
"id": "mistral-7b",
|
| 49 |
"description": "[mistralai/Mistral-7B-Instruct-v0.2]: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2",
|
| 50 |
"object": "model",
|
| 51 |
+
"created": str(timestamp),
|
| 52 |
"owned_by": "mistralai",
|
| 53 |
},
|
| 54 |
],
|