Hansimov commited on
Commit
60bb91e
1 Parent(s): bb37148

:gem: [Feature] ChatAPIApp: get_available_models()

Browse files
apis/__init__.py ADDED
File without changes
apis/chat_api.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import uvicorn
2
+
3
+ from fastapi import FastAPI
4
+ from pydantic import BaseModel, Field
5
+ from conversations import ConversationSession
6
+
7
+
8
+ class ChatAPIApp:
9
+ def __init__(self):
10
+ self.app = FastAPI(
11
+ docs_url="/",
12
+ title="Bing Chat API",
13
+ version="1.0",
14
+ )
15
+ self.setup_routes()
16
+
17
+ def get_available_models(self):
18
+ self.available_models = [
19
+ {
20
+ "id": "bing-precise",
21
+ "description": "Bing (Precise): Concise and straightforward.",
22
+ },
23
+ {
24
+ "id": "bing-balanced",
25
+ "description": "Bing (Balanced): Informative and friendly.",
26
+ },
27
+ {
28
+ "id": "bing-creative",
29
+ "description": "Bing (Creative): Original and imaginative.",
30
+ },
31
+ {
32
+ "id": "bing-precise-offline",
33
+ "description": "Bing (Precise): (No Internet) Concise and straightforward.",
34
+ },
35
+ {
36
+ "id": "bing-balanced-offline",
37
+ "description": "Bing (Balanced): (No Internet) Informative and friendly.",
38
+ },
39
+ {
40
+ "id": "bing-creative-offline",
41
+ "description": "Bing (Creative): (No Internet) Original and imaginative.",
42
+ },
43
+ ]
44
+ return self.available_models
45
+
46
+ def setup_routes(self):
47
+ self.app.get(
48
+ "/models",
49
+ summary="Get available models",
50
+ )(self.get_available_models)
51
+
52
+
53
+ app = ChatAPIApp().app
54
+
55
+ if __name__ == "__main__":
56
+ uvicorn.run("__main__:app", host="0.0.0.0", port=22222, reload=True)
docs/bing-chat-api-cli.png CHANGED