diff --git a/langchain/callbacks/manager.py b/langchain/callbacks/manager.py index c407cc5c..b438550b 100644 --- a/langchain/callbacks/manager.py +++ b/langchain/callbacks/manager.py @@ -200,11 +200,15 @@ def _handle_event( **kwargs, ) else: - logger.warning(f"Error in {event_name} callback: {e}") + logger.warning( + f"Error in {handler.__class__.__name__}.{event_name} callback: {e}" + ) except Exception as e: + logger.warning( + f"Error in {handler.__class__.__name__}.{event_name} callback: {e}" + ) if handler.raise_error: raise e - logger.warning(f"Error in {event_name} callback: {e}") async def _ahandle_event_for_handler( @@ -236,11 +240,15 @@ async def _ahandle_event_for_handler( **kwargs, ) else: - logger.warning(f"Error in {event_name} callback: {e}") + logger.warning( + f"Error in {handler.__class__.__name__}.{event_name} callback: {e}" + ) except Exception as e: + logger.warning( + f"Error in {handler.__class__.__name__}.{event_name} callback: {e}" + ) if handler.raise_error: raise e - logger.warning(f"Error in {event_name} callback: {e}") async def _ahandle_event( diff --git a/langchain/evaluation/run_evaluators/base.py b/langchain/evaluation/run_evaluators/base.py index aa465548..b640719c 100644 --- a/langchain/evaluation/run_evaluators/base.py +++ b/langchain/evaluation/run_evaluators/base.py @@ -11,7 +11,6 @@ from langchain.callbacks.manager import ( CallbackManagerForChainRun, ) from langchain.chains.base import Chain -from langchain.chains.llm import LLMChain from langchain.schema import RUN_KEY, BaseOutputParser @@ -39,7 +38,7 @@ class RunEvaluatorChain(Chain, RunEvaluator): input_mapper: RunEvaluatorInputMapper """Maps the Run and Optional example to a dictionary for the eval chain.""" - eval_chain: LLMChain + eval_chain: Chain """The evaluation chain.""" output_parser: RunEvaluatorOutputParser """Parse the output of the eval chain into feedback.""" diff --git a/langchain/evaluation/run_evaluators/implementations.py b/langchain/evaluation/run_evaluators/implementations.py index a086a23b..6b70d80d 100644 --- a/langchain/evaluation/run_evaluators/implementations.py +++ b/langchain/evaluation/run_evaluators/implementations.py @@ -1,6 +1,6 @@ from typing import Any, Dict, Mapping, Optional, Sequence, Union -from langchainplus_sdk.evaluation.evaluator import EvaluationResult +from langchainplus_sdk.evaluation import EvaluationResult from langchainplus_sdk.schemas import Example, Run from pydantic import BaseModel