Fix OptimizationError: 'str' object has no attribute 'kwargs' in BasicOptimizationStrategy#24
Conversation
…imizationStrategy - Fixes meta-llama#23
|
Hi @OCWC22! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Files Updated: • CHANGELOG.md: Added entries documenting the fix for the OptimizationError related to the num_threads parameter in BasicOptimizationStrategy. • TECHNICAL_DEBT.md: Documented the need to refactor broad exception handling in BasicOptimizationStrategy.run to improve error diagnosis. Description: Created a CHANGELOG.md to track notable changes, including the resolution of a critical bug in the BasicOptimizationStrategy related to incorrect parameter passing to the dspy.MIPROv2 constructor. Additionally, a TECHNICAL_DEBT.md file was added to highlight the need for improved exception handling practices. Reasoning: The addition of a changelog enhances project transparency and user awareness of changes, while documenting technical debt ensures that future refactoring efforts are prioritized to improve code maintainability. Trade-offs: • Positive: Improved documentation and tracking of changes for better project management. • Minimal: Requires ongoing updates to the changelog and technical debt documentation as the project evolves. Considerations: • The changelog follows the Keep a Changelog format, ensuring consistency and clarity for users. • Technical debt documentation will guide future refactoring efforts to enhance error handling. Future Work: • Regularly update the changelog with future releases and bug fixes. • Address the technical debt related to exception handling in upcoming development cycles.
…Ov2 Bug Fix" This reverts commit 4e94bd6.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Description
Fixes #23
This PR resolves the critical bug where
BasicOptimizationStrategy.runfails withOptimizationError: 'str' object has no attribute 'kwargs'.Root Cause
The bug was caused by incorrectly passing
num_threadsto thedspy.MIPROv2()constructor, which doesn't accept this parameter. This caused aTypeErrorthat was masked by broad exception handling.Solution
num_threadsfromdspy.MIPROv2()constructornum_threadscorrectly viaeval_kwargstooptimizer.compile()Testing
test_prompt_strategies.py)test_core_integration.py)test_cli_integration.py)Breaking Changes
None - this is a bug fix that enables previously broken functionality.
Files Changed
src/llama_prompt_ops/core/prompt_strategies.py- Core fixtests/unit/test_prompt_strategies.py- New unit teststests/integration/test_core_integration.py- Integration testtests/integration/test_cli_integration.py- CLI test