Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
japdubengsub committed Dec 24, 2024
1 parent a2edb9b commit 965ee7b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions sdks/python/src/opik/integrations/dspy/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class OpikCallback(BaseCallback):

def __init__(
self,
project_name: Optional[str] = None,
Expand All @@ -22,7 +21,9 @@ def __init__(
self._map_call_id_to_trace_data: Dict[str, trace.TraceData] = {}
self._map_span_id_or_trace_id_to_token: Dict[str, Token] = {}

self._current_callback_context: ContextVar[Optional[ContextType]] = ContextVar("opik_context", default=None)
self._current_callback_context: ContextVar[Optional[ContextType]] = ContextVar(
"opik_context", default=None
)

self._project_name = project_name

Expand All @@ -34,8 +35,6 @@ def on_module_start(
instance: Any,
inputs: Dict[str, Any],
) -> None:
print(f"*** on_module_start() is called with call_id: {call_id}, instance: {instance.__class__.__name__}")

if current_callback_context_data := self._current_callback_context.get():
if isinstance(current_callback_context_data, span.SpanData):
self._attach_span_to_existing_span(
Expand Down Expand Up @@ -147,9 +146,7 @@ def on_module_end(
call_id: str,
outputs: Optional[Any],
exception: Optional[Exception] = None,
):
print(f"*** on_module_end() is called with call_id: {call_id}, outputs: {outputs}, exception: {exception}")

) -> None:
self._end_span(
call_id=call_id,
exception=exception,
Expand Down Expand Up @@ -189,9 +186,7 @@ def on_lm_start(
call_id: str,
instance: Any,
inputs: Dict[str, Any],
):
print(f"*** LM is called with inputs: {inputs}")

) -> None:
current_callback_context_data = self._current_callback_context.get()
assert current_callback_context_data is not None

Expand Down Expand Up @@ -227,9 +222,7 @@ def on_lm_end(
call_id: str,
outputs: Optional[Dict[str, Any]],
exception: Optional[Exception] = None,
):
print(f"*** LM is finished with outputs: {outputs}")

) -> None:
self._end_span(
call_id=call_id,
exception=exception,
Expand Down

0 comments on commit 965ee7b

Please sign in to comment.