@@ -143,8 +143,8 @@ async def lifespan(_app: FastAPI):
143
143
144
144
origins = ["*" ]
145
145
146
- APP = FastAPI (lifespan = lifespan )
147
- APP .add_middleware (
146
+ app = FastAPI (lifespan = lifespan )
147
+ app .add_middleware (
148
148
CORSMiddleware ,
149
149
allow_origins = origins ,
150
150
allow_credentials = True ,
@@ -177,7 +177,7 @@ async def __anext__(self):
177
177
raise StopAsyncIteration
178
178
179
179
180
- @APP .post ("/v1/chat/completions" )
180
+ @app .post ("/v1/chat/completions" )
181
181
async def request_chat_completion (request : ChatCompletionRequest ):
182
182
"""
183
183
Creates model response for the given chat conversation.
@@ -248,7 +248,7 @@ async def iter_response():
248
248
)
249
249
250
250
251
- @APP .post ("/v1/completions" )
251
+ @app .post ("/v1/completions" )
252
252
async def request_completion (request : CompletionRequest ):
253
253
"""
254
254
Creates a completion for a given prompt.
@@ -309,7 +309,7 @@ async def iter_response():
309
309
)
310
310
311
311
312
- @APP .post ("/v1/embeddings" )
312
+ @app .post ("/v1/embeddings" )
313
313
async def request_embeddings (request : EmbeddingsRequest ):
314
314
"""
315
315
Gets embedding for some text.
@@ -335,23 +335,23 @@ async def request_embeddings(request: EmbeddingsRequest):
335
335
)
336
336
337
337
338
- @APP .post ("/chat/reset" )
338
+ @app .post ("/chat/reset" )
339
339
async def reset ():
340
340
"""
341
341
Reset the chat for the currently initialized model.
342
342
"""
343
343
session ["chat_mod" ].reset_chat ()
344
344
345
345
346
- @APP .get ("/stats" )
346
+ @app .get ("/stats" )
347
347
async def read_stats ():
348
348
"""
349
349
Get the runtime stats.
350
350
"""
351
351
return session ["chat_mod" ].stats ()
352
352
353
353
354
- @APP .get ("/verbose_stats" )
354
+ @app .get ("/verbose_stats" )
355
355
async def read_stats_verbose ():
356
356
"""
357
357
Get the verbose runtime stats.
0 commit comments