Skip to content

ref(dspy): migrate dspy wrapper to integrations API#156

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intomainfrom
abhi-refactor-migrate-dspy-wrapper-to-integration
Mar 26, 2026
Merged

ref(dspy): migrate dspy wrapper to integrations API#156
Abhijeet Prasad (AbhiPrasad) merged 1 commit intomainfrom
abhi-refactor-migrate-dspy-wrapper-to-integration

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

ref #116

Convert the DSPy instrumentation from the legacy wrappers pattern to the new integrations API introduced in #118.

Move the DSPy provider from braintrust.wrappers.dspy into braintrust.integrations.dspy following the standard integration package layout (integration.py, patchers.py, tracing.py).

  • DSPyIntegration uses FunctionWrapperPatcher to patch dspy.configure
  • BraintrustDSpyCallback and _configure_wrapper live in tracing.py
  • Wrapper module reduced to compatibility re-exports
  • auto.py uses DSPyIntegration.setup() instead of the old wrapper
  • Tests, cassettes, and auto-test script moved to integration dir
  • noxfile updated to point at new test location

FunctionWrapperPatcher.mark_patched/is_patched/patch now handle targets that don't support setattr (e.g. bound methods) by falling back to storing the marker on the root module. This avoids the need for per-patcher overrides when the patch target is a bound method, as is the case with dspy.configure.

Move the DSPy provider from braintrust.wrappers.dspy into
braintrust.integrations.dspy following the standard integration
package layout (integration.py, patchers.py, tracing.py).

- DSPyIntegration uses FunctionWrapperPatcher to patch dspy.configure
- BraintrustDSpyCallback and _configure_wrapper live in tracing.py
- Wrapper module reduced to compatibility re-exports
- auto.py uses DSPyIntegration.setup() instead of the old wrapper
- Tests, cassettes, and auto-test script moved to integration dir
- noxfile updated to point at new test location

FunctionWrapperPatcher.mark_patched/is_patched/patch now handle
targets that don't support setattr (e.g. bound methods) by falling
back to storing the marker on the root module. This avoids the need
for per-patcher overrides when the patch target is a bound method,
as is the case with dspy.configure.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to merge

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit 0b717a9 into main Mar 26, 2026
34 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-refactor-migrate-dspy-wrapper-to-integration branch March 26, 2026 21:05
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