Skip to main content
The following code example demonstrates how to pass a callback handler:

Final Answer streaming

If streaming is enabled at the LLM level, Langchain will only stream the intermediate steps. You can enable final answer streaming by passing stream_final_answer=True to the callback handler.
Final answer streaming will only work with prompts that have a consistent final answer pattern. It will also not work with AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION