Skip to content

Commit 5598f61

Browse files
authored
feat(responses)!: introduce OpenAI compatible prompts to Responses API (#3942)
# What does this PR do? <!-- Provide a short summary of what this PR does and why. Link to relevant issues if applicable. --> This PR is responsible for making changes to Responses API scheme to introduce OpenAI compatible prompts there. Change to the API only, therefore currently no implementation at all. However, the follow up PR with actual implementation will be submitted after current PR lands. The need of this functionality was initiated in #3514. > Note, #3514 is divided on three separate PRs. Current PR is the second of three. <!-- If resolving an issue, uncomment and update the line below --> <!-- Closes #[issue-number] --> ## Test Plan <!-- Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.* --> CI
1 parent e5ca7e6 commit 5598f61

File tree

12 files changed

+593
-8
lines changed

12 files changed

+593
-8
lines changed

client-sdks/stainless/openapi.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5474,11 +5474,44 @@ components:
54745474
oneOf:
54755475
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentText'
54765476
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentImage'
5477+
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentFile'
54775478
discriminator:
54785479
propertyName: type
54795480
mapping:
54805481
input_text: '#/components/schemas/OpenAIResponseInputMessageContentText'
54815482
input_image: '#/components/schemas/OpenAIResponseInputMessageContentImage'
5483+
input_file: '#/components/schemas/OpenAIResponseInputMessageContentFile'
5484+
OpenAIResponseInputMessageContentFile:
5485+
type: object
5486+
properties:
5487+
type:
5488+
type: string
5489+
const: input_file
5490+
default: input_file
5491+
description: >-
5492+
The type of the input item. Always `input_file`.
5493+
file_data:
5494+
type: string
5495+
description: >-
5496+
The data of the file to be sent to the model.
5497+
file_id:
5498+
type: string
5499+
description: >-
5500+
(Optional) The ID of the file to be sent to the model.
5501+
file_url:
5502+
type: string
5503+
description: >-
5504+
The URL of the file to be sent to the model.
5505+
filename:
5506+
type: string
5507+
description: >-
5508+
The name of the file to be sent to the model.
5509+
additionalProperties: false
5510+
required:
5511+
- type
5512+
title: OpenAIResponseInputMessageContentFile
5513+
description: >-
5514+
File content for input messages in OpenAI response format.
54825515
OpenAIResponseInputMessageContentImage:
54835516
type: object
54845517
properties:
@@ -5499,6 +5532,10 @@ components:
54995532
default: input_image
55005533
description: >-
55015534
Content type identifier, always "input_image"
5535+
file_id:
5536+
type: string
5537+
description: >-
5538+
(Optional) The ID of the file to be sent to the model.
55025539
image_url:
55035540
type: string
55045541
description: (Optional) URL of the image content
@@ -6893,6 +6930,10 @@ components:
68936930
type: string
68946931
description: >-
68956932
(Optional) ID of the previous response in a conversation
6933+
prompt:
6934+
$ref: '#/components/schemas/OpenAIResponsePrompt'
6935+
description: >-
6936+
(Optional) Reference to a prompt template and its variables.
68966937
status:
68976938
type: string
68986939
description: >-
@@ -6966,6 +7007,30 @@ components:
69667007
mcp_call: '#/components/schemas/OpenAIResponseOutputMessageMCPCall'
69677008
mcp_list_tools: '#/components/schemas/OpenAIResponseOutputMessageMCPListTools'
69687009
mcp_approval_request: '#/components/schemas/OpenAIResponseMCPApprovalRequest'
7010+
OpenAIResponsePrompt:
7011+
type: object
7012+
properties:
7013+
id:
7014+
type: string
7015+
description: Unique identifier of the prompt template
7016+
variables:
7017+
type: object
7018+
additionalProperties:
7019+
$ref: '#/components/schemas/OpenAIResponseInputMessageContent'
7020+
description: >-
7021+
Dictionary of variable names to OpenAIResponseInputMessageContent structure
7022+
for template substitution. The substitution values can either be strings,
7023+
or other Response input types like images or files.
7024+
version:
7025+
type: string
7026+
description: >-
7027+
Version number of the prompt to use (defaults to latest if not specified)
7028+
additionalProperties: false
7029+
required:
7030+
- id
7031+
title: OpenAIResponsePrompt
7032+
description: >-
7033+
OpenAI compatible Prompt object that is used in OpenAI responses.
69697034
OpenAIResponseText:
69707035
type: object
69717036
properties:
@@ -7223,6 +7288,10 @@ components:
72237288
model:
72247289
type: string
72257290
description: The underlying LLM used for completions.
7291+
prompt:
7292+
$ref: '#/components/schemas/OpenAIResponsePrompt'
7293+
description: >-
7294+
(Optional) Prompt object with ID, version, and variables.
72267295
instructions:
72277296
type: string
72287297
previous_response_id:
@@ -7300,6 +7369,10 @@ components:
73007369
type: string
73017370
description: >-
73027371
(Optional) ID of the previous response in a conversation
7372+
prompt:
7373+
$ref: '#/components/schemas/OpenAIResponsePrompt'
7374+
description: >-
7375+
(Optional) Reference to a prompt template and its variables.
73037376
status:
73047377
type: string
73057378
description: >-

docs/static/deprecated-llama-stack-spec.html

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8576,16 +8576,53 @@
85768576
},
85778577
{
85788578
"$ref": "#/components/schemas/OpenAIResponseInputMessageContentImage"
8579+
},
8580+
{
8581+
"$ref": "#/components/schemas/OpenAIResponseInputMessageContentFile"
85798582
}
85808583
],
85818584
"discriminator": {
85828585
"propertyName": "type",
85838586
"mapping": {
85848587
"input_text": "#/components/schemas/OpenAIResponseInputMessageContentText",
8585-
"input_image": "#/components/schemas/OpenAIResponseInputMessageContentImage"
8588+
"input_image": "#/components/schemas/OpenAIResponseInputMessageContentImage",
8589+
"input_file": "#/components/schemas/OpenAIResponseInputMessageContentFile"
85868590
}
85878591
}
85888592
},
8593+
"OpenAIResponseInputMessageContentFile": {
8594+
"type": "object",
8595+
"properties": {
8596+
"type": {
8597+
"type": "string",
8598+
"const": "input_file",
8599+
"default": "input_file",
8600+
"description": "The type of the input item. Always `input_file`."
8601+
},
8602+
"file_data": {
8603+
"type": "string",
8604+
"description": "The data of the file to be sent to the model."
8605+
},
8606+
"file_id": {
8607+
"type": "string",
8608+
"description": "(Optional) The ID of the file to be sent to the model."
8609+
},
8610+
"file_url": {
8611+
"type": "string",
8612+
"description": "The URL of the file to be sent to the model."
8613+
},
8614+
"filename": {
8615+
"type": "string",
8616+
"description": "The name of the file to be sent to the model."
8617+
}
8618+
},
8619+
"additionalProperties": false,
8620+
"required": [
8621+
"type"
8622+
],
8623+
"title": "OpenAIResponseInputMessageContentFile",
8624+
"description": "File content for input messages in OpenAI response format."
8625+
},
85898626
"OpenAIResponseInputMessageContentImage": {
85908627
"type": "object",
85918628
"properties": {
@@ -8613,6 +8650,10 @@
86138650
"default": "input_image",
86148651
"description": "Content type identifier, always \"input_image\""
86158652
},
8653+
"file_id": {
8654+
"type": "string",
8655+
"description": "(Optional) The ID of the file to be sent to the model."
8656+
},
86168657
"image_url": {
86178658
"type": "string",
86188659
"description": "(Optional) URL of the image content"
@@ -8976,6 +9017,10 @@
89769017
"type": "string",
89779018
"description": "(Optional) ID of the previous response in a conversation"
89789019
},
9020+
"prompt": {
9021+
"$ref": "#/components/schemas/OpenAIResponsePrompt",
9022+
"description": "(Optional) Reference to a prompt template and its variables."
9023+
},
89799024
"status": {
89809025
"type": "string",
89819026
"description": "Current status of the response generation"
@@ -9400,6 +9445,32 @@
94009445
"title": "OpenAIResponseOutputMessageWebSearchToolCall",
94019446
"description": "Web search tool call output message for OpenAI responses."
94029447
},
9448+
"OpenAIResponsePrompt": {
9449+
"type": "object",
9450+
"properties": {
9451+
"id": {
9452+
"type": "string",
9453+
"description": "Unique identifier of the prompt template"
9454+
},
9455+
"variables": {
9456+
"type": "object",
9457+
"additionalProperties": {
9458+
"$ref": "#/components/schemas/OpenAIResponseInputMessageContent"
9459+
},
9460+
"description": "Dictionary of variable names to OpenAIResponseInputMessageContent structure for template substitution. The substitution values can either be strings, or other Response input types like images or files."
9461+
},
9462+
"version": {
9463+
"type": "string",
9464+
"description": "Version number of the prompt to use (defaults to latest if not specified)"
9465+
}
9466+
},
9467+
"additionalProperties": false,
9468+
"required": [
9469+
"id"
9470+
],
9471+
"title": "OpenAIResponsePrompt",
9472+
"description": "OpenAI compatible Prompt object that is used in OpenAI responses."
9473+
},
94039474
"OpenAIResponseText": {
94049475
"type": "object",
94059476
"properties": {
@@ -9770,6 +9841,10 @@
97709841
"type": "string",
97719842
"description": "The underlying LLM used for completions."
97729843
},
9844+
"prompt": {
9845+
"$ref": "#/components/schemas/OpenAIResponsePrompt",
9846+
"description": "(Optional) Prompt object with ID, version, and variables."
9847+
},
97739848
"instructions": {
97749849
"type": "string"
97759850
},
@@ -9858,6 +9933,10 @@
98589933
"type": "string",
98599934
"description": "(Optional) ID of the previous response in a conversation"
98609935
},
9936+
"prompt": {
9937+
"$ref": "#/components/schemas/OpenAIResponsePrompt",
9938+
"description": "(Optional) Reference to a prompt template and its variables."
9939+
},
98619940
"status": {
98629941
"type": "string",
98639942
"description": "Current status of the response generation"

docs/static/deprecated-llama-stack-spec.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6402,11 +6402,44 @@ components:
64026402
oneOf:
64036403
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentText'
64046404
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentImage'
6405+
- $ref: '#/components/schemas/OpenAIResponseInputMessageContentFile'
64056406
discriminator:
64066407
propertyName: type
64076408
mapping:
64086409
input_text: '#/components/schemas/OpenAIResponseInputMessageContentText'
64096410
input_image: '#/components/schemas/OpenAIResponseInputMessageContentImage'
6411+
input_file: '#/components/schemas/OpenAIResponseInputMessageContentFile'
6412+
OpenAIResponseInputMessageContentFile:
6413+
type: object
6414+
properties:
6415+
type:
6416+
type: string
6417+
const: input_file
6418+
default: input_file
6419+
description: >-
6420+
The type of the input item. Always `input_file`.
6421+
file_data:
6422+
type: string
6423+
description: >-
6424+
The data of the file to be sent to the model.
6425+
file_id:
6426+
type: string
6427+
description: >-
6428+
(Optional) The ID of the file to be sent to the model.
6429+
file_url:
6430+
type: string
6431+
description: >-
6432+
The URL of the file to be sent to the model.
6433+
filename:
6434+
type: string
6435+
description: >-
6436+
The name of the file to be sent to the model.
6437+
additionalProperties: false
6438+
required:
6439+
- type
6440+
title: OpenAIResponseInputMessageContentFile
6441+
description: >-
6442+
File content for input messages in OpenAI response format.
64106443
OpenAIResponseInputMessageContentImage:
64116444
type: object
64126445
properties:
@@ -6427,6 +6460,10 @@ components:
64276460
default: input_image
64286461
description: >-
64296462
Content type identifier, always "input_image"
6463+
file_id:
6464+
type: string
6465+
description: >-
6466+
(Optional) The ID of the file to be sent to the model.
64306467
image_url:
64316468
type: string
64326469
description: (Optional) URL of the image content
@@ -6697,6 +6734,10 @@ components:
66976734
type: string
66986735
description: >-
66996736
(Optional) ID of the previous response in a conversation
6737+
prompt:
6738+
$ref: '#/components/schemas/OpenAIResponsePrompt'
6739+
description: >-
6740+
(Optional) Reference to a prompt template and its variables.
67006741
status:
67016742
type: string
67026743
description: >-
@@ -7036,6 +7077,30 @@ components:
70367077
OpenAIResponseOutputMessageWebSearchToolCall
70377078
description: >-
70387079
Web search tool call output message for OpenAI responses.
7080+
OpenAIResponsePrompt:
7081+
type: object
7082+
properties:
7083+
id:
7084+
type: string
7085+
description: Unique identifier of the prompt template
7086+
variables:
7087+
type: object
7088+
additionalProperties:
7089+
$ref: '#/components/schemas/OpenAIResponseInputMessageContent'
7090+
description: >-
7091+
Dictionary of variable names to OpenAIResponseInputMessageContent structure
7092+
for template substitution. The substitution values can either be strings,
7093+
or other Response input types like images or files.
7094+
version:
7095+
type: string
7096+
description: >-
7097+
Version number of the prompt to use (defaults to latest if not specified)
7098+
additionalProperties: false
7099+
required:
7100+
- id
7101+
title: OpenAIResponsePrompt
7102+
description: >-
7103+
OpenAI compatible Prompt object that is used in OpenAI responses.
70397104
OpenAIResponseText:
70407105
type: object
70417106
properties:
@@ -7293,6 +7358,10 @@ components:
72937358
model:
72947359
type: string
72957360
description: The underlying LLM used for completions.
7361+
prompt:
7362+
$ref: '#/components/schemas/OpenAIResponsePrompt'
7363+
description: >-
7364+
(Optional) Prompt object with ID, version, and variables.
72967365
instructions:
72977366
type: string
72987367
previous_response_id:
@@ -7370,6 +7439,10 @@ components:
73707439
type: string
73717440
description: >-
73727441
(Optional) ID of the previous response in a conversation
7442+
prompt:
7443+
$ref: '#/components/schemas/OpenAIResponsePrompt'
7444+
description: >-
7445+
(Optional) Reference to a prompt template and its variables.
73737446
status:
73747447
type: string
73757448
description: >-

0 commit comments

Comments
 (0)