корректные pydantic модели для автоматического определения класса по полю type

This commit is contained in:
Егор Кандрушин 2026-04-02 00:40:30 +03:00
parent b34cbaf677
commit 1e256a545b
11 changed files with 294 additions and 148 deletions

24
tests/manual.py Normal file
View file

@ -0,0 +1,24 @@
import asyncio
from lambda_agent_api.agent_api import AgentApi
from lambda_agent_api.server import MsgEventTextChunk
def my_callback(message):
print(f"Callback: {message}")
async def main():
api = AgentApi("agent-1", "ws://localhost:8000/agent_ws/", callback=my_callback)
await api.connect()
try:
async for chunk in api.send_message("Привет, агент!"):
if isinstance(chunk, MsgEventTextChunk):
print(chunk.text, end="", flush=True)
finally:
await api.close()
asyncio.run(main())