Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions eval_protocol/adapters/langfuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"""

from __future__ import annotations

import logging
import random
import time
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Protocol, TYPE_CHECKING
from typing import Any, Dict, List, Optional, Protocol, TYPE_CHECKING, cast

from langfuse.api.resources.commons.types.observations_view import ObservationsView
from eval_protocol.models import EvaluationRow, InputMetadata, Message
from .base import BaseAdapter
from .utils import extract_messages_from_data
Expand Down Expand Up @@ -232,12 +232,12 @@ class LangfuseAdapter(BaseAdapter):
... ))
"""

def __init__(self):
def __init__(self, client: Optional[Any] = None):
"""Initialize the Langfuse adapter."""
if not LANGFUSE_AVAILABLE:
raise ImportError("Langfuse not installed. Install with: pip install 'eval-protocol[langfuse]'")

self.client = get_client()
self.client = client or cast(Any, get_client)()

def get_evaluation_rows(
self,
Expand Down
11 changes: 7 additions & 4 deletions eval_protocol/adapters/langsmith.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from __future__ import annotations

import logging
from typing import Any, Dict, List, Optional, Iterable
from typing import Any, Dict, List, Optional, Iterable, cast

from eval_protocol.models import EvaluationRow, InputMetadata, Message
from .base import BaseAdapter
Expand All @@ -23,6 +23,7 @@
LANGSMITH_AVAILABLE = True
except ImportError:
LANGSMITH_AVAILABLE = False
Client = None # type: ignore[misc]


class LangSmithAdapter(BaseAdapter):
Expand All @@ -38,9 +39,11 @@ class LangSmithAdapter(BaseAdapter):
def __init__(self, client: Optional[Any] = None) -> None:
if not LANGSMITH_AVAILABLE:
raise ImportError("LangSmith not installed. Install with: pip install 'eval-protocol[langsmith]'")
# Client is provided by langsmith package; typing is relaxed to Any to avoid
# static analysis issues when stubs aren't available.
self.client = client or Client() # type: ignore[reportCallIssue]
if client is not None:
self.client = client
else:
assert Client is not None
self.client = cast(Any, Client)()

def get_evaluation_rows(
self,
Expand Down
24 changes: 0 additions & 24 deletions examples/langsmith/README.md

This file was deleted.

115 changes: 0 additions & 115 deletions examples/langsmith/dump_traces_langsmith.py

This file was deleted.

116 changes: 0 additions & 116 deletions examples/langsmith/emit_tool_calls.py

This file was deleted.

Loading
Loading