Closed Chronoz closed 10 months ago
same here, using litellm
The issue might be due to an incorrect response from LLM, as we verify all required fields in the generated JSON text. If any missing fields are found, an exception arises.
You must set llm.response_format parameter in json config file of taskweaver to "text". The api on local llm cannot talk in the default json setting.
I get a similar error running local model - but not every time: Error: Cannot process your request due to Exception: 'NoneType' object has no attribute 'content' Traceback (most recent call last): File "C:\PythonPlay\TaskWeaver\taskweaver\session\session.py", line 125, in send_message post = _send_message(post.send_to, post) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\PythonPlay\TaskWeaver\taskweaver\session\session.py", line 107, in _send_message reply_post = self.code_interpreter.reply( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\PythonPlay\TaskWeaver\taskweaver\code_interpreter\code_interpreter.py", line 70, in reply code.content, ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'content'
Same issue; however I keep getting consistently the same error. I'm stuck with this basically. This was the prompt: "Process the PDF file you can find in the sample_data folder, and add up all the expenses making sure all the ammounts in Euros are first converted to USD and then summed to all the amounts that were already reported in USD"
It starts off nicely making a plan:
>>> [INIT_PLAN]
1. Locate and read the PDF file in the sample_data folder
2. Extract text from the PDF file <sequential depend on 1>
3. Identify and extract amounts in Euros and USD from the text <sequential depend on 2>
4. Convert amounts in Euros to USD <sequential depend on 3>
5. Sum all amounts in USD <sequential depend on 4>
>>> [PLAN]
1. Locate and read the PDF file in the sample_data folder
2. Extract text from the PDF file
3. Identify and extract amounts in Euros and USD from the text
4. Convert amounts in Euros to USD
5. Sum all amounts in USD
>>> [CURRENT_PLAN_STEP]
Locate and read the PDF file in the sample_data folder
>>> [SEND_TO]
CodeInterpreter
>>> [MESSAGE]
Please locate and read the PDF file in the sample_data folder.
>>> [PLANNER->CODEINTERPRETER]
Please locate and read the PDF file in the sample_data folder.
But then always fails like below, apparently over the first step to locate and read the PDF:
Error: Cannot process your request due to Exception: 'NoneType' object has no attribute 'content'
Traceback (most recent call last):
File "/Users/~~~~~~/Development/code/TW/TaskWeaver/taskweaver/session/session.py", line 125, in send_message
post = _send_message(post.send_to, post)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/~~~~~~/Development/code/TW/TaskWeaver/taskweaver/session/session.py", line 107, in _send_message
reply_post = self.code_interpreter.reply(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/~~~~~~/Development/code/TW/TaskWeaver/taskweaver/code_interpreter/code_interpreter.py", line 70, in reply
code.content,
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'content'
I even tried 1) feeding it a much smaller PDF file (about 7 pages) and 2) actually parsing the PDF file and manually converting it to a txt file with amounts in Euros or USD on each line. With quite surprise I found out that even feeding it a 28 lines of text (each amount on its line), will still lead to the very same error reported above 😵💫
Taskweaver does not "see" the sample_data folder - I had the same problem. Once you start a new taskweaver session, you have to find the latest session directory and go into the "cwd" directory of it (cwd stands for current working directory). If you put your file in there, you can then refer to it by name without a path and it will see it. I still have the errors above but it does find and work with my file.
Yeah thanks for the advice; I tried putting the file in the cwd
folder and it seems like it's able to find the file. But yeah after all I'm still ending up with the same AttributeError: 'NoneType' object has no attribute 'content'
Yes, I find if I keep the tasks simple or give it one step at a time, I can sometimes get things to complete without the error. I wonder what triggers that problem.
Describe the bug Planner failed to generate response because Post send_to field is None
To Reproduce Steps to reproduce the behavior: I use local llm from lmstudio server
Expected behavior A clear and concise description of what you expected to happen. NA if feel not applicable. with config_file as: { "llm.api_base": "http://localhost:1234/v1", "llm.api_key": "sk-123", "llm.model": "openhermes-2.5-mistral-7b.Q4_K_S.gguf" } { "llm.api_base": "http://localhost:1234/v1", "llm.api_key": "sk-123", "llm.model": "openhermes-2.5-mistral-7b.Q4_K_S.gguf" } THE PROMPT Human: print out 5 prime numbers
AFTER 5 mins Error: Cannot process your request due to Exception: Planner failed to generate response because Post send_to field is None Traceback (most recent call last): File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 198, in reply response_post = self.planner_post_translator.raw_text_to_post( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/tringuyen/TaskWeaver/taskweaver/role/translator.py", line 65, in raw_text_to_post validation_func(post) File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 190, in check_post_validity assert post.send_to is not None, "Post send_to field is None" ^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: Post send_to field is None
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/tringuyen/TaskWeaver/taskweaver/session/session.py", line 125, in send_message post = _send_message(post.send_to, post) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/tringuyen/TaskWeaver/taskweaver/session/session.py", line 97, in _send_message reply_post = self.planner.reply( ^^^^^^^^^^^^^^^^^^^ File "/Users/tringuyen/TaskWeaver/taskweaver/planner/planner.py", line 219, in reply raise Exception(f"Planner failed to generate response because {str(e)}") Exception: Planner failed to generate response because Post send_to field is None
Screenshots If applicable, add screenshots to help explain your problem.
Environment Information (please complete the following information):