Skip to content

Commit

Permalink
make num_repetitions non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
samnoyes committed May 23, 2024
1 parent 88d70c8 commit 2bdf6eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions python/langsmith/evaluation/_arunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def aevaluate(
experiment_prefix: Optional[str] = None,
description: Optional[str] = None,
max_concurrency: Optional[int] = None,
num_repetitions: Optional[int] = None,
num_repetitions: int = 1,
client: Optional[langsmith.Client] = None,
blocking: bool = True,
) -> AsyncExperimentResults:
Expand Down Expand Up @@ -348,7 +348,7 @@ async def _aevaluate(
experiment_prefix: Optional[str] = None,
description: Optional[str] = None,
max_concurrency: Optional[int] = None,
num_repetitions: Optional[int] = 1,
num_repetitions: int = 1,
client: Optional[langsmith.Client] = None,
blocking: bool = True,
experiment: Optional[schemas.TracerSession] = None,
Expand All @@ -369,11 +369,7 @@ async def _aevaluate(
metadata=metadata,
experiment=experiment_ or experiment_prefix,
description=description,
num_repetitions=(
num_repetitions
if num_repetitions is not None and num_repetitions > 0
else 1
),
num_repetitions=num_repetitions,
runs=runs,
).astart()
cache_dir = ls_utils.get_cache_dir(None)
Expand Down
10 changes: 3 additions & 7 deletions python/langsmith/evaluation/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def evaluate(
experiment_prefix: Optional[str] = None,
description: Optional[str] = None,
max_concurrency: Optional[int] = None,
num_repetitions: Optional[int] = 1,
num_repetitions: int = 1,
client: Optional[langsmith.Client] = None,
blocking: bool = True,
) -> ExperimentResults:
Expand Down Expand Up @@ -770,7 +770,7 @@ def _evaluate(
experiment_prefix: Optional[str] = None,
description: Optional[str] = None,
max_concurrency: Optional[int] = None,
num_repetitions: Optional[int] = 1,
num_repetitions: int = 1,
client: Optional[langsmith.Client] = None,
blocking: bool = True,
experiment: Optional[schemas.TracerSession] = None,
Expand All @@ -790,11 +790,7 @@ def _evaluate(
metadata=metadata,
experiment=experiment_ or experiment_prefix,
description=description,
num_repetitions=(
num_repetitions
if num_repetitions is not None and num_repetitions > 0
else 1
),
num_repetitions=num_repetitions,
# If provided, we don't need to create a new experiment.
runs=runs,
# Create or resolve the experiment.
Expand Down

0 comments on commit 2bdf6eb

Please sign in to comment.