Skip to content

Prompt changed based on when dspy.settings.configure(lm=lm) is executed. #1589

Open
@mikeedjones

Description

@mikeedjones

If you configure the LM (dspy.settings.configure(lm=lm)) before initializing your modules you get a different prompt to if you configure your LM after initializing your modules.

    dspy.settings.configure(lm=lm)
    pot = ChainOfThought(BasicQA)

Adds "reasoning" to the output signature.

    pot = ChainOfThought(BasicQA)
    dspy.settings.configure(lm=lm)

Adds "rationale" to the output signature.

Think its because the dspy.settings.lm is referenced in ChainOfThought.__init__:

        # Add "rationale" field to the output signature.
        if isinstance(dspy.settings.lm, dspy.LM):
            extended_signature = signature.prepend("reasoning", rationale_type, type_=str)
        else:
            extended_signature = signature.prepend("rationale", rationale_type, type_=str)

Maybe something to flag in migration docs or just to be aware of before this logic is removed when dsp.LM is removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions