-
Notifications
You must be signed in to change notification settings - Fork 172
fix: Dspy Uninstrumenting instrumented methods #2511
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
base: main
Are you sure you want to change the base?
Conversation
721a8ab to
18cf0f2
Compare
...tation/openinference-instrumentation-dspy/src/openinference/instrumentation/dspy/__init__.py
Outdated
Show resolved
Hide resolved
| lm = LM("openai/gpt-4.1") | ||
| output = lm("hello!") | ||
| print(f"{output=}") | ||
| DSPyInstrumentor().uninstrument() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect users to explicitly call the uninstrument() method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this isn’t expected in normal usage. The uninstrument() call is used here purely for testing, to validate that uninstrumentation works correctly or not.
python/instrumentation/openinference-instrumentation-dspy/pyproject.toml
Outdated
Show resolved
Hide resolved
...tation/openinference-instrumentation-dspy/src/openinference/instrumentation/dspy/__init__.py
Show resolved
Hide resolved
caroger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please respond to/address all review comments (including cursor bots) before marking them resolved.
…adevai/openinference into 1063-dspy-uninstrumentation
...tation/openinference-instrumentation-dspy/src/openinference/instrumentation/dspy/__init__.py
Show resolved
Hide resolved
8d2c567 to
c99fb9b
Compare
Closes #1063
Note
Track and restore all wrapt-patched DSPy methods to properly uninstrument; add tests and update example to demonstrate uninstrumentation.
_wrap_objectto track all wrapped targets and store originals.unwrap_objectusingresolve_path/apply_patchto restore originals._instrumentto use_wrap_objectacross all DSPy targets; update_uninstrumentto reverse-unpatch all tracked methods.test_uninstrumentto verify all instrumented methods are unwrapped.examples/lm.pyto usegpt-4.1, guard with__main__, and demonstrateuninstrument()behavior.Written by Cursor Bugbot for commit c99fb9b. This will update automatically on new commits. Configure here.