Closed lukakoning closed 1 month ago
Hi @lukakoning , dspy.ReAct is indeed experimental and may require some patches to the text parsing.
Could you try printing what the action
variable has before it is parsed? ideally, it should be the contents following "Action 2:"
Also, does this error come up when you remove the Assertions-related code? ReAct and Assertions haven't been fully tested together but curious if its on the latter's end for us to fix the parsing
Thanks for opening this! We released DSPy 2.5 yesterday. I think the new dspy.LM
and the underlying dspy.ChatAdapter
will probably resolve this problem.
Here's the (very short) migration guide, it should typically take you 2-3 minutes to change the LM definition and you should be good to go: https://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb
Please let us know if this resolves your issue. I will close for now but please feel free to re-open if the problem persists.
Hi, I have started to use DSPy, unfortunately I am running into issues with the ReAct-module.
I have this code:
Unfortunately, that leads to this error:
Traceback (most recent call last): File "<input>", line 30, in <module> File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\primitives\assertions.py", line 318, in forward return wrapped_forward(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\primitives\assertions.py", line 242, in wrapper result = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "<input>", line 16, in forward File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\primitives\program.py", line 26, in __call__ return self.forward(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\predict\react.py", line 114, in forward if action_val := self.act(output, hop): ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\predict\react.py", line 105, in act raise e File "C:\Users\dhrko\PycharmProjects\localllm-dspy\.venv\Lib\site-packages\dspy\predict\react.py", line 88, in act action_name, action_val = action.strip().split("\n")[0].split("[", 1) ^^^^^^^^^^^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 1)
When I inspect the history of the model, things do seem to look good:
Apparently something is wrong in the text parsing done by the ReAct module?