|
|
|
@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
|
|
import functools
|
|
|
|
|
import inspect
|
|
|
|
|
import logging
|
|
|
|
|
import uuid
|
|
|
|
|
from enum import Enum
|
|
|
|
|
from typing import (
|
|
|
|
|
TYPE_CHECKING,
|
|
|
|
@ -23,6 +24,8 @@ from langsmith.client import Client
|
|
|
|
|
from langsmith.evaluation import RunEvaluator
|
|
|
|
|
from langsmith.run_helpers import as_runnable, is_traceable_function
|
|
|
|
|
from langsmith.schemas import Dataset, DataType, Example
|
|
|
|
|
from langsmith.utils import LangSmithError
|
|
|
|
|
from requests import HTTPError
|
|
|
|
|
|
|
|
|
|
from langchain._api import warn_deprecated
|
|
|
|
|
from langchain.callbacks.manager import Callbacks
|
|
|
|
@ -880,11 +883,19 @@ def _prepare_eval_run(
|
|
|
|
|
reference_dataset_id=dataset.id,
|
|
|
|
|
project_extra={"metadata": project_metadata} if project_metadata else {},
|
|
|
|
|
)
|
|
|
|
|
except ValueError as e:
|
|
|
|
|
except (HTTPError, ValueError, LangSmithError) as e:
|
|
|
|
|
if "already exists " not in str(e):
|
|
|
|
|
raise e
|
|
|
|
|
uid = uuid.uuid4()
|
|
|
|
|
example_msg = f"""
|
|
|
|
|
run_on_dataset(
|
|
|
|
|
...
|
|
|
|
|
project_name="{project_name} - {uid}", # Update since {project_name} already exists
|
|
|
|
|
)
|
|
|
|
|
"""
|
|
|
|
|
raise ValueError(
|
|
|
|
|
f"Project {project_name} already exists. Please use a different name."
|
|
|
|
|
f"Test project {project_name} already exists. Please use a different name:"
|
|
|
|
|
f"\n\n{example_msg}"
|
|
|
|
|
)
|
|
|
|
|
print(
|
|
|
|
|
f"View the evaluation results for project '{project_name}'"
|
|
|
|
|