Skip to content

Commit 8bf4aa8

Browse files
committed
Implement argument name changes
1 parent bcaf13d commit 8bf4aa8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dspy/functional/functional.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self):
5353
self.__dict__[name] = attr.copy()
5454

5555

56-
def TypedChainOfThought(signature, instructions=None, rationale_type=None, *, max_retries=3) -> dspy.Module: # noqa: N802
56+
def TypedChainOfThought(signature, instructions=None, reasoning=None, *, max_retries=3) -> dspy.Module: # noqa: N802
5757
"""Just like TypedPredictor, but adds a ChainOfThought OutputField."""
5858
signature = ensure_signature(signature, instructions)
5959
output_keys = ", ".join(signature.output_fields.keys())
@@ -62,12 +62,12 @@ def TypedChainOfThought(signature, instructions=None, rationale_type=None, *, ma
6262
prefix="Reasoning: Let's think step by step in order to",
6363
desc="${produce the " + output_keys + "}. We ...",
6464
)
65-
rationale_type = rationale_type or DEFAULT_RATIONALE
65+
reasoning = reasoning or DEFAULT_RATIONALE
6666

6767
return TypedPredictor(
6868
signature.prepend(
6969
"reasoning",
70-
rationale_type,
70+
reasoning,
7171
),
7272
max_retries=max_retries,
7373
)

tests/functional/test_functional.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,20 +619,20 @@ class ScoredSignature(dspy.Signature):
619619
Proposed Signature: Output""")
620620

621621

622-
def test_custom_rationale_type():
622+
def test_custom_reasoning_field():
623623
class Question(pydantic.BaseModel):
624624
value: str
625625

626626
class QuestionSignature(dspy.Signature):
627627
topic: str = dspy.InputField()
628628
question: Question = dspy.OutputField()
629629

630-
rationale_type = dspy.OutputField(
630+
reasoning = dspy.OutputField(
631631
prefix="Custom Reasoning: Let's break this down. To generate a question about",
632632
desc="${topic}, we should ...",
633633
)
634634

635-
program = TypedChainOfThought(QuestionSignature, rationale_type=rationale_type)
635+
program = TypedChainOfThought(QuestionSignature, reasoning=reasoning)
636636

637637
expected = "What is the speed of light?"
638638
lm = DummyLM(["Thoughts", f'{{"value": "{expected}"}}'])

0 commit comments

Comments
 (0)