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