58
58
* @phpstan-import-type FunctionToolChoiceType from FunctionToolChoice
59
59
* @phpstan-import-type HostedToolChoiceType from HostedToolChoice
60
60
* @phpstan-import-type ReasoningType from CreateResponseReasoning
61
+ * @phpstan-import-type ReferencePromptObjectType from ReferencePromptObject
61
62
*
63
+ * @phpstan-type InstructionsType array<int, mixed>|string|null
62
64
* @phpstan-type ToolChoiceType 'none'|'auto'|'required'|FunctionToolChoiceType|HostedToolChoiceType
63
65
* @phpstan-type ToolsType array<int, ComputerUseToolType|FileSearchToolType|FunctionToolType|WebSearchToolType|ImageGenerationToolType|RemoteMcpToolType|CodeInterpreterToolType>
64
66
* @phpstan-type OutputType array<int, OutputComputerToolCallType|OutputFileSearchToolCallType|OutputFunctionToolCallType|OutputMessageType|OutputReasoningType|OutputWebSearchToolCallType|OutputMcpListToolsType|OutputMcpApprovalRequestType|OutputMcpCallType|OutputImageGenerationToolCallType|OutputCodeInterpreterToolCallType>
65
- * @phpstan-type CreateResponseType array{id: string, object: 'response', created_at: int, status: 'completed'|'failed'|'in_progress'|'incomplete', error: ErrorType|null, incomplete_details: IncompleteDetailsType|null, instructions: string|null , max_output_tokens: int|null, model: string, output: OutputType, output_text: string|null, parallel_tool_calls: bool, previous_response_id: string|null, reasoning: ReasoningType|null, store: bool, temperature: float|null, text: ResponseFormatType, tool_choice: ToolChoiceType, tools: ToolsType, top_p: float|null, truncation: 'auto'|'disabled'|null, usage: UsageType|null, user: string|null, metadata: array<string, string>|null}
67
+ * @phpstan-type CreateResponseType array{id: string, object: 'response', created_at: int, status: 'completed'|'failed'|'in_progress'|'incomplete', error: ErrorType|null, incomplete_details: IncompleteDetailsType|null, instructions: InstructionsType , max_output_tokens: int|null, model: string, output: OutputType, output_text: string|null, parallel_tool_calls: bool, previous_response_id: string|null, prompt: ReferencePromptObjectType |null, reasoning: ReasoningType|null, store: bool, temperature: float|null, text: ResponseFormatType, tool_choice: ToolChoiceType, tools: ToolsType, top_p: float|null, truncation: 'auto'|'disabled'|null, usage: UsageType|null, user: string|null, metadata: array<string, string>|null}
66
68
*
67
69
* @implements ResponseContract<CreateResponseType>
68
70
*/
@@ -79,6 +81,7 @@ final class CreateResponse implements ResponseContract, ResponseHasMetaInformati
79
81
/**
80
82
* @param 'response' $object
81
83
* @param 'completed'|'failed'|'in_progress'|'incomplete' $status
84
+ * @param array<int, mixed>|string|null $instructions
82
85
* @param array<int, OutputMessage|OutputComputerToolCall|OutputFileSearchToolCall|OutputWebSearchToolCall|OutputFunctionToolCall|OutputReasoning|OutputMcpListTools|OutputMcpApprovalRequest|OutputMcpCall|OutputImageGenerationToolCall|OutputCodeInterpreterToolCall> $output
83
86
* @param array<int, ComputerUseTool|FileSearchTool|FunctionTool|WebSearchTool|ImageGenerationTool|RemoteMcpTool|ImageGenerationTool|CodeInterpreterTool> $tools
84
87
* @param 'auto'|'disabled'|null $truncation
@@ -91,13 +94,14 @@ private function __construct(
91
94
public readonly string $ status ,
92
95
public readonly ?CreateResponseError $ error ,
93
96
public readonly ?CreateResponseIncompleteDetails $ incompleteDetails ,
94
- public readonly ? string $ instructions ,
97
+ public readonly array | string | null $ instructions ,
95
98
public readonly ?int $ maxOutputTokens ,
96
99
public readonly string $ model ,
97
100
public readonly array $ output ,
98
101
public readonly ?string $ outputText ,
99
102
public readonly bool $ parallelToolCalls ,
100
103
public readonly ?string $ previousResponseId ,
104
+ public readonly ?ReferencePromptObject $ prompt ,
101
105
public readonly ?CreateResponseReasoning $ reasoning ,
102
106
public readonly bool $ store ,
103
107
public readonly ?float $ temperature ,
@@ -184,6 +188,9 @@ public static function from(array $attributes, MetaInformation $meta): self
184
188
outputText: empty ($ texts ) ? null : implode (' ' , $ texts ),
185
189
parallelToolCalls: $ attributes ['parallel_tool_calls ' ],
186
190
previousResponseId: $ attributes ['previous_response_id ' ],
191
+ prompt: isset ($ attributes ['prompt ' ])
192
+ ? ReferencePromptObject::from ($ attributes ['prompt ' ])
193
+ : null ,
187
194
reasoning: isset ($ attributes ['reasoning ' ])
188
195
? CreateResponseReasoning::from ($ attributes ['reasoning ' ])
189
196
: null ,
@@ -227,6 +234,7 @@ public function toArray(): array
227
234
),
228
235
'parallel_tool_calls ' => $ this ->parallelToolCalls ,
229
236
'previous_response_id ' => $ this ->previousResponseId ,
237
+ 'prompt ' => $ this ->prompt ?->toArray(),
230
238
'reasoning ' => $ this ->reasoning ?->toArray(),
231
239
'store ' => $ this ->store ,
232
240
'temperature ' => $ this ->temperature ,
0 commit comments