manual тест для проверки новых моделей
This commit is contained in:
parent
cbba336049
commit
507268b2c1
1 changed files with 15 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import asyncio
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from lambda_agent_api.agent_api import AgentApi
|
from lambda_agent_api.agent_api import AgentApi
|
||||||
from lambda_agent_api.server import MsgEventTextChunk
|
from lambda_agent_api.server import MsgEventTextChunk, MsgEventToolCallChunk, MsgEventToolResult
|
||||||
|
|
||||||
|
|
||||||
def my_callback(message):
|
def my_callback(message):
|
||||||
|
|
@ -17,9 +17,21 @@ async def main():
|
||||||
try:
|
try:
|
||||||
prompt = await asyncio.get_event_loop().run_in_executor(None, input, ">>> ")
|
prompt = await asyncio.get_event_loop().run_in_executor(None, input, ">>> ")
|
||||||
print("Agent: ", end="")
|
print("Agent: ", end="")
|
||||||
|
is_tool = False
|
||||||
async for chunk in api.send_message(prompt):
|
async for chunk in api.send_message(prompt):
|
||||||
if isinstance(chunk, MsgEventTextChunk):
|
match chunk:
|
||||||
print(chunk.text, end="", flush=True)
|
case MsgEventTextChunk():
|
||||||
|
is_tool = True
|
||||||
|
print(chunk.text, end="", flush=True)
|
||||||
|
case MsgEventToolCallChunk():
|
||||||
|
if not is_tool:
|
||||||
|
print(f"\n\n### TOOL CALL: ({chunk.tool_name}) ", end="", flush=True)
|
||||||
|
is_tool = True
|
||||||
|
print(chunk.args_chunk, end="", flush=True)
|
||||||
|
case MsgEventToolResult():
|
||||||
|
is_tool = False
|
||||||
|
print(f"\nResult: {chunk.result}\n\n", end="", flush=True)
|
||||||
|
|
||||||
print("\n")
|
print("\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue