Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw committed Apr 11, 2024
1 parent 7e57a1a commit acad86e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 65 deletions.
7 changes: 5 additions & 2 deletions python/langsmith/_expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,11 @@ def embedding_distance(
Examples:
>>> expect.embedding_distance("hello", "hi").to_be_less_than(0.5)
"""
>>> expect.embedding_distance(
... prediction="hello",
... reference="hi",
... ).to_be_less_than(0.5)
""" # noqa: E501
from langsmith._internal._embedding_distance import EmbeddingDistance

config = config or {}
Expand Down
4 changes: 3 additions & 1 deletion python/langsmith/_internal/_edit_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def evaluate(
@staticmethod
def _get_metric(distance: str, normalize_score: bool = False) -> Callable:
try:
from rapidfuzz import distance as rf_distance
from rapidfuzz import (
distance as rf_distance, # type: ignore[import-not-found]
)
except ImportError:
raise ImportError(
"This operation requires the rapidfuzz library to use."
Expand Down
5 changes: 2 additions & 3 deletions python/langsmith/_internal/_embedding_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from typing import (
TYPE_CHECKING,
Any,
Callable,
List,
Literal,
Expand All @@ -19,9 +20,7 @@

logger = logging.getLogger(__name__)

logger = logging.getLogger(__name__)

Matrix = Union[List[List[float]], List[np.ndarray], np.ndarray]
Matrix = Union[List[List[float]], List[Any], Any]


def cosine_similarity(X: Matrix, Y: Matrix) -> np.ndarray:
Expand Down
59 changes: 0 additions & 59 deletions python/tests/integration_tests/test__testing.py

This file was deleted.

0 comments on commit acad86e

Please sign in to comment.