02. OpenAI API Format

Chapter 2 of 18 · 15 min

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Create a Python dictionary that matches the chat completions response structure. Include all required fields with realistic placeholder values. Then validate it against the JSON schema for chat completions responses.