mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
lint and format
This commit is contained in:
@@ -2,6 +2,7 @@ import anyio
|
||||
import httpx
|
||||
import orjson
|
||||
|
||||
|
||||
async def chat_with_endpoint():
|
||||
async with httpx.AsyncClient() as client:
|
||||
while True:
|
||||
@@ -14,9 +15,9 @@ async def chat_with_endpoint():
|
||||
print("\nModel: ", end="", flush=True)
|
||||
async with client.stream(
|
||||
"POST",
|
||||
"http://localhost:8000/chat/",
|
||||
"http://0.0.0.0:8080/v1/ml/chat/",
|
||||
data={"prompt": prompt},
|
||||
timeout=60
|
||||
timeout=60,
|
||||
) as response:
|
||||
async for chunk in response.aiter_lines():
|
||||
if chunk:
|
||||
@@ -26,5 +27,6 @@ async def chat_with_endpoint():
|
||||
except Exception as e:
|
||||
print(f"\nError parsing chunk: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
anyio.run(chat_with_endpoint)
|
||||
|
||||
Reference in New Issue
Block a user