Run on new LLM token.
Only available when streaming is enabled.
on_llm_new_token(
self,
token: str,
*,
chunk: GenerationChunk | ChatGenerationChunk | None = None,
run_id: UUID,
parent_run_id: UUID | None = None,
**kwargs: Any = {}
) -> Run| Name | Type | Description |
|---|---|---|
token* | str | The token. |
chunk | GenerationChunk | ChatGenerationChunk | None | Default: NoneThe chunk. |
run_id* | UUID | The run ID. |
parent_run_id | UUID | None | Default: NoneThe parent run ID. |
**kwargs | Any | Default: {}Additional arguments. |