examples/openai-responses/README.md
This directory contains examples for testing OpenAI's Responses API with promptfoo.
You can run this example with:
npx promptfoo@latest init --example openai-responses
cd openai-responses
promptfooconfig.yaml)Basic example showing how to use the Responses API with GPT-5.5, the GPT-5.4 family (gpt-5.4-mini, gpt-5.4-nano), and a GPT-4.1 comparison model.
promptfooconfig.external-format.yaml)Example demonstrating how to load response_format configuration from external files. This is useful for:
This example compares inline vs. external file approach:
response_format.json using file:// syntaxpromptfooconfig.function-call.yaml)Example demonstrating function calling capabilities with the Responses API.
promptfooconfig.function-callback.yaml)Example showing how to use function callbacks to execute functions locally instead of just returning the function call. This allows you to:
Key differences from regular function calling:
functionToolCallbacks to define JavaScript functionspromptfooconfig.reasoning.yaml)Example showing how to use reasoning models (o1, o3, etc.) with specific configurations.
promptfooconfig.gpt-5.1.yaml)Example demonstrating GPT-5.1's key features including:
none reasoning mode: No reasoning tokens for fastest responseslow, medium, high)none, medium, and high reasoning modespromptfooconfig.gpt-5.2.yaml)Example comparing GPT-5.2 with different reasoning effort levels:
promptfooconfig.gpt-5.5.yaml)Example comparing GPT-5.5 standard and pro models with different Responses API reasoning settings.
promptfooconfig.image.yaml)Example demonstrating image input capabilities with vision models.
promptfooconfig.web-search.yaml)Example showing web search capabilities.
promptfooconfig.codex.yaml)Example using Codex models for code generation tasks.
promptfooconfig.mcp.yaml)Example demonstrating OpenAI's MCP integration with remote MCP servers. This example uses the DeepWiki MCP server to query GitHub repositories.
allowed_toolsTo run any of these examples:
# Basic Responses API example
npx promptfoo eval -c promptfooconfig.yaml
# External response format example
npx promptfoo eval -c promptfooconfig.external-format.yaml
# MCP example
npx promptfoo eval -c promptfooconfig.mcp.yaml
# Function calling example
npx promptfoo eval -c promptfooconfig.function-call.yaml
# Function callbacks example
npx promptfoo eval -c promptfooconfig.function-callback.yaml
# Reasoning models example
npx promptfoo eval -c promptfooconfig.reasoning.yaml
# GPT-5.1 example
npx promptfoo eval -c promptfooconfig.gpt-5.1.yaml
# GPT-5.2 example
npx promptfoo eval -c promptfooconfig.gpt-5.2.yaml
# GPT-5.5 example
npx promptfoo eval -c promptfooconfig.gpt-5.5.yaml
OPENAI_API_KEY environment variableheaders configuration