Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): ReAct doesn't use instructions from the given Signature #992

Merged
merged 2 commits into from
May 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/predict/test_react.py
Original file line number Diff line number Diff line change
@@ -154,3 +154,16 @@ def test_custom_tools():
"Thought 3: Even more thoughts\n\n"
"Action 3: Finish[baz]"
)


def test_signature_instructions():
class ExampleSignature(dspy.Signature):
"""You are going to generate output based on input."""

input = dspy.InputField()
output = dspy.OutputField()

react = dspy.ReAct(ExampleSignature)

assert react.react[0].signature.instructions is not None
assert react.react[0].signature.instructions.startswith("You are going to generate output based on input.")