Skip to content

Fix reference to undefined dsp.passages2text #8204

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions dspy/propose/instruction_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class GenerateInstructionGivenAttempts(dspy.Signature):

Your task is to propose a new instruction that will lead a good language model to perform the task even better. Don't be afraid to be creative."""

attempted_instructions = dspy.InputField(format=dsp.passages2text)
# attempted_instructions = dspy.InputField(desc="Previously attempted task instructions, along with their resulting validation score, and an example of the instruction in use on a sample from our dataset.")
attempted_instructions = dspy.InputField(desc="Previously attempted task instructions, along with their resulting validation score, and an example of the instruction in use on a sample from our dataset.")
proposed_instruction = dspy.OutputField(desc="The improved instructions for the language model")
proposed_prefix_for_output_field = dspy.OutputField(desc="The string at the end of the prompt, which will help the model start solving the task")
23 changes: 23 additions & 0 deletions tests/propose/test_instruction_proposal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import dspy
from dspy.propose.instruction_proposal import GenerateInstructionGivenAttempts
from dspy.utils.dummies import DummyLM


def test_generate_instruction_given_attempts_minimal():
"""Test that the GenerateInstructionGivenAttempts signature initializes correctly"""

dummy_lm = DummyLM([{
"proposed_instruction": "Better instruction",
"proposed_prefix_for_output_field": "Result:",
}])
dspy.settings.configure(lm=dummy_lm)

# Create a predictor with the signature
predictor = dspy.Predict(GenerateInstructionGivenAttempts)

# Basic test - just ensure we can call it without errors
result = predictor(attempted_instructions=["Instruction #1: Test", "Score #1: 0.5"])

# Verify structure of the result
assert hasattr(result, "proposed_instruction")
assert hasattr(result, "proposed_prefix_for_output_field")