trace_as_chain_group(
group_name: str,
callback_manager: CallbackManager | None = None,
*,
inputs| Name | Type | Description |
|---|---|---|
group_name* | str | The name of the chain group. |
callback_manager | CallbackManager | None | Default: NoneThe callback manager to use. |
inputs | dict[str, Any] | None | Default: None |
project_name | str | None | Default: None |
example_id | str | UUID | None | Default: None |
run_id | UUID | None | Default: None |
tags | list[str] | None | Default: None |
metadata | dict[str, Any] | None | Default: None |
Get a callback manager for a chain group in a context manager.
Useful for grouping different calls together as a single run even if they aren't composed in a single chain.
Must have LANGCHAIN_TRACING_V2 env var set to true to see the trace in
LangSmith.
Example:
llm_input = "Foo"
with trace_as_chain_group("group_name", inputs={"input": llm_input}) as manager:
# Use the callback manager for the chain group
res = llm.invoke(llm_input, {"callbacks": manager})
manager.on_chain_end({"output": res})The inputs to the chain group.
The name of the project.
The ID of the example.
The ID of the run.
The inheritable tags to apply to all runs.
The metadata to apply to all runs.