Tony20100/langchain_full huggingface dataset:
Run on arbitrary text.
__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[source]¶
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
classmethod get_noop_manager() → BRM[source]¶
Return a manager that doesn’t perform any operations.
Returns
The noop manager.
Return type
BaseRunManager
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¶
langchain_core.callbacks.base.BaseCallbackManager¶
class langchain_core.callbacks.base.BaseCallbackManager(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]¶
Base callback manager that handles callbacks from LangChain.
Initialize callback manager.
Attributes
is_async
Whether the callback manager 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])
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 a chat model starts running.
on_llm_start(serialized, prompts, *, run_id)
Run when LLM starts running.
on_retriever_start(serialized, query, *, run_id)
Run when Retriever starts running.
on_tool_start(serialized, input_str, *, run_id)
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
handlers (List[BaseCallbackHandler]) –
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[source]¶
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[source]¶
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[source]¶
Parameters
metadata (Dict[str, Any]) – 
inherit (bool) – 
Return type
None
add_tags(tags: List[str], inherit: bool = True) → None[source]¶
Parameters
tags (List[str]) – 
inherit (bool) –
Parameters
tags (List[str]) – 
inherit (bool) – 
Return type
None
copy() → T[source]¶
Copy the callback manager.
Parameters
self (T) – 
Return type
T
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
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.
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_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) – 
parent_run_id (Optional[UUID]) – 
tags (Optional[List[str]]) – 
metadata (Optional[Dict[str, Any]]) – 
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
remove_handler(handler: BaseCallbackHandler) → None[source]¶
Remove a handler from the callback manager.
Parameters
handler (BaseCallbackHandler) – 
Return type
None
remove_metadata(keys: List[str]) → None[source]¶
Parameters
keys (List[str]) – 
Return type
None
remove_tags(tags: List[str]) → None[source]¶
Parameters
tags (List[str]) – 
Return type
None
set_handler(handler: BaseCallbackHandler, inherit: bool = True) → None[source]¶
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[source]¶
Set handlers as the only handlers on the callback manager.
Parameters
handlers (List[BaseCallbackHandler]) – 
inherit (bool) – 
Return type
None
langchain_core.callbacks.manager.AsyncCallbackManagerForChainRun¶
class langchain_core.callbacks.manager.AsyncCallbackManagerForChainRun(*, 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)[source]¶
Async callback manager for chain run.
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.
Methods
__init__(*, run_id, handlers, ...[, ...])
Initialize the run manager.
get_child([tag])
Get a child callback manager.
get_noop_manager()
Return a manager that doesn't perform any operations.
get_sync()
Get the equivalent sync RunManager.
on_agent_action(action, **kwargs)
Run when agent action is received.
on_agent_finish(finish, **kwargs)
Run when agent finish is received.
on_chain_end(outputs, **kwargs)
Run when chain ends running.
on_chain_error(error, **kwargs)
Run when chain errors.
on_chain_error(error, **kwargs)
Run when chain errors.
on_retry(retry_state, **kwargs)
Run on a retry event.
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) → AsyncCallbackManager¶
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
AsyncCallbackManager
classmethod get_noop_manager() → BRM¶
Return a manager that doesn’t perform any operations.
Returns
The noop manager.
Return type
BaseRunManager
get_sync() → CallbackManagerForChainRun[source]¶
Get the equivalent sync RunManager.
Get the equivalent sync RunManager.
Returns
The sync RunManager.
Return type
CallbackManagerForChainRun
async on_agent_action(action: AgentAction, **kwargs: Any) → Any[source]¶
Run when agent action is received.
Parameters
action (AgentAction) – The agent action.
kwargs (Any) – 
Returns
The result of the callback.
Return type
Any
async on_agent_finish(finish: AgentFinish, **kwargs: Any) → Any[source]¶
Run when agent finish is received.
Parameters
finish (AgentFinish) – The agent finish.
kwargs (Any) – 
Returns
The result of the callback.
Return type
Any
async on_chain_end(outputs: Union[Dict[str, Any], Any], **kwargs: Any) → None[source]¶
Run when chain ends running.
Parameters
outputs (Union[Dict[str, Any], Any]) – The outputs of the chain.
kwargs (Any) – 
Return type
None
async on_chain_error(error: BaseException, **kwargs: Any) → None[source]¶
Run when chain errors.
Parameters
error (Exception or KeyboardInterrupt) – The error.
kwargs (Any) – 
Return type
None
async on_retry(retry_state: RetryCallState, **kwargs: Any) → None¶
Run on a retry event.
Parameters
retry_state (RetryCallState) – 
kwargs (Any) – 
Return type
None
async 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
langchain_community.callbacks.utils.flatten_dict¶
langchain_community.callbacks.utils.flatten_dict(nested_dict: Dict[str, Any], parent_key: str = '', sep: str = '_') → Dict[str, Any][source]¶
Flatten a nested dictionary into a flat dictionary.
Parameters
nested_dict (dict) – The nested dictionary to flatten.
parent_key (str) – The prefix to prepend to the keys of the flattened dict.
sep (str) – The separator to use between the parent key and the key of the
flattened dictionary.
Returns
A flat dictionary.
Return type
(dict)
langchain_core.callbacks.manager.CallbackManager¶
class langchain_core.callbacks.manager.CallbackManager(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]¶
Callback manager that handles callbacks from LangChain.
Initialize callback manager.
Attributes
is_async
Whether the callback manager 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 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
handlers (List[BaseCallbackHandler]) –
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]) – 
inherit (bool) – 
Return type
None
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) → CallbackManager[source]¶
Configure the 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 callback manager.
Return type
CallbackManager
copy() → T¶
Copy the callback manager.
Parameters
self (T) – 
Return type
T
on_chain_start(serialized: Dict[str, Any], inputs: Union[Dict[str, Any], Any], run_id: Optional[UUID] = None, **kwargs: Any) → CallbackManagerForChainRun[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 callback manager for the chain run.
Return type
CallbackManagerForChainRun
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], run_id: Optional[UUID] = None, **kwargs: Any) → List[CallbackManagerForLLMRun][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
A callback manager for eachlist of messages as an LLM run.
Return type
List[CallbackManagerForLLMRun]
on_llm_start(serialized: Dict[str, Any], prompts: List[str], run_id: Optional[UUID] = None, **kwargs: Any) → List[CallbackManagerForLLMRun][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
A callback manager for eachprompt as an LLM run.
Return type
List[CallbackManagerForLLMRun]
Return type
List[CallbackManagerForLLMRun]
on_retriever_start(serialized: Dict[str, Any], query: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, **kwargs: Any) → CallbackManagerForRetrieverRun[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
CallbackManagerForRetrieverRun
on_tool_start(serialized: Dict[str, Any], input_str: str, run_id: Optional[UUID] = None, parent_run_id: Optional[UUID] = None, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → CallbackManagerForToolRun[source]¶
Run when tool starts running.
Parameters
serialized (Dict[str, Any]) – Serialized representation of the tool.
input_str (str) – The  input to the tool as a string.
Non-string inputs are cast to strings.
run_id (Optional[UUID]) – ID for the run. Defaults to None.
parent_run_id (Optional[UUID]) – The ID of the parent run. Defaults to None.
inputs (Optional[Dict[str, Any]]) – The original input to the tool if provided.
Recommended for usage instead of input_str when the original
input is needed.
If provided, the inputs are expected to be formatted as a dict.
The keys will correspond to the named-arguments in the tool.
kwargs (Any) – 
Returns
The callback manager for the tool run.
Return type
CallbackManagerForToolRun
remove_handler(handler: BaseCallbackHandler) → None¶
Remove a handler from the callback manager.
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
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
Examples using CallbackManager¶
ChatLiteLLM
ChatLiteLLMRouter
GPTRouter
Llama.cpp
Run LLMs locally
Titan Takeoff
ZHIPU AI
On LLM end, send data to Arthur.
on_llm_error(error, **kwargs)
Do nothing when LLM outputs an error.
on_llm_new_token(token, **kwargs)
On new token, pass.
on_llm_start(serialized, prompts, **kwargs)
On LLM start, save the input prompts
on_retriever_end(documents, *, run_id[, ...])
Run when Retriever ends running.
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)
Do nothing
on_tool_end(output[, observation_prefix, ...])
Do nothing when tool ends.
on_tool_error(error, **kwargs)
Do nothing when tool outputs an error.
on_tool_start(serialized, input_str, **kwargs)
Do nothing when tool starts.
Parameters
arthur_model (ArthurModel) – 
__init__(arthur_model: ArthurModel) → None[source]¶
Initialize callback handler.
Parameters
arthur_model (ArthurModel) – 
Return type
None
classmethod from_credentials(model_id: str, arthur_url: Optional[str] = 'https://app.arthur.ai', arthur_login: Optional[str] = None, arthur_password: Optional[str] = None) → ArthurCallbackHandler[source]¶
Initialize callback handler from Arthur credentials.
Parameters
model_id (str) – The ID of the arthur model to log to.
Parameters
model_id (str) – The ID of the arthur model to log to.
arthur_url (str, optional) – The URL of the Arthur instance to log to.
Defaults to “https://app.arthur.ai”.
arthur_login (str, optional) – The login to use to connect to Arthur.
Defaults to None.
arthur_password (str, optional) – The password to use to connect to
Arthur. Defaults to None.
Returns
The initialized callback handler.
Return type
ArthurCallbackHandler
on_agent_action(action: AgentAction, **kwargs: Any) → Any[source]¶
Do nothing when agent takes a specific action.
Parameters
action (AgentAction) – 
kwargs (Any) – 
Return type
Any
on_agent_finish(finish: AgentFinish, **kwargs: Any) → None[source]¶
Do nothing
Parameters
finish (AgentFinish) – 
kwargs (Any) – 
Return type
None
on_chain_end(outputs: Dict[str, Any], **kwargs: Any) → None[source]¶
On chain end, do nothing.
Parameters
outputs (Dict[str, Any]) – 
kwargs (Any) – 
Return type
None
on_chain_error(error: BaseException, **kwargs: Any) → None[source]¶
Do nothing when LLM chain outputs an error.
Parameters
error (BaseException) – 
kwargs (Any) – 
Return type
None
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) → None[source]¶
On chain start, do nothing.
Parameters
serialized (Dict[str, Any]) – 
inputs (Dict[str, Any]) – 
kwargs (Any) – 
Return type
None