Skip to content

Commit

Permalink
update: DSPyPatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Feb 26, 2025
1 parent 80cc7d3 commit 123dffa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion weave/integrations/dspy/dspy_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ def __init__(self, patchers: Sequence[Patcher]) -> None:

from weave.integrations.dspy.dspy_callback import WeaveCallback

dspy.configure(callbacks=[WeaveCallback()])
is_callback_present = False
for callback in dspy.settings.callbacks:
if isinstance(callback, WeaveCallback):
is_callback_present = True
break

if not is_callback_present:
dspy.settings.callbacks.append(WeaveCallback())
except ImportError:
pass

Expand Down

0 comments on commit 123dffa

Please sign in to comment.