mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-10 15:06:18 +00:00
Update error message in evaluation runner (#13296)
This commit is contained in:
parent
32c493e3df
commit
9169d77cf6
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
|
import uuid
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
@ -23,6 +24,8 @@ from langsmith.client import Client
|
|||||||
from langsmith.evaluation import RunEvaluator
|
from langsmith.evaluation import RunEvaluator
|
||||||
from langsmith.run_helpers import as_runnable, is_traceable_function
|
from langsmith.run_helpers import as_runnable, is_traceable_function
|
||||||
from langsmith.schemas import Dataset, DataType, Example
|
from langsmith.schemas import Dataset, DataType, Example
|
||||||
|
from langsmith.utils import LangSmithError
|
||||||
|
from requests import HTTPError
|
||||||
|
|
||||||
from langchain._api import warn_deprecated
|
from langchain._api import warn_deprecated
|
||||||
from langchain.callbacks.manager import Callbacks
|
from langchain.callbacks.manager import Callbacks
|
||||||
@ -880,11 +883,19 @@ def _prepare_eval_run(
|
|||||||
reference_dataset_id=dataset.id,
|
reference_dataset_id=dataset.id,
|
||||||
project_extra={"metadata": project_metadata} if project_metadata else {},
|
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):
|
if "already exists " not in str(e):
|
||||||
raise 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(
|
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(
|
print(
|
||||||
f"View the evaluation results for project '{project_name}'"
|
f"View the evaluation results for project '{project_name}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user