OpenAI API and Agent Application Development

Lesson 2: Responses, Tools, Structured Output, and Retrieval

Lesson Objectives

By the end of this lesson, students should be able to:

  • Write clear system and user instructions for an application
  • Use structured output or schema validation
  • Understand tool calling and application-side execution
  • Ground answers in approved documents and source evidence

Lesson Content

Application prompts should separate developer instructions, user input, and retrieved data. Never concatenate untrusted text into high-priority instructions without clear delimiters and validation. Treat model output as untrusted until parsed and checked.

Structured output allows the application to request fields matching a schema. Validate types, required fields, ranges, and allowed values after generation. Tool calling means the model proposes a tool and arguments; your application decides whether to execute it, validates arguments, enforces authorization, performs the action, and returns the result.

Retrieval systems find relevant chunks from approved documents and include them as context. Quality depends on document freshness, chunking, metadata, source priority, and citation behavior. The model can still misinterpret retrieved material, so high-stakes claims need verification.

Enroll to continue this lesson.

The preview above shows the lesson objectives and opening lesson content. Enroll to view the full lesson, complete the practice work, and take the lesson quiz.

Log In / Create Account
Back to Course