Closed peteryxu closed 2 days ago
That sounds good. Do you want to open a PR for it?
please do not introduce static delays, that is absolutely silly. ideally this would be called async from client.
However, in documentation it says task_result
should come back None if task_id is not ready. this is a bug @logan-markewich as correctly stated by @peteryxu since TaskResult is not accepting (**None) as parameter.
Thats what the try/except is for -- it raises an error saying that the result isn't ready. The code sample should probably either use a sleep or a try-except.
(Originally I had it returning None
, but thought raising an error is a bit more informative)
@peteryxu was suggesting adding a delay for people who just copy-pasted the code example, not in the actual source code
@logan-markewich is right. This suggestion is just to make the docs work out of box, and developer first time experience MATTERs for adoption! We could point out this is NOT supposed for production code use.
That sounds good. Do you want to open a PR for it?
I will do tomorrow after the holiday -:)
closed as fixed in PR#106
Following the docker sample readme.md, (https://github.com/peteryxu/llama-agents/tree/learn/examples/docker-kubernetes, ) running the Client test code, and got error below.
Traceback (most recent call last): File "..../llama-agents/zPX/examples/TESTclient.py", line 5, in
task_result = client.get_task_result(task_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pxu/CODE/GenAI4Code/llama-agents/.venv/lib/python3.12/site-packages/llama_agents/client/sync_client.py", line 135, in get_task_result
return TaskResult(task.state["result"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: llama_agents.types.TaskResult() argument after must be a mapping, not NoneType
Original Code ` from llama_agents import LlamaAgentsClient
client = LlamaAgentsClient("http://0.0.0.0:8001") task_id = client.create_task("What is the secret fact?") task_result = client.get_task_result(task_id) print(task_result.result) `
Simple fix: to add execution delay: ` import time
task_id = client.create_task("What is the secret fact?") time.sleep(10) task_result = client.get_task_result(task_id) `