LangChain 1 · Chat models

Stream the response

Print the answer as it is generated.

for chunk in model.stream("Write a haiku about Python."):
    print(chunk.text, end="", flush=True)

Official LangChain 1 documentation

More chat models commands

All chat models commands · LangChain 1 cheatsheet

Was this page helpful?