openai recipes
4 tested openai integration recipes with respx, Pydantic, Zod. Exact pinned versions and a last-passed receipt, last run 2026-10-15.
OpenAI chat.completions.parse with Pydantic output + respx mocks
Get typed output from OpenAI chat.completions.parse using a Pydantic response_format, handle refusals and schema mismatches, and test offline with respx returning canned JSON.
OpenAI Node SDK streaming chat completions, tested with a mocked SSE fetch
Stream chat completion deltas with the OpenAI SDK (for await over chunks), accumulate text and usage, and handle aborts, tested offline with a fake fetch that returns an SSE body.
OpenAI Node SDK tool calling + Zod, tested with a mocked fetch
Run an OpenAI chat tool-calling loop with Zod-validated tool arguments, tested offline by injecting a fake fetch into the official SDK.
OpenAI Python SDK structured outputs, tested with respx
Call the OpenAI Python SDK and validate JSON output with Pydantic, testing success, malformed output and API errors offline by mocking HTTP with respx.