Bird
0
0

You wrote this code but get no streaming output:

medium📝 Debug Q14 of 15
LangChain - LLM and Chat Model Integration
You wrote this code but get no streaming output:
llm = OpenAI()
llm("Tell me a joke.")
What is the likely fix?
AUse print() inside the llm call.
BCall llm.stream() instead of llm().
CSet streaming=False explicitly.
DAdd streaming=True when creating the LLM instance.
Step-by-Step Solution
Solution:
  1. Step 1: Identify missing streaming parameter

    The code creates the LLM without streaming enabled, so output is not streamed.
  2. Step 2: Enable streaming properly

    Adding streaming=True when creating the LLM enables streaming output.
  3. Final Answer:

    Add streaming=True when creating the LLM instance. -> Option D
  4. Quick Check:

    Streaming requires streaming=True param [OK]
Quick Trick: Streaming only works if streaming=True is set at creation [OK]
Common Mistakes:
  • Trying to call a non-existent stream() method
  • Setting streaming=False disables streaming
  • Expecting print() inside llm call to stream output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes