> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Responses

> OpenAI Responses API examples: structured output, tool use, image and PDF input, deep research, reasoning, and ZDR mode.

| Example                                                                                               | Description                                                                                                                         |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [OpenAI Agent Flex Tier](/examples/models/openai/responses/agent-flex-tier)                           | Run o4-mini on the flex service tier with the OpenAIResponses model.                                                                |
| [OpenAI Basic](/examples/models/openai/responses/basic)                                               | Run a gpt-4o agent through the Responses API in sync, async, and streaming modes.                                                   |
| [DB](/examples/models/openai/responses/db)                                                            | Persist Responses API sessions in Postgres and answer a history-dependent follow-up.                                                |
| [OpenAI Deep Research Agent](/examples/models/openai/responses/deep-research-agent)                   | Run OpenAI's o4-mini-deep-research model to produce a cited research report.                                                        |
| [OpenAI Image Agent](/examples/models/openai/responses/image-agent)                                   | Describe an image from a URL and fetch related news via web search with OpenAIResponses.                                            |
| [OpenAI Image Agent Bytes](/examples/models/openai/responses/image-agent-bytes)                       | Pass image bytes to a Responses API agent that pairs vision with web search.                                                        |
| [OpenAI Image Agent With Memory](/examples/models/openai/responses/image-agent-with-memory)           | Reference an earlier image in follow-up questions by adding history to context.                                                     |
| [Image Generation Agent](/examples/models/openai/responses/image-generation-agent)                    | Generate and save an image with OpenAITools and GPT Image 2.                                                                        |
| [Knowledge](/examples/models/openai/responses/knowledge)                                              | Answer questions from a PDF stored in PgVector knowledge with OpenAIResponses.                                                      |
| [Memory](/examples/models/openai/responses/memory)                                                    | Store user memories and session summaries in Postgres while chatting with gpt-4o over the Responses API.                            |
| [OpenAI PDF Input Local](/examples/models/openai/responses/pdf-input-local)                           | Query a local PDF with gpt-5.2 using the built-in file\_search tool across two turns.                                               |
| [OpenAI PDF Input URL](/examples/models/openai/responses/pdf-input-url)                               | Summarize a PDF by URL with file\_search and web search, then read citations from the stored session.                               |
| [OpenAI Reasoning O3 Mini](/examples/models/openai/responses/reasoning-o3-mini)                       | Stream a stock report from o3-mini with YFinance tools via the Responses API.                                                       |
| [OpenAI Structured Output](/examples/models/openai/responses/structured-output)                       | Generate a MovieScript Pydantic model via JSON mode, strict, and guided structured output.                                          |
| [OpenAI Structured Output With Tools](/examples/models/openai/responses/structured-output-with-tools) | Combine web search tools with a Pydantic output schema on gpt-5-mini.                                                               |
| [Tool Use](/examples/models/openai/responses/tool-use)                                                | Answer a news question with GPT-4o on the Responses API using WebSearchTools.                                                       |
| [OpenAI Tool Use GPT 5](/examples/models/openai/responses/tool-use-gpt-5)                             | Fetch a live stock price with gpt-5 and cached YFinance tool results.                                                               |
| [OpenAI Tool Use O3](/examples/models/openai/responses/tool-use-o3)                                   | Call YFinance tools from o3 through the OpenAI Responses API to fetch a live stock price.                                           |
| [OpenAI Verbosity Control](/examples/models/openai/responses/verbosity-control)                       | Raise GPT-5 verbosity to high and generate a detailed stock comparison with YFinance tools.                                         |
| [OpenAI WebSearch Builtin Tool](/examples/models/openai/responses/websearch-builtin-tool)             | Combine the built-in web\_search\_preview tool with FileTools to search and save results to disk.                                   |
| [ZDR Reasoning Agent](/examples/models/openai/responses/zdr-reasoning-agent)                          | Run o4-mini with store=False and reasoning\_summary="auto", keeping multi-turn context in an InMemoryDb for Zero Data Retention.    |
| [Background Mode](/examples/models/openai/responses/background)                                       | Background mode enables long-running tasks on reasoning models like GPT-5.4 without worrying about timeouts or connectivity issues. |
| [OpenAI File Input Direct](/examples/models/openai/responses/file-input-direct)                       | Attach files by URL, local path, or raw bytes to a Responses API agent.                                                             |
| [Responses Image Agent File](/examples/models/openai/responses/image-agent-file)                      | Attach a local image by filepath to a Responses API agent, overriding the MIME type if needed.                                      |
