Skip to content

Commit 09c5d49

Browse files
committed
revert langfuse / langsmith changes
1 parent db701ab commit 09c5d49

File tree

2 files changed

+9
-30
lines changed

2 files changed

+9
-30
lines changed

eval_protocol/adapters/langfuse.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import random
1010
import time
1111
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
1313

1414
from eval_protocol.models import EvaluationRow, InputMetadata, Message
1515
from .base import BaseAdapter
@@ -44,19 +44,14 @@ def __call__(
4444
...
4545

4646

47-
LangfuseClient = Any
48-
49-
_get_langfuse_client: Callable[[], Any] | None
50-
5147
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]
5349
from langfuse.api.resources.trace.types.traces import Traces
5450
from langfuse.api.resources.commons.types.trace import Trace
5551
from langfuse.api.resources.commons.types.trace_with_full_details import TraceWithFullDetails
5652

5753
LANGFUSE_AVAILABLE = True
58-
except ImportError: # pragma: no cover - optional dependency
59-
_get_langfuse_client = None
54+
except ImportError:
6055
LANGFUSE_AVAILABLE = False
6156

6257

@@ -224,11 +219,7 @@ def __init__(self):
224219
if not LANGFUSE_AVAILABLE:
225220
raise ImportError("Langfuse not installed. Install with: pip install 'eval-protocol[langfuse]'")
226221

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()
232223

233224
def get_evaluation_rows(
234225
self,

eval_protocol/adapters/langsmith.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,18 @@
1010
from __future__ import annotations
1111

1212
import logging
13-
from typing import Any, Callable, Dict, Iterable, List, Optional, cast
13+
from typing import Any, Dict, List, Optional, Iterable
1414

1515
from eval_protocol.models import EvaluationRow, InputMetadata, Message
1616
from .base import BaseAdapter
1717

1818
logger = logging.getLogger(__name__)
1919

20-
LangSmithClient = Any
21-
22-
_LANGSMITH_CLIENT_CTOR: Callable[..., LangSmithClient] | None
23-
2420
try:
25-
from langsmith import Client as _LANGSMITH_CLIENT_CTOR # type: ignore[attr-defined]
21+
from langsmith import Client # type: ignore
2622

2723
LANGSMITH_AVAILABLE = True
28-
except ImportError: # pragma: no cover - optional dependency
29-
_LANGSMITH_CLIENT_CTOR = None
24+
except ImportError:
3025
LANGSMITH_AVAILABLE = False
3126

3227

@@ -40,17 +35,10 @@ class LangSmithAdapter(BaseAdapter):
4035
- outputs: { messages: [...] } | { content } | { result } | { answer } | { output } | str | list[dict]
4136
"""
4237

43-
def __init__(self, client: Optional[LangSmithClient] = None) -> None:
38+
def __init__(self, client: Optional[Client] = None) -> None:
4439
if not LANGSMITH_AVAILABLE:
4540
raise ImportError("LangSmith not installed. Install with: pip install 'eval-protocol[langsmith]'")
46-
if client is not None:
47-
self.client = client
48-
return
49-
50-
if _LANGSMITH_CLIENT_CTOR is None:
51-
raise ImportError("LangSmith client constructor unavailable despite successful import check")
52-
53-
self.client: LangSmithClient = cast(LangSmithClient, _LANGSMITH_CLIENT_CTOR())
41+
self.client = client or Client()
5442

5543
def get_evaluation_rows(
5644
self,

0 commit comments

Comments
 (0)