langchain.callbacks.sagemaker_callback.SageMakerCallbackHandler¶
class langchain.callbacks.sagemaker_callback.SageMakerCallbackHandler(run: Any)[source]¶
Callback Handler that logs prompt artifacts and metrics to SageMaker Experiments.
Parameters
run (sagemaker.experiments.run.Run) – Run object where the experiment is logged.
Initialize callback handler.
Attributes
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__(run)
Initialize callback handler.
flush_tracker()
Reset the steps and delete the temporary local directory.
jsonf(data, data_dir, filename[, is_output])
To log the input data as json file artifact.
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.