mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-24 12:01:54 +00:00
fix enum error message (#8652)
could be a string so don't directly call value
This commit is contained in:
@@ -7,6 +7,7 @@ import functools
|
|||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from enum import Enum
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
@@ -345,9 +346,10 @@ def _setup_evaluation(
|
|||||||
else:
|
else:
|
||||||
run_type = "chain"
|
run_type = "chain"
|
||||||
if data_type in (DataType.chat, DataType.llm):
|
if data_type in (DataType.chat, DataType.llm):
|
||||||
|
val = data_type.value if isinstance(data_type, Enum) else data_type
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Cannot evaluate a chain on dataset with "
|
"Cannot evaluate a chain on dataset with "
|
||||||
f"data_type={data_type.value}. "
|
f"data_type={val}. "
|
||||||
"Please specify a dataset with the default 'kv' data type."
|
"Please specify a dataset with the default 'kv' data type."
|
||||||
)
|
)
|
||||||
chain = llm_or_chain_factory()
|
chain = llm_or_chain_factory()
|
||||||
|
Reference in New Issue
Block a user