Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Aug 18, 2024
1 parent f6fd84d commit 1431575
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion python/langsmith/beta/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Beta functionality prone to change."""

from langsmith._internal._beta_decorator import warn_beta
from langsmith.beta._evals import compute_test_metrics, convert_runs_to_test
from langsmith.beta._utils import warn_beta

__all__ = ["convert_runs_to_test", "compute_test_metrics", "warn_beta"]
6 changes: 3 additions & 3 deletions python/langsmith/beta/_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import uuid
from typing import DefaultDict, List, Optional, Sequence, Tuple, TypeVar

import langsmith.beta._utils as beta_utils
import langsmith.schemas as ls_schemas
from langsmith import evaluation as ls_eval
from langsmith._internal._beta_decorator import warn_beta
from langsmith.client import Client


Expand Down Expand Up @@ -65,7 +65,7 @@ def _convert_root_run(root: ls_schemas.Run, run_to_example_map: dict) -> List[di
return result


@beta_utils.warn_beta
@warn_beta
def convert_runs_to_test(
runs: Sequence[ls_schemas.Run],
*,
Expand Down Expand Up @@ -196,7 +196,7 @@ def _outer_product(list1: List[T], list2: List[U]) -> List[Tuple[T, U]]:
return list(itertools.product(list1, list2))


@beta_utils.warn_beta
@warn_beta
def compute_test_metrics(
project_name: str,
*,
Expand Down
4 changes: 2 additions & 2 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from langsmith import env as ls_env
from langsmith import schemas as ls_schemas
from langsmith import utils as ls_utils
from langsmith.beta import _utils as beta_utils
from langsmith._internal._beta_decorator import warn_beta

if TYPE_CHECKING:
import pandas as pd # type: ignore
Expand Down Expand Up @@ -3415,7 +3415,7 @@ def list_examples(

# dataset_name arg explicitly not supported to avoid extra API calls.
# TODO: Update note on enabling indexing when there's an enable_indexing method.
@beta_utils.warn_beta
@warn_beta
def similar_examples(
self,
inputs: dict,
Expand Down
6 changes: 3 additions & 3 deletions python/langsmith/evaluation/llm_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic import BaseModel

import langsmith.beta._utils as beta_utils
from langsmith._internal._beta_decorator import warn_beta
from langsmith.evaluation import EvaluationResult, EvaluationResults, RunEvaluator
from langsmith.schemas import Example, Run

Expand Down Expand Up @@ -201,7 +201,7 @@ def _initialize(
chat_model = chat_model.with_structured_output(self.score_schema)
self.runnable = self.prompt | chat_model

@beta_utils.warn_beta
@warn_beta
def evaluate_run(
self, run: Run, example: Optional[Example] = None
) -> Union[EvaluationResult, EvaluationResults]:
Expand All @@ -210,7 +210,7 @@ def evaluate_run(
output: dict = cast(dict, self.runnable.invoke(variables))
return self._parse_output(output)

@beta_utils.warn_beta
@warn_beta
async def aevaluate_run(
self, run: Run, example: Optional[Example] = None
) -> Union[EvaluationResult, EvaluationResults]:
Expand Down
5 changes: 5 additions & 0 deletions python/tests/integration_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ def test_list_examples(langchain_client: Client) -> None:

langchain_client.delete_dataset(dataset_id=dataset.id)

example_list = langchain_client.similar_examples(
{"text": "hey there"}, k=1, dataset_id=dataset.id
)
assert len(example_list) == 1


@pytest.mark.skip(reason="This test is flaky")
def test_persist_update_run(langchain_client: Client) -> None:
Expand Down

0 comments on commit 1431575

Please sign in to comment.