Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

added a test case to test instructions parsing in ReAct class

Yilin Xu7acf4c8a5dbb
diff --git a/tests/predict/test_react.py b/tests/predict/test_react.py
index 79f8e0bdf..9b187471b 100644
--- a/tests/predict/test_react.py
+++ b/tests/predict/test_react.py
@@ -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.")