AI Hints
Home›LangChain Tutorial›Structured Output in Practice
LangChain · Lesson 36 of 120

Structured Output Quiz

Test yourself.

⏱ 2 min read▶ Video at 39:05🎓 Free
Watch this lesson in the LangChain courseWatch on YouTube ↗Full LangChain course

Let's review structured output. Pause after each question, and answer before I do.

Structured Output Quiz
From the video: Structured Output Quiz
  • Structured output quiz
  • Pause and think
  • Then check

Question 1

Which method makes a model return instances of a Pydantic class? With structured output.

Quick check
Returns Pydantic objects:

Question 2

How do you limit a field to a fixed set of labels? With a Literal type.

Quick check
Fixed labels:

Question 3

An email may not contain an order number. How should that field be declared? As optional.

Quick check
Might be missing:

Question 4

Which option returns the raw reply along with the parsed object? Include raw.

Quick check
Raw reply too:

Summary

Excellent. Next, a new section on tools, the way models take action.

Key takeaways
  • with_structured_output
  • Literal labels
  • Optional fields
Next up: What Are Tools — giving the model hands