|
9 | 9 | import random |
10 | 10 | import time |
11 | 11 | from datetime import datetime, timedelta |
12 | | -from typing import Any, Callable, Dict, List, Optional, Protocol, cast |
| 12 | +from typing import Any, Dict, List, Optional, Protocol |
13 | 13 |
|
14 | 14 | from eval_protocol.models import EvaluationRow, InputMetadata, Message |
15 | 15 | from .base import BaseAdapter |
@@ -44,19 +44,14 @@ def __call__( |
44 | 44 | ... |
45 | 45 |
|
46 | 46 |
|
47 | | -LangfuseClient = Any |
48 | | - |
49 | | -_get_langfuse_client: Callable[[], Any] | None |
50 | | - |
51 | 47 | try: |
52 | | - from langfuse import get_client as _get_langfuse_client # type: ignore[attr-defined, reportPrivateImportUsage] |
| 48 | + from langfuse import get_client # pyright: ignore[reportPrivateImportUsage] |
53 | 49 | from langfuse.api.resources.trace.types.traces import Traces |
54 | 50 | from langfuse.api.resources.commons.types.trace import Trace |
55 | 51 | from langfuse.api.resources.commons.types.trace_with_full_details import TraceWithFullDetails |
56 | 52 |
|
57 | 53 | LANGFUSE_AVAILABLE = True |
58 | | -except ImportError: # pragma: no cover - optional dependency |
59 | | - _get_langfuse_client = None |
| 54 | +except ImportError: |
60 | 55 | LANGFUSE_AVAILABLE = False |
61 | 56 |
|
62 | 57 |
|
@@ -224,11 +219,7 @@ def __init__(self): |
224 | 219 | if not LANGFUSE_AVAILABLE: |
225 | 220 | raise ImportError("Langfuse not installed. Install with: pip install 'eval-protocol[langfuse]'") |
226 | 221 |
|
227 | | - if _get_langfuse_client is None: |
228 | | - raise ImportError("Langfuse not installed. Install with: pip install 'eval-protocol[langfuse]'") |
229 | | - |
230 | | - client_factory = cast(Callable[[], LangfuseClient], _get_langfuse_client) |
231 | | - self.client: LangfuseClient = client_factory() |
| 222 | + self.client = get_client() |
232 | 223 |
|
233 | 224 | def get_evaluation_rows( |
234 | 225 | self, |
|
0 commit comments