Skip to content

Commit

Permalink
[Fix][REST] Use lowered-cased "app" (mlc-ai#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
junrushao authored Oct 30, 2023
1 parent 0a9d6c7 commit 425a2cb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/mlc_chat/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ async def lifespan(_app: FastAPI):

origins = ["*"]

APP = FastAPI(lifespan=lifespan)
APP.add_middleware(
app = FastAPI(lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
Expand Down Expand Up @@ -177,7 +177,7 @@ async def __anext__(self):
raise StopAsyncIteration


@APP.post("/v1/chat/completions")
@app.post("/v1/chat/completions")
async def request_chat_completion(request: ChatCompletionRequest):
"""
Creates model response for the given chat conversation.
Expand Down Expand Up @@ -248,7 +248,7 @@ async def iter_response():
)


@APP.post("/v1/completions")
@app.post("/v1/completions")
async def request_completion(request: CompletionRequest):
"""
Creates a completion for a given prompt.
Expand Down Expand Up @@ -309,7 +309,7 @@ async def iter_response():
)


@APP.post("/v1/embeddings")
@app.post("/v1/embeddings")
async def request_embeddings(request: EmbeddingsRequest):
"""
Gets embedding for some text.
Expand All @@ -335,23 +335,23 @@ async def request_embeddings(request: EmbeddingsRequest):
)


@APP.post("/chat/reset")
@app.post("/chat/reset")
async def reset():
"""
Reset the chat for the currently initialized model.
"""
session["chat_mod"].reset_chat()


@APP.get("/stats")
@app.get("/stats")
async def read_stats():
"""
Get the runtime stats.
"""
return session["chat_mod"].stats()


@APP.get("/verbose_stats")
@app.get("/verbose_stats")
async def read_stats_verbose():
"""
Get the verbose runtime stats.
Expand Down

0 comments on commit 425a2cb

Please sign in to comment.