nemo_flow.integrations.langchain.callbacks#
LangChain callback handler that maps run hierarchy to NeMo Flow scopes.
Classes#
Bridge LangChain chain run IDs to NeMo Flow Agent scopes. |
Module Contents#
- class nemo_flow.integrations.langchain.callbacks.NemoFlowCallbackHandler#
Bases:
langchain_core.callbacks.base.BaseCallbackHandlerBridge LangChain chain run IDs to NeMo Flow Agent scopes.
- run_inline = True#
- on_chain_start(
- serialized: dict[str, Any],
- inputs: dict[str, Any],
- *,
- run_id: uuid.UUID,
- parent_run_id: uuid.UUID | None = None,
- tags: list[str] | None = None,
- metadata: dict[str, Any] | None = None,
- **kwargs: Any,
Push a NeMo Flow Agent scope for a LangChain chain run.
- on_chain_end(
- outputs: dict[str, Any],
- *,
- run_id: uuid.UUID,
- parent_run_id: uuid.UUID | None = None,
- **kwargs: Any,
Pop the NeMo Flow scope associated with a LangChain chain run.
- on_chain_error(
- error: BaseException,
- *,
- run_id: uuid.UUID,
- parent_run_id: uuid.UUID | None = None,
- **kwargs: Any,
Pop the NeMo Flow scope associated with a failed LangChain chain run.