1. Learn
  2. /
  3. Courses
  4. /
  5. Working with the OpenAI Responses API

Connected

Exercise

Nesting Pydantic Classes

Your movie recommendation system is working well, but there is room for improvements. In particular, with your recommendations, you want to add other, similar movies for the user to browse. These similar movies require a separate class (SimilarMovie) so that they can be listed within a new DetailedMovieRecommendation class.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Define a pydantic class called SimilarMovie to generate title and similarity_reason field information in a structured format.