output_schema and use_json_mode=True to get a validated MovieScript object back instead of free-form text.
Code
structured_output.py
Usage
1
Set up your virtual environment
2
Set your API key
3
Install dependencies
4
Run Agent
Save the code above as
structured_output.py, then run: