Implementation:Openai Openai python Response Prompt Param
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete TypedDict for constructing prompt template references when sending requests to the Responses API, provided by the openai-python SDK.
Description
ResponsePromptParam is a TypedDict used to build a prompt template reference for API requests. It requires an id field identifying the stored prompt template, and optionally accepts a variables dictionary mapping variable names to substitution values (strings, ResponseInputTextParam, ResponseInputImageParam, or ResponseInputFileParam), and an optional version string to pin a specific template revision.
Usage
Import this type when constructing request payloads that reference reusable prompt templates with variable substitutions for the Responses API.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_prompt_param.py
Signature
class ResponsePromptParam(TypedDict, total=False):
"""Reference to a prompt template and its variables."""
id: Required[str]
variables: Optional[Dict[str, Variables]]
version: Optional[str]
Import
from openai.types.responses import ResponsePromptParam
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | The unique identifier of the prompt template to use. |
| variables | Optional[Dict[str, Variables]] | No | Optional map of values to substitute for variables in the prompt. Values can be strings or input param types (text, image, file). |
| version | Optional[str] | No | Optional version of the prompt template. |
Usage Examples
from openai.types.responses import ResponsePromptParam
prompt: ResponsePromptParam = {
"id": "prompt_abc123",
"variables": {
"user_name": "Bob",
"topic": "machine learning",
},
"version": "v1",
}