Skip to content

Fix PredictModel to return correct output fields #55

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 3 commits into
base: main
Choose a base branch
from

Conversation

reyna-abhyankar
Copy link
Contributor

Modify PredictModel (in DSPy connector) to directly use the DSPy output parsing instead of enforcing our StructuredModel

Also, remove deletion of reasoning field from signature to maintain compatibility with user's original workflow.

@reyna-abhyankar reyna-abhyankar changed the title Fix PredictModel to return output fields Fix PredictModel to return correct output fields Mar 21, 2025
warnings.warn(
"Original module contained reasoning. This will be stripped. Add reasoning as a cog instead",
f"DSPy module {name} contained reasoning. This may lead to undefined behavior.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs more explanation to the user. say something like Cognify performs its own reasoning prompt optimization automatically, which may not work well together with DSPy's; consider removing DSPy's reasoning prompts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

UserWarning,
)

if isinstance(dspy_predictor, dspy.Retrieve):
warnings.warn(
"Original module is a `Retrieve`. This will be ignored", UserWarning
"Original module is a `dspy.Retrieve`. This will be ignored", UserWarning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this retrive mean? why ignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dspy.Retrieve is their retriever. They still consider retrieval to be a "module", and since we don't optimize retrieval, I just ignore it. This means whenever it gets called in the actual workflow, we will call the original retrieve module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants