langchain_core.callbacks.base.LLMManagerMixin¶

class langchain_core.callbacks.base.LLMManagerMixin[source]¶

Mixin for LLM callbacks.

Methods

__init__()

on_llm_end(response, *, run_id[, parent_run_id])

Run when LLM ends running.

on_llm_error(error, *, run_id[, parent_run_id])

Run when LLM errors. :param error: The error that occurred. :type error: BaseException :param kwargs: Additional keyword arguments. - response (LLMResult): The response which was generated before the error occurred. :type kwargs: Any.

on_llm_new_token(token, *[, chunk, ...])

Run on new LLM token.

__init__()¶
on_llm_end(response: LLMResult, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) Any[source]¶

Run when LLM ends running.

on_llm_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) Any[source]¶

Run when LLM errors. :param error: The error that occurred. :type error: BaseException :param kwargs: Additional keyword arguments.

  • response (LLMResult): The response which was generated before

    the error occurred.

on_llm_new_token(token: str, *, chunk: Optional[Union[GenerationChunk, ChatGenerationChunk]] = None, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) Any[source]¶

Run on new LLM token. Only available when streaming is enabled.

Parameters
  • token (str) – The new token.

  • chunk (GenerationChunk | ChatGenerationChunk) – The new generated chunk,

  • information. (containing content and other) –