feat(dspy): add metadata output, fix kwargs merging, and Mistral prompts#3161
Open
ahlemtr wants to merge 4 commits intodeepset-ai:mainfrom
Open
feat(dspy): add metadata output, fix kwargs merging, and Mistral prompts#3161ahlemtr wants to merge 4 commits intodeepset-ai:mainfrom
ahlemtr wants to merge 4 commits intodeepset-ai:mainfrom
Conversation
Contributor
Coverage report (dspy)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Author
|
This is my first-ever Pull Request to the Haystack core-integrations repository (and my first contribution ). Looking forward to the review and happy to make any adjustments needed! |
Member
|
Hello! Unfortunately, we are still working on the DSPy integration (not published yet), and I think those changes are not needed. If you want to contribute, I recommend reading the Contributing guidelines and looking at Contributions wanted issues. |
Member
|
@ahlemtr I missed providing more context to anakin87 yesterday. I'll take over the review and see how we can align this PR with the other work on the DSPy integration that is going on in parallel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Part of #1635
Proposed Changes:
Fix: Config Merging: Implemented deep-merge strategy {**self.generation_kwargs, **(generation_kwargs or {})} to prevent runtime overrides from dropping default parameters.
Feat: Metadata & Observability: Updated run/run_async to return a metadata dictionary containing DSPy rationale, model_name, and signature type.
Improvement: Mistral Support: Added conditional [INST] {prompt} [/INST] wrapping for Mistral models to ensure correct instruction-tuning syntax.
Infrastructure: Native Async: Fully implemented run_async via self._module.acall() for compatibility with Haystack AsyncPipeline.
How did you test it?
Unit tests: Verified logic across 40 tests including new cases for kwarg merging and metadata (hatch run test:unit).
Linters: Passed all formatting checks (hatch run default:ruff check). Fixed E501 and W293 issues to comply with PEP 8.
Serialization: Confirmed component integrity via to_dict and from_dict checks.
Notes for the reviewer:
The metadata structure is unified across both sync and async execution paths.
Runtime generation_kwargs correctly prioritize user input over component defaults.
Updated test mocks to accommodate the new return dictionary structure.
Checklist:
I have read the contributors guidelines and the code of conduct
I have updated the related issue with new insights and changes
I added unit tests and updated the docstrings
I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.