dspy icon indicating copy to clipboard operation
dspy copied to clipboard

Line breaks missing from attribute descriptions

Open thomasahle opened this issue 5 months ago • 0 comments

I'm trying to use the following prompt:

    next_steps = dspy.OutputField(
        desc="""
List of 2-5 promising next steps.
Use the format: x op y = z (left: ns).
- x and y must be distinct numbers selected from the current list.
- op represents an operation, which can be one of the following: +, -, *, /.
- z is the result of the operation.
- ns represents the numbers remaining after the operation, with x and y removed from the list and z included. The numbers should be separated by spaces.
""",
    )

But when I inspect the call log, it has been changed to

Next Steps: List of 2-5 promising next steps. Use the format: x op y = z (left: ns). - x and y must be distinct numbers selected from the current list. - op represents an operation, which can be one of the following: +, -, *, /. - z is the result of the operation. - ns represents the numbers remaining after the operation, with x and y removed from the list and z included. The numbers should be separated by spaces.

I suspect this doesn't work as well as the bullet version.

Maybe having long prompts in desc like this is going against the spirit of DSPy. But until we can split up outputs into more composite datatypes (e.g. the pydantic work) this seems to be the best approach?

thomasahle avatar Feb 05 '24 04:02 thomasahle