Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions deepeval/tracing/patchers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import logging

from typing import TYPE_CHECKING

Expand All @@ -12,6 +13,8 @@
if TYPE_CHECKING:
from anthropic import Anthropic

logger = logging.getLogger(__name__)


def patch_openai_client(client: OpenAI):

Expand All @@ -31,14 +34,14 @@ def patch_openai_client(client: OpenAI):
# Navigate to the parent object
for part in parts[:-1]:
if not hasattr(current_obj, part):
print(f"Warning: Cannot find {part} in the path {method_path}")
logger.warning(f"Cannot find {part} in the path {method_path}")
continue
current_obj = getattr(current_obj, part)

method_name = parts[-1]
if not hasattr(current_obj, method_name):
print(
f"Warning: Cannot find method {method_name} in the path {method_path}"
logger.warning(
f"Cannot find method {method_name} in the path {method_path}"
)
continue

Expand Down Expand Up @@ -110,14 +113,14 @@ def patch_anthropic_client(client: "Anthropic"):

for part in parts[:-1]:
if not hasattr(current_obj, part):
print(f"Warning: Cannot find {part} in the path {method_path}")
logger.warning(f"Cannot find {part} in the path {method_path}")
continue
current_obj = getattr(current_obj, part)

method_name = parts[-1]
if not hasattr(current_obj, method_name):
print(
f"Warning: Cannot find method {method_name} in the path {method_path}"
logger.warning(
f"Cannot find method {method_name} in the path {method_path}"
)
continue

Expand Down
Loading