Skip to content

Commit 6f2db27

Browse files
committed
format code
1 parent 61ba8cc commit 6f2db27

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

app/api/ml.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
router = APIRouter()
1212

1313

14-
@router.post('/chat/')
15-
async def chat(
16-
prompt: Annotated[str, Form()],
17-
llm_service = Depends(get_llm_service)
18-
):
19-
return StreamingResponse(llm_service.stream_chat(prompt), media_type="text/plain")
14+
@router.post("/chat/")
15+
async def chat(prompt: Annotated[str, Form()], llm_service=Depends(get_llm_service)):
16+
return StreamingResponse(llm_service.stream_chat(prompt), media_type="text/plain")

tests/chat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ async def chat_with_endpoint():
1414

1515
print("\nModel: ", end="", flush=True)
1616
try:
17-
async with client.stream("POST", API_URL, data={"prompt": prompt}, timeout=60) as response:
17+
async with client.stream(
18+
"POST", API_URL, data={"prompt": prompt}, timeout=60
19+
) as response:
1820
async for chunk in response.aiter_lines():
1921
if not chunk:
2022
continue
@@ -28,4 +30,4 @@ async def chat_with_endpoint():
2830

2931

3032
if __name__ == "__main__":
31-
anyio.run(chat_with_endpoint)
33+
anyio.run(chat_with_endpoint)

0 commit comments

Comments
 (0)