-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Py] Handle experiment name conflicts (#940)
- Loading branch information
Showing
2 changed files
with
49 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import uuid | ||
|
||
from langsmith.client import Client | ||
from langsmith.evaluation._runner import _ExperimentManager | ||
|
||
|
||
def test_experiment_manager_existing_name(): | ||
client = Client() | ||
dataset_name = f"Test Dups: {str(uuid.uuid4())}" | ||
ds = client.create_dataset(dataset_name) | ||
client.create_example(inputs={"un": "important"}, dataset_id=ds.id) | ||
prefix = "Some Test Prefix" | ||
try: | ||
manager = _ExperimentManager(dataset_name, experiment=prefix, client=client) | ||
assert manager is not None | ||
original_name = manager._experiment_name | ||
assert original_name.startswith(prefix) | ||
client.create_project(original_name, reference_dataset_id=ds.id) | ||
manager.start() | ||
new_name = manager._experiment_name | ||
assert new_name.startswith(prefix) | ||
assert new_name != original_name | ||
|
||
finally: | ||
client.delete_dataset(dataset_id=ds.id) |