forked from Archives/langchain
Improve Error Message for failed callback (#6247)
Include the handler class name in the warning
This commit is contained in:
parent
0013256e81
commit
bc9b8c8239
@ -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(
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user