Ich habe ein einfaches Lama-Index Agentworkflow basiert auf dem ersten Beispiel aus diesem Beispiel eines Notizbuchs für Lama-Index-Dokument: < /p>
from llama_index.core.agent.workflow import AgentWorkflow
import asyncio
async def magic_number():
"""Get the magic number."""
print("Here")
await asyncio.sleep(1)
return 42
workflow = AgentWorkflow.from_tools_or_functions(
[magic_number],
verbose=True,
llm=llm #
, was diesen Fehler erzeugt: < /p>
Running step init_run
Step init_run produced event AgentInput
Executing , instance=, context=)() at workflow.py:553>
source_traceback: Object created at (most recent call last):
File "test.py", line 36, in
asyncio.run(main(), debug=True)
File "runners.py", line 194, in run
return runner.run(main)
File "runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "base_events.py", line 708, in run_until_complete
self.run_forever()
File "base_events.py", line 679, in run_forever
self._run_once()
File "base_events.py", line 2019, in _run_once
handle._run()
File "events.py", line 89, in _run
self._context.run(self._callback, *self._args)
File "workflow.py", line 553, in _run_workflow
result.set_exception(e)
Traceback (most recent call last):
File "workflow.py", line 304, in _task
new_ev = await instrumented_step(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "dispatcher.py", line 368, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "multi_agent_workflow.py", line 329, in run_agent_step
agent_output = await agent.take_step(
^^^^^^^^^^^^^^^^^^^^^^
......
)
^
File "function_agent.py", line 48, in take_step
async for last_chat_response in response:
......
)
File "callbacks.py", line 88, in wrapped_gen
async for x in f_return_val:
......
last_response = x
File "base.py", line 495, in gen
tool_use = content_block_start["toolUse"]
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'toolUse'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "events.py", line 89, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "dispatcher.py", line 286, in handle_future_result
raise exception
File "workflow.py", line 542, in _run_workflow
raise exception_raised
File "workflow.py", line 311, in _task
raise WorkflowRuntimeError(
f"Error in step '{name}': {e!s}"
) from e
llama_index.core.workflow.errors.WorkflowRuntimeError: Error in step 'run_agent_step': 'toolUse'
Traceback (most recent call last):
File "workflow.py", line 304, in _task
new_ev = await instrumented_step(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "dispatcher.py", line 368, in async_wrapper
result = await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "multi_agent_workflow.py", line 329, in run_agent_step
agent_output = await agent.take_step(
^^^^^^^^^^^^^^^^^^^^^^
......
)
^
File "function_agent.py", line 48, in take_step
async for last_chat_response in response:
......
)
File "callbacks.py", line 88, in wrapped_gen
async for x in f_return_val:
......
last_response = x
File "base.py", line 495, in gen
tool_use = content_block_start["toolUse"]
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'toolUse'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test.py", line 36, in
asyncio.run(main(), debug=True)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "base_events.py", line 721, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "test.py", line 31, in main
result = await workflow.run(user_msg="Get the magic number")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "workflow.py", line 542, in _run_workflow
raise exception_raised
File "workflow.py", line 311, in _task
raise WorkflowRuntimeError(
f"Error in step '{name}': {e!s}"
) from e
llama_index.core.workflow.errors.WorkflowRuntimeError: Error in step 'run_agent_step': 'toolUse'
< /code>
Dies sollte einfacher sein als das Beispiel in den Dokumenten, aber ich erhalte diesen Fehler immer wieder. Kann mir jemand helfen, zu verstehen, warum?>
LAMA INDEX AGENTWORKFLOW WorkflowRuntimeError: Fehler in Schritt 'run_agent_step': 'Tooluse' ' ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post