Tony20100/langchain_full huggingface dataset:
Parameters
finish (AgentFinish) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_chain_end(outputs: Dict[str, Any], *, run_id: UUID, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → Run¶
End a trace for a chain run.
Parameters
outputs (Dict[str, Any]) – 
run_id (UUID) – 
inputs (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Run
on_chain_error(error: BaseException, *, inputs: Optional[Dict[str, Any]] = None, run_id: UUID, **kwargs: Any) → Run¶
Handle an error for a chain run.
Parameters
error (BaseException) – 
inputs (Optional[Dict[str, Any]]) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, run_type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) → Run¶
Start a trace for a chain run.
Parameters
serialized (Dict[str, Any]) – 
inputs (Dict[str, Any]) – 
run_id (UUID) – 
tags (Optional[List[str]]) – 
parent_run_id (Optional[UUID]) – 
metadata (Optional[Dict[str, Any]]) – 
run_type (Optional[str]) – 
name (Optional[str]) – 
kwargs (Any) – 
Return type
Run
langchain_core.tracers.context.tracing_enabled¶
langchain_core.tracers.context.tracing_enabled(session_name: str = 'default') → Generator[TracerSessionV1, None, None][source]¶
Throw an error because this has been replaced by tracing_v2_enabled.
Parameters
session_name (str) – 
Return type
Generator[TracerSessionV1, None, None]
langchain_core.tracers.log_stream.LogEntry¶
class langchain_core.tracers.log_stream.LogEntry[source]¶
A single entry in the run log.
Attributes
id
ID of the sub-run.
name
Name of the object being run.
type
Type of the object being run, eg.
tags
List of tags for the run.
metadata
Key-value pairs of metadata for the run.
start_time
ISO-8601 timestamp of when the run started.
streamed_output_str
List of LLM tokens streamed by this run, if applicable.
streamed_output
List of output chunks streamed by this run, if available.
inputs
Inputs to this run.
final_output
Final output of this run.
end_time
ISO-8601 timestamp of when the run ended.
Methods
__init__(*args, **kwargs)
clear()
copy()
fromkeys([value])
Create a new dictionary with keys from iterable and values set to value.
get(key[, default])
Return the value for key if key is in the dictionary, else default.
items()
keys()
pop(k[,d])
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()
Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])
Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v In either case, this is followed by: for k in F:  D[k] = F[k]
values()
__init__(*args, **kwargs)¶
clear() → None.  Remove all items from D.¶
copy() → a shallow copy of D¶
fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
items() → a set-like object providing a view on D's items¶
keys() → a set-like object providing a view on D's keys¶
pop(k[, d]) → v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise,
raise a KeyError.
popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
update([E, ]**F) → None.  Update D from dict/iterable E and F.¶
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]
values() → an object providing a view on D's values¶
langchain_core.tracers.schemas.ChainRun¶
class langchain_core.tracers.schemas.ChainRun[source]¶
Bases: BaseRun
[Deprecated] Class for ChainRun.
Notes
Deprecated since version 0.1.0: Use Run instead.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param child_chain_runs: List[ChainRun] [Optional]¶
param child_execution_order: int [Required]¶
param child_llm_runs: List[LLMRun] [Optional]¶
param child_tool_runs: List[ToolRun] [Optional]¶
param end_time: datetime [Optional]¶
param error: Optional[str] = None¶
param execution_order: int [Required]¶
param extra: Optional[Dict[str, Any]] = None¶
param inputs: Dict[str, Any] [Required]¶
param outputs: Optional[Dict[str, Any]] = None¶
param parent_uuid: Optional[str] = None¶
param serialized: Dict[str, Any] [Required]¶
param session_id: int [Required]¶
param start_time: datetime [Optional]¶
param uuid: str [Required]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
langchain_core.tracers.schemas.TracerSessionV1¶
class langchain_core.tracers.schemas.TracerSessionV1[source]¶
Bases: TracerSessionV1Base
[Deprecated] TracerSessionV1 schema.
Notes
Deprecated since version 0.1.0.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param extra: Optional[Dict[str, Any]] = None¶
param id: int [Required]¶
param name: Optional[str] = None¶
param start_time: datetime [Optional]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
langchain_core.tracers.schemas.TracerSessionV1Base¶
class langchain_core.tracers.schemas.TracerSessionV1Base[source]¶
Bases: BaseModel
[Deprecated] Base class for TracerSessionV1.
Notes
Deprecated since version 0.1.0.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param extra: Optional[Dict[str, Any]] = None¶
param name: Optional[str] = None¶
param start_time: datetime [Optional]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
langchain_core.tracers.log_stream.RunLogPatch¶
class langchain_core.tracers.log_stream.RunLogPatch(*ops: Dict[str, Any])[source]¶
Patch to the run log.
Attributes
ops
List of jsonpatch operations, which describe how to create the run state from an empty dict.
Methods
__init__(*ops)
Parameters
ops (List[Dict[str, Any]]) – 
__init__(*ops: Dict[str, Any]) → None[source]¶
Parameters
ops (Dict[str, Any]) – 
Return type
None
langchain_core.tracers.langchain_v1.LangChainTracerV1¶
langchain_core.tracers.langchain_v1.LangChainTracerV1(*args: Any, **kwargs: Any) → Any[source]¶
Throw an error because this has been replaced by LangChainTracer.
Parameters
args (Any) – 
kwargs (Any) – 
Return type
Any
langchain_core.tracers.stdout.try_json_stringify¶
langchain_core.tracers.stdout.try_json_stringify(obj: Any, fallback: str) → str[source]¶
Try to stringify an object to JSON.
:param obj: Object to stringify.
:param fallback: Fallback string to return if the object cannot be stringified.
Returns
A JSON string if the object can be stringified, otherwise the fallback string.
Parameters
obj (Any) – 
fallback (str) – 
Return type
str
langchain_core.tracers.event_stream.RunInfo¶
class langchain_core.tracers.event_stream.RunInfo[source]¶
Information about a run.
Attributes
name
tags
metadata
run_type
inputs
parent_run_id
Methods
__init__(*args, **kwargs)
clear()
copy()
fromkeys([value])
Create a new dictionary with keys from iterable and values set to value.
get(key[, default])
Return the value for key if key is in the dictionary, else default.
items()
keys()
pop(k[,d])
If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()
Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])
Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v In either case, this is followed by: for k in F:  D[k] = F[k]
values()
__init__(*args, **kwargs)¶
clear() → None.  Remove all items from D.¶
copy() → a shallow copy of D¶
fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
items() → a set-like object providing a view on D's items¶
keys() → a set-like object providing a view on D's keys¶
langchain_core.tracers.schemas.LLMRun¶
class langchain_core.tracers.schemas.LLMRun[source]¶
Bases: BaseRun
[Deprecated] Class for LLMRun.
Notes
Deprecated since version 0.1.0: Use Run instead.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param child_execution_order: int [Required]¶
param end_time: datetime [Optional]¶
param error: Optional[str] = None¶
param execution_order: int [Required]¶
param extra: Optional[Dict[str, Any]] = None¶
param parent_uuid: Optional[str] = None¶
param prompts: List[str] [Required]¶
param response: Optional[LLMResult] = None¶
param serialized: Dict[str, Any] [Required]¶
param session_id: int [Required]¶
param start_time: datetime [Optional]¶
param uuid: str [Required]¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
langchain_core.tracers.context.tracing_v2_enabled¶
langchain_core.tracers.context.tracing_v2_enabled(project_name: Optional[str] = None, *, example_id: Optional[Union[str, UUID]] = None, tags: Optional[List[str]] = None, client: Optional[LangSmithClient] = None) → Generator[LangChainTracer, None, None][source]¶
Instruct LangChain to log all runs in context to LangSmith.
Parameters
project_name (str, optional) – The name of the project.
Defaults to “default”.
example_id (str or UUID, optional) – The ID of the example.
Defaults to None.
tags (List[str], optional) – The tags to add to the run.
Defaults to None.
client (LangSmithClient, optional) – The client of the langsmith.
Defaults to None.
Returns
None
Return type
Generator[LangChainTracer, None, None]
Example
>>> with tracing_v2_enabled():
...     # LangChain code will automatically be traced
You can use this to fetch the LangSmith run URL:
>>> with tracing_v2_enabled() as cb:
...     chain.invoke("foo")
...     run_url = cb.get_run_url()
Examples using tracing_v2_enabled¶
Chat Bot Feedback Template
Github
langchain_core.tracers.root_listeners.RootListenersTracer¶
class langchain_core.tracers.root_listeners.RootListenersTracer(*, config: RunnableConfig, on_start: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]], on_end: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]], on_error: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]])[source]¶
Tracer that calls listeners on run start, end, and error.
Initialize the tracer.
Parameters
_schema_format – Primarily changes how the inputs and outputs are
handled. For internal use only. This API will change.
- ‘original’ is the format used by all current tracers.
This format is slightly inconsistent with respect to inputs
and outputs.
’streaming_events’ is used for supporting streaming events,for internal usage. It will likely change in the future, or
be deprecated entirely in favor of a dedicated async tracer
for streaming events.
’original+chat’ is a format that is the same as ‘original’except it does NOT raise an attribute error on_chat_model_start
kwargs – Additional keyword arguments that will be passed to
the super class.
config (RunnableConfig) – 
on_start (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
on_end (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
on_error (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
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
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__(*, config, on_start, on_end, on_error)
Initialize the tracer.
on_agent_action(action, *, run_id[, ...])
Run on agent action.
on_agent_finish(finish, *, run_id[, ...])
Run on agent end.
on_chain_end(outputs, *, run_id[, inputs])
End a trace for a chain run.
on_chain_error(error, *[, inputs])
Handle an error for a chain run.
on_chain_start(serialized, inputs, *, run_id)
Start a trace for a chain run.
on_chat_model_start(serialized, messages, *, ...)
Start a trace for an LLM run.
on_llm_end(response, *, run_id, **kwargs)
End a trace for an LLM run.
on_llm_error(error, *, run_id, **kwargs)
Handle an error for an LLM run.
on_llm_new_token(token, *[, chunk, ...])
Run on new LLM token.
on_llm_start(serialized, prompts, *, run_id)
Start a trace for an LLM run.
on_retriever_end(documents, *, run_id, **kwargs)
Run when Retriever ends running.
on_retriever_error(error, *, run_id, **kwargs)
Run when Retriever errors.
on_retriever_start(serialized, query, *, run_id)
on_retriever_start(serialized, query, *, run_id)
Run when Retriever starts running.
on_retry(retry_state, *, run_id, **kwargs)
Run on a retry event.
on_text(text, *, run_id[, parent_run_id])
Run on arbitrary text.
on_tool_end(output, *, run_id, **kwargs)
End a trace for a tool run.
on_tool_error(error, *, run_id, **kwargs)
Handle an error for a tool run.
on_tool_start(serialized, input_str, *, run_id)
Start a trace for a tool run.
__init__(*, config: RunnableConfig, on_start: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]], on_end: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]], on_error: Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) → None[source]¶
Initialize the tracer.
Parameters
_schema_format – Primarily changes how the inputs and outputs are
handled. For internal use only. This API will change.
- ‘original’ is the format used by all current tracers.
This format is slightly inconsistent with respect to inputs
and outputs.
’streaming_events’ is used for supporting streaming events,for internal usage. It will likely change in the future, or
be deprecated entirely in favor of a dedicated async tracer
for streaming events.
’original+chat’ is a format that is the same as ‘original’except it does NOT raise an attribute error on_chat_model_start
kwargs – Additional keyword arguments that will be passed to
the super class.
config (RunnableConfig) –
the super class.
config (RunnableConfig) – 
on_start (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
on_end (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
on_error (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) – 
Return type
None
on_agent_action(action: AgentAction, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on agent action.
Parameters
action (AgentAction) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_agent_finish(finish: AgentFinish, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶
Run on agent end.
Parameters
finish (AgentFinish) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Any
on_chain_end(outputs: Dict[str, Any], *, run_id: UUID, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → Run¶
End a trace for a chain run.
Parameters
outputs (Dict[str, Any]) – 
run_id (UUID) – 
inputs (Optional[Dict[str, Any]]) – 
kwargs (Any) – 
Return type
Run
on_chain_error(error: BaseException, *, inputs: Optional[Dict[str, Any]] = None, run_id: UUID, **kwargs: Any) → Run¶
Handle an error for a chain run.
Parameters
Handle an error for a chain run.
Parameters
error (BaseException) – 
inputs (Optional[Dict[str, Any]]) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, run_type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) → Run¶
Start a trace for a chain run.
Parameters
serialized (Dict[str, Any]) – 
inputs (Dict[str, Any]) – 
run_id (UUID) – 
tags (Optional[List[str]]) – 
parent_run_id (Optional[UUID]) – 
metadata (Optional[Dict[str, Any]]) – 
run_type (Optional[str]) – 
name (Optional[str]) – 
kwargs (Any) – 
Return type
Run
on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs: Any) → Run¶
Start a trace for an LLM run.
Parameters
serialized (Dict[str, Any]) – 
messages (List[List[BaseMessage]]) – 
run_id (UUID) – 
tags (Optional[List[str]]) – 
parent_run_id (Optional[UUID]) – 
metadata (Optional[Dict[str, Any]]) – 
name (Optional[str]) – 
kwargs (Any) – 
Return type
name (Optional[str]) – 
kwargs (Any) – 
Return type
Run
on_llm_end(response: LLMResult, *, run_id: UUID, **kwargs: Any) → Run¶
End a trace for an LLM run.
Parameters
response (LLMResult) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_llm_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶
Handle an error for an LLM run.
Parameters
error (BaseException) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_llm_new_token(token: str, *, chunk: Optional[Union[GenerationChunk, ChatGenerationChunk]] = None, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Run¶
Run on new LLM token. Only available when streaming is enabled.
Parameters
token (str) – 
chunk (Optional[Union[GenerationChunk, ChatGenerationChunk]]) – 
run_id (UUID) – 
parent_run_id (Optional[UUID]) – 
kwargs (Any) – 
Return type
Run
on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs: Any) → Run¶
Start a trace for an LLM run.
Parameters
serialized (Dict[str, Any]) – 
prompts (List[str]) – 
run_id (UUID) – 
tags (Optional[List[str]]) –
run_id (UUID) – 
tags (Optional[List[str]]) – 
parent_run_id (Optional[UUID]) – 
metadata (Optional[Dict[str, Any]]) – 
name (Optional[str]) – 
kwargs (Any) – 
Return type
Run
on_retriever_end(documents: Sequence[Document], *, run_id: UUID, **kwargs: Any) → Run¶
Run when Retriever ends running.
Parameters
documents (Sequence[Document]) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_retriever_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶
Run when Retriever errors.
Parameters
error (BaseException) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
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, name: Optional[str] = None, **kwargs: Any) → Run¶
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]]) – 
name (Optional[str]) – 
kwargs (Any) – 
Return type
Run
on_retry(retry_state: RetryCallState, *, run_id: UUID, **kwargs: Any) → Run¶
Run on a retry event.
Parameters
retry_state (RetryCallState) –
Run on a retry event.
Parameters
retry_state (RetryCallState) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
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, **kwargs: Any) → Run¶
End a trace for a tool run.
Parameters
output (Any) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_tool_error(error: BaseException, *, run_id: UUID, **kwargs: Any) → Run¶
Handle an error for a tool run.
Parameters
error (BaseException) – 
run_id (UUID) – 
kwargs (Any) – 
Return type
Run
on_tool_start(serialized: Dict[str, Any], input_str: str, *, run_id: UUID, tags: Optional[List[str]] = None, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) → Run¶
Start a trace for a tool run.
Parameters
serialized (Dict[str, Any]) – 
input_str (str) – 
run_id (UUID) – 
tags (Optional[List[str]]) – 
parent_run_id (Optional[UUID]) – 
metadata (Optional[Dict[str, Any]]) – 
name (Optional[str]) –