Josh-XT / AGiXT

AGiXT is a dynamic AI Agent Automation Platform that seamlessly orchestrates instruction management and complex task execution across diverse AI providers. Combining adaptive memory, smart features, and a versatile plugin system, AGiXT delivers efficient and comprehensive AI solutions.
https://AGiXT.com
MIT License
2.61k stars 348 forks source link

Error with HuggingChat #172

Closed timuryung closed 1 year ago

timuryung commented 1 year ago

Description

With latest fix this error pops up Exception in thread Thread-2 (run_task): Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/Users/timur/Downloads/Agent-LLM-main/AgentLLM.py", line 333, in run_task result = self.execution_agent(task["task_name"], task["task_id"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/timur/Downloads/Agent-LLM-main/AgentLLM.py", line 316, in execution_agent return self.run(prompt) ^^^^^^^^^^^^^^^^ File "/Users/timur/Downloads/Agent-LLM-main/AgentLLM.py", line 119, in run self.response = self.instruct(prompt) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/timur/Downloads/Agent-LLM-main/provider/huggingchat.py", line 45, in instruct data = loads(chunk.decode("utf-8")[5:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

My prompt: Write tweet about AI

Steps to Reproduce the Bug

Create .env file with huggingface as AI provider Start backend Start frontend Set agent objective

Expected Behavior

Start the task execution

Actual Behavior

Falls with error

Additional Context / Screenshots

No response

Operating System

Python Version

Environment Type - Connection

Environment Type - Container

Acknowledgements

Josh-XT commented 1 year ago

Updated main branch with #174 changes. The streaming at chunking seemed to be causing this, so I disabled the streaming so that we'll just receive one response like the other providers give.