OpenAI API Coding with Python
Write the Python around OpenAI API calls: build requests, read response objects, manage roles and conversation history, use few-shot prompts, validate structured output, estimate cost, retry safely and handle function calls. Exercises run offline on documented request and response shapes.
- Intermediate level
- 5 modules
- 11 lessons
- 33 tasks and questions
Syllabus
01First RequestsSet up the SDK and your API key safely, build a request, and pull the text out of a response object.3 lessons
02Roles, History and ExamplesStructure input with developer and user roles, carry conversation history while keeping it within limits, and teach patterns with few-shot examples.3 lessons
03Reliable OutputValidate structured JSON output, estimate tokens and cost, and retry transient errors with exponential backoff.3 lessons
04Function CallingLet the model request your application's functions, run them safely, and send the results back.1 lesson
05Project: A Pantry Recipe HelperCombine prompt building, structured-output validation and grounding checks into a small recipe helper.1 lesson