Tony20100/langchain_full huggingface dataset:
kwargs (Any) – 
Return type
Any
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when chain starts running.
Parameters
serialized (Dict[str, Any]) – 
inputs (Dict[str, Any]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when a chat model starts running.
ATTENTION: This method is called for chat models. If you’re implementinga handler for a non-chat model, you should use on_llm_start instead.
Parameters
serialized (Dict[str, Any]) – 
messages (List[List[BaseMessage]]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_llm_end(response: LLMResult, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when LLM ends running.
Parameters
response (LLMResult) –
Run when LLM ends running.
Parameters
response (LLMResult) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_llm_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when LLM errors.
:param error: The error that occurred.
:type error: BaseException
:param kwargs: Additional keyword arguments.
response (LLMResult): The response which was generated beforethe error occurred.
Parameters
error (BaseException) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_llm_new_token(token: str, *, chunk: Optional[Union[GenerationChunk, ChatGenerationChunk]] = None, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on new LLM token. Only available when streaming is enabled.
Parameters
token (str) – The new token.
chunk (GenerationChunk | ChatGenerationChunk) – The new generated chunk,
information. (containing content and other) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when LLM starts running.
Run when LLM starts running.
ATTENTION: This method is called for non-chat models (regular LLMs). Ifyou’re implementing a handler for a chat model,
you should use on_chat_model_start instead.
Parameters
serialized (Dict[str, Any]) – 
prompts (List[str]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_retriever_end(documents: Sequence[Document], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when Retriever ends running.
Parameters
documents (Sequence[Document]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_retriever_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when Retriever errors.
Parameters
error (BaseException) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when Retriever starts running.
Parameters
serialized (Dict[str, Any]) – 
query (str) – 
run_id (UUID) –
query (str) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_retry(retry_state: RetryCallState, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on a retry event.
Parameters
retry_state (RetryCallState) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_text(text: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on arbitrary text.
Parameters
text (str) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_tool_end(output: Any, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when tool ends running.
Parameters
output (Any) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_tool_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when tool errors.
Parameters
error (BaseException) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
kwargs (Any) – 
Return type
Any
on_tool_start(serialized: Dict[str, Any], input_str: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when tool starts running.
Parameters
serialized (Dict[str, Any]) – 
input_str (str) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
inputs (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
Examples using WhyLabsCallbackHandler¶
WhyLabs
on_text(text, **kwargs)
Run when text is received.
__init__(*, run_id: UUID, handlers: List[BaseCallbackHandler], inheritable_handlers: List[BaseCallbackHandler], parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inheritable_metadata: Optional[Dict[str, Any]] = None) → None¶
Initialize the run manager.
Parameters
run_id (UUID) – The ID of the run.
handlers (List[BaseCallbackHandler]) – The list of handlers.
inheritable_handlers (List[BaseCallbackHandler]) – The list of inheritable handlers.
parent_run_id (UUID, optional) – The ID of the parent run.
Defaults to None.
tags (Optional[List[str]]) – The list of tags.
inheritable_tags (Optional[List[str]]) – The list of inheritable tags.
metadata (Optional[Dict[str, Any]]) – The metadata.
inheritable_metadata (Optional[Dict[str, Any]]) – The inheritable metadata.
Return type
None
get_child(tag: Optional[str] = None) → CallbackManager¶
Get a child callback manager.
Parameters
tag (str, optional) – The tag for the child callback manager.
Defaults to None.
Returns
The child callback manager.
Return type
CallbackManager
classmethod get_noop_manager() → BRM¶
Return a manager that doesn’t perform any operations.
Returns
The noop manager.
Return type
BaseRunManager
on_retriever_end(documents: Sequence[Document], **kwargs: Any) → None[source]¶
Run when retriever ends running.
Parameters
documents (Sequence[Document]) – 
kwargs (Any) – 
Return type
None
kwargs (Any) – 
Return type
None
on_retriever_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when retriever errors.
Parameters
error (BaseException) – 
kwargs (Any) – 
Return type
None
on_retry(retry_state: RetryCallState, **kwargs: Any) → None¶
Run on a retry event.
Parameters
retry_state (RetryCallState) – 
kwargs (Any) – 
Return type
None
on_text(text: str, **kwargs: Any) → Any¶
Run when text is received.
Parameters
text (str) – The received text.
kwargs (Any) – 
Returns
The result of the callback.
Return type
Any
Examples using CallbackManagerForRetrieverRun¶
How to add scores to retriever results
How to create a custom Retriever
langchain_core.callbacks.manager.AsyncCallbackManager¶
class langchain_core.callbacks.manager.AsyncCallbackManager(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inheritable_metadata: Optional[Dict[str, Any]] = None)[source]¶
Async callback manager that handles callbacks from LangChain.
Initialize callback manager.
Attributes
is_async
Return whether the handler is async.
Methods
__init__(handlers[, inheritable_handlers, ...])
Initialize callback manager.
add_handler(handler[, inherit])
Add a handler to the callback manager.
add_metadata(metadata[, inherit])
add_tags(tags[, inherit])
configure([inheritable_callbacks, ...])
Configure the async callback manager.
copy()
Copy the callback manager.
on_chain_start(serialized, inputs[, run_id])
Run when chain starts running.
on_chat_model_start(serialized, messages[, ...])
Run when LLM starts running.
on_llm_start(serialized, prompts[, run_id])
Run when LLM starts running.
on_retriever_start(serialized, query[, ...])
Run when retriever starts running.
on_tool_start(serialized, input_str[, ...])
Run when tool starts running.
remove_handler(handler)
Remove a handler from the callback manager.
remove_metadata(keys)
remove_tags(tags)
set_handler(handler[, inherit])
Set handler as the only handler on the callback manager.
set_handlers(handlers[, inherit])
Set handlers as the only handlers on the callback manager.
Parameters
Set handlers as the only handlers on the callback manager.
Parameters
handlers (List[BaseCallbackHandler]) – 
inheritable_handlers (Optional[List[BaseCallbackHandler]]) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
inheritable_tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
inheritable_metadata (Optional[Dict[str, Any]]) – 
__init__(handlers: List[BaseCallbackHandler], inheritable_handlers: Optional[List[BaseCallbackHandler]] = None, parent_run_id: Optional[UUID] = None, *, tags: Optional[List[str]] = None, inheritable_tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inheritable_metadata: Optional[Dict[str, Any]] = None) → None¶
Initialize callback manager.
Parameters
handlers (List[BaseCallbackHandler]) – 
inheritable_handlers (Optional[List[BaseCallbackHandler]]) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
inheritable_tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
inheritable_metadata (Optional[Dict[str, Any]]) – 
Return type
None
add_handler(handler: BaseCallbackHandler, inherit: bool = True) → None¶
Add a handler to the callback manager.
Parameters
handler (BaseCallbackHandler) – 
inherit (bool) – 
Return type
None
add_metadata(metadata: Dict[str, Any], inherit: bool = True) → None¶
Parameters
metadata (Dict[str, Any]) – 
inherit (bool) – 
Return type
None
add_tags(tags: List[str], inherit: bool = True) → None¶
Parameters
tags (List[str]) –
Parameters
tags (List[str]) – 
inherit (bool) – 
Return type
None
classmethod configure(inheritable_callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, local_callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, verbose: bool = False, inheritable_tags: Optional[List[str]] = None, local_tags: Optional[List[str]] = None, inheritable_metadata: Optional[Dict[str, Any]] = None, local_metadata: Optional[Dict[str, Any]] = None) → AsyncCallbackManager[source]¶
Configure the async callback manager.
Parameters
inheritable_callbacks (Optional[Callbacks], optional) – The inheritable
callbacks. Defaults to None.
local_callbacks (Optional[Callbacks], optional) – The local callbacks.
Defaults to None.
verbose (bool, optional) – Whether to enable verbose mode. Defaults to False.
inheritable_tags (Optional[List[str]], optional) – The inheritable tags.
Defaults to None.
local_tags (Optional[List[str]], optional) – The local tags.
Defaults to None.
inheritable_metadata (Optional[Dict[str, Any]], optional) – The inheritable
metadata. Defaults to None.
local_metadata (Optional[Dict[str, Any]], optional) – The local metadata.
Defaults to None.
Returns
The configured async callback manager.
Return type
AsyncCallbackManager
copy() → T¶
Copy the callback manager.
Parameters
self (T) – 
Return type
T
async on_chain_start(serialized: Dict[str, Any], inputs: Union[Dict[str, Any], Any], run_id: Optional[UUID] = None, **kwargs: Any) → AsyncCallbackManagerForChainRun[source]¶
Run when chain starts running.
Parameters
serialized (Dict[str, Any]) – The serialized chain.
Parameters
serialized (Dict[str, Any]) – The serialized chain.
inputs (Union[Dict[str, Any], Any]) – The inputs to the chain.
run_id (UUID, optional) – The ID of the run. Defaults to None.
kwargs (Any) – 
Returns
The async callback managerfor the chain run.
Return type
AsyncCallbackManagerForChainRun
async on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], run_id: Optional[UUID] = None, **kwargs: Any) → List[AsyncCallbackManagerForLLMRun][source]¶
Run when LLM starts running.
Parameters
serialized (Dict[str, Any]) – The serialized LLM.
messages (List[List[BaseMessage]]) – The list of messages.
run_id (UUID, optional) – The ID of the run. Defaults to None.
kwargs (Any) – 
Returns
The list ofasync callback managers, one for each LLM Run
corresponding to each inner  message list.
Return type
List[AsyncCallbackManagerForLLMRun]
async on_llm_start(serialized: Dict[str, Any], prompts: List[str], run_id: Optional[UUID] = None, **kwargs: Any) → List[AsyncCallbackManagerForLLMRun][source]¶
Run when LLM starts running.
Parameters
serialized (Dict[str, Any]) – The serialized LLM.
prompts (List[str]) – The list of prompts.
run_id (UUID, optional) – The ID of the run. Defaults to None.
kwargs (Any) – 
Returns
The list of asynccallback managers, one for each LLM Run corresponding
to each prompt.
Return type
List[AsyncCallbackManagerForLLMRun]
to each prompt.
Return type
List[AsyncCallbackManagerForLLMRun]
async on_retriever_start(serialized: Dict[str, Any], query: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, **kwargs: Any) → AsyncCallbackManagerForRetrieverRun[source]¶
Run when retriever starts running.
Parameters
serialized (Dict[str, Any]) – 
query (str) – 
run_id (Optional[UUID]) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
AsyncCallbackManagerForRetrieverRun
async on_tool_start(serialized: Dict[str, Any], input_str: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, **kwargs: Any) → AsyncCallbackManagerForToolRun[source]¶
Run when tool starts running.
Parameters
serialized (Dict[str, Any]) – The serialized tool.
input_str (str) – The input to the tool.
run_id (UUID, optional) – The ID of the run. Defaults to None.
parent_run_id (UUID, optional) – The ID of the parent run.
Defaults to None.
kwargs (Any) – 
Returns
The async callback managerfor the tool run.
Return type
AsyncCallbackManagerForToolRun
remove_handler(handler: BaseCallbackHandler) → None¶
Remove a handler from the callback manager.
Parameters
handler (BaseCallbackHandler) – 
Return type
None
remove_metadata(keys: List[str]) → None¶
Parameters
keys (List[str]) – 
Return type
None
remove_tags(tags: List[str]) → None¶
Parameters
tags (List[str]) – 
Return type
None
Parameters
tags (List[str]) – 
Return type
None
set_handler(handler: BaseCallbackHandler, inherit: bool = True) → None¶
Set handler as the only handler on the callback manager.
Parameters
handler (BaseCallbackHandler) – 
inherit (bool) – 
Return type
None
set_handlers(handlers: List[BaseCallbackHandler], inherit: bool = True) → None¶
Set handlers as the only handlers on the callback manager.
Parameters
handlers (List[BaseCallbackHandler]) – 
inherit (bool) – 
Return type
None
langchain_community.callbacks.flyte_callback.FlyteCallbackHandler¶
class langchain_community.callbacks.flyte_callback.FlyteCallbackHandler[source]¶
Callback handler that is used within a Flyte task.
Initialize callback handler.
Attributes
always_verbose
Whether to call verbose callbacks even if verbose is False.
ignore_agent
Whether to ignore agent callbacks.
ignore_chain
Whether to ignore chain callbacks.
ignore_chat_model
Whether to ignore chat model callbacks.
ignore_llm
Whether to ignore LLM callbacks.
ignore_retriever
Whether to ignore retriever callbacks.
ignore_retry
Whether to ignore retry callbacks.
raise_error
run_inline
Methods
__init__()
Initialize callback handler.
get_custom_callback_meta()
on_agent_action(action, **kwargs)
Run on agent action.
on_agent_finish(finish, **kwargs)
Run when agent ends running.
on_chain_end(outputs, **kwargs)
Run when chain ends running.
on_chain_error(error, **kwargs)
Run when chain errors.
on_chain_start(serialized, inputs, **kwargs)
Run when chain starts running.
on_chat_model_start(serialized, messages, *, ...)
Run when a chat model starts running.
on_llm_end(response, **kwargs)
Run when LLM ends running.
on_llm_error(error, **kwargs)
Run when LLM errors.
on_llm_new_token(token, **kwargs)
Run when LLM generates a new token.
on_llm_start(serialized, prompts, **kwargs)
Run when LLM starts.
on_retriever_end(documents, *, run_id[, ...])
Run when Retriever ends running.
on_retriever_error(error, *, run_id[, ...])
on_retriever_error(error, *, run_id[, ...])
Run when Retriever errors.
on_retriever_start(serialized, query, *, run_id)
Run when Retriever starts running.
on_retry(retry_state, *, run_id[, parent_run_id])
Run on a retry event.
on_text(text, **kwargs)
Run when agent is ending.
on_tool_end(output, **kwargs)
Run when tool ends running.
on_tool_error(error, **kwargs)
Run when tool errors.
on_tool_start(serialized, input_str, **kwargs)
Run when tool starts running.
reset_callback_meta()
Reset the callback metadata.
__init__() → None[source]¶
Initialize callback handler.
Return type
None
get_custom_callback_meta() → Dict[str, Any]¶
Return type
Dict[str, Any]
on_agent_action(action: AgentAction, **kwargs: Any) → Any[source]¶
Run on agent action.
Parameters
action (AgentAction) – 
kwargs (Any) – 
Return type
Any
on_agent_finish(finish: AgentFinish, **kwargs: Any) → None[source]¶
Run when agent ends running.
Parameters
finish (AgentFinish) – 
kwargs (Any) – 
Return type
None
on_chain_end(outputs: Dict[str, Any], **kwargs: Any) → None[source]¶
Run when chain ends running.
Parameters
outputs (Dict[str, Any]) – 
kwargs (Any) – 
Return type
None
on_chain_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when chain errors.
Parameters
error (BaseException) – 
kwargs (Any) – 
Return type
None
error (BaseException) – 
kwargs (Any) – 
Return type
None
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) → None[source]¶
Run when chain starts running.
Parameters
serialized (Dict[str, Any]) – 
inputs (Dict[str, Any]) – 
kwargs (Any) – 
Return type
None
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when a chat model starts running.
ATTENTION: This method is called for chat models. If you’re implementinga handler for a non-chat model, you should use on_llm_start instead.
Parameters
serialized (Dict[str, Any]) – 
messages (List[List[BaseMessage]]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_llm_end(response: LLMResult, **kwargs: Any) → None[source]¶
Run when LLM ends running.
Parameters
response (LLMResult) – 
kwargs (Any) – 
Return type
None
on_llm_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when LLM errors.
Parameters
error (BaseException) – 
kwargs (Any) – 
Return type
None
on_llm_new_token(token: str, **kwargs: Any) → None[source]¶
on_llm_new_token(token: str, **kwargs: Any) → None[source]¶
Run when LLM generates a new token.
Parameters
token (str) – 
kwargs (Any) – 
Return type
None
on_llm_start(serialized: Dict[str, Any], prompts: List[str], **kwargs: Any) → None[source]¶
Run when LLM starts.
Parameters
serialized (Dict[str, Any]) – 
prompts (List[str]) – 
kwargs (Any) – 
Return type
None
on_retriever_end(documents: Sequence[Document], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when Retriever ends running.
Parameters
documents (Sequence[Document]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_retriever_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run when Retriever errors.
Parameters
error (BaseException) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Run when Retriever starts running.
Parameters
serialized (Dict[str, Any]) – 
query (str) – 
run_id (UUID) –
query (str) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Any
on_retry(retry_state: RetryCallState, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on a retry event.
Parameters
retry_state (RetryCallState) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_text(text: str, **kwargs: Any) → None[source]¶
Run when agent is ending.
Parameters
text (str) – 
kwargs (Any) – 
Return type
None
on_tool_end(output: str, **kwargs: Any) → None[source]¶
Run when tool ends running.
Parameters
output (str) – 
kwargs (Any) – 
Return type
None
on_tool_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when tool errors.
Parameters
error (BaseException) – 
kwargs (Any) – 
Return type
None
on_tool_start(serialized: Dict[str, Any], input_str: str, **kwargs: Any) → None[source]¶
Run when tool starts running.
Parameters
serialized (Dict[str, Any]) – 
input_str (str) – 
kwargs (Any) – 
Return type
None
reset_callback_meta() → None¶
Reset the callback metadata.
Return type
None
Examples using FlyteCallbackHandler¶
Flyte
langchain_core.callbacks.manager.atrace_as_chain_group¶
langchain_core.callbacks.manager.atrace_as_chain_group(group_name: str, callback_manager: Optional[AsyncCallbackManager] = None, *, inputs: Optional[Dict[str, Any]] = None, project_name: Optional[str] = None, example_id: Optional[Union[str, UUID]] = None, run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None) → AsyncGenerator[AsyncCallbackManagerForChainGroup, None][source]¶
Get an async callback manager for a chain group in a context manager.
Useful for grouping different async calls together as a single run even if
they aren’t composed in a single chain.
Parameters
group_name (str) – The name of the chain group.
callback_manager (AsyncCallbackManager, optional) – The async callback manager to use,
which manages tracing and other callback behavior.
project_name (str, optional) – The name of the project.
Defaults to None.
example_id (str or UUID, optional) – The ID of the example.
Defaults to None.
run_id (UUID, optional) – The ID of the run.
tags (List[str], optional) – The inheritable tags to apply to all runs.
Defaults to None.
metadata (Dict[str, Any], optional) – The metadata to apply to all runs.
Defaults to None.
inputs (Optional[Dict[str, Any]]) – 
Returns
The async callback manager for the chain group.
Return type
AsyncCallbackManager
Note: must have LANGCHAIN_TRACING_V2 env var set to true to see the trace in LangSmith.
Example
llm_input = "Foo"
async with atrace_as_chain_group("group_name", inputs={"input": llm_input}) as manager: