Enseña tareas que ejeuta
This commit is contained in:
@@ -6,6 +6,7 @@ import html
|
||||
import os
|
||||
import json
|
||||
from contextlib import suppress
|
||||
from inspect import isawaitable
|
||||
from typing import Any, Dict, List, Optional, Set
|
||||
|
||||
import requests
|
||||
@@ -197,7 +198,7 @@ class TelegramKanBot:
|
||||
notified_tool_calls: Set[str] = set()
|
||||
response: Optional[RunOutput] = None
|
||||
try:
|
||||
run_result = await self.agent.arun(
|
||||
run_result = self.agent.arun(
|
||||
text,
|
||||
stream=True,
|
||||
stream_events=True,
|
||||
@@ -206,6 +207,12 @@ class TelegramKanBot:
|
||||
|
||||
if isinstance(run_result, RunOutput):
|
||||
response = run_result
|
||||
elif isawaitable(run_result):
|
||||
awaited_result = await run_result
|
||||
if isinstance(awaited_result, RunOutput):
|
||||
response = awaited_result
|
||||
else:
|
||||
raise RuntimeError("El agente devolvió un resultado inesperado.")
|
||||
else:
|
||||
async for event in run_result:
|
||||
if isinstance(event, RunOutput):
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user