mirror of
https://github.com/livekit/agents.git
synced 2026-12-06 03:08:33 +00:00
text: a tool lost with its worker settles as an internal error, read-back failures are logged, e2e tests follow the binding and routing contract
This commit is contained in:
1 parent
34118eedd8
commit
30fbb5ce4a
9 files changed
+209
-28
No files matched your search
@@ -373,9 +373,17 @@ def prepare_arguments(
|
||||
|
||||
async def render_read_back(prepared: _Prepared) -> ReadBackAnswer:
|
||||
assert isinstance(prepared.tool, FunctionTool) and prepared.tool.info.read_back
|
||||
question = prepared.tool.info.read_back(*prepared.args, **prepared.kwargs)
|
||||
if inspect.isawaitable(question):
|
||||
question = await question
|
||||
try:
|
||||
question = prepared.tool.info.read_back(*prepared.args, **prepared.kwargs)
|
||||
if inspect.isawaitable(question):
|
||||
question = await question
|
||||
except Exception:
|
||||
# the call settles as an internal error; the cause is only visible here
|
||||
logger.exception(
|
||||
"exception occurred while rendering a tool's read-back",
|
||||
extra={"function": prepared.tool.info.name},
|
||||
)
|
||||
raise
|
||||
if isinstance(question, InputRequired):
|
||||
return ReadBackAnswerInputRequired(question=question.question, verbatim=question.verbatim)
|
||||
return ReadBackAnswerQuestion(question=str(question))
|
||||
|
||||
Reference in new issue
Block a user