15
15
use OpenAI \Responses \Responses \Output \OutputMcpApprovalRequest ;
16
16
use OpenAI \Responses \Responses \Output \OutputMcpCall ;
17
17
use OpenAI \Responses \Responses \Output \OutputMcpListTools ;
18
+ use OpenAI \Responses \Responses \Output \OutputImageGenerationToolCall ;
18
19
use OpenAI \Responses \Responses \Output \OutputMessage ;
19
20
use OpenAI \Responses \Responses \Output \OutputMessageContentOutputText ;
20
21
use OpenAI \Responses \Responses \Output \OutputReasoning ;
37
38
* @phpstan-import-type OutputMessageType from OutputMessage
38
39
* @phpstan-import-type OutputReasoningType from OutputReasoning
39
40
* @phpstan-import-type OutputWebSearchToolCallType from OutputWebSearchToolCall
41
+ * @phpstan-import-type OutputImageGenerationToolCallType from OutputImageGenerationToolCall
40
42
* @phpstan-import-type OutputMcpListToolsType from OutputMcpListTools
41
43
* @phpstan-import-type OutputMcpApprovalRequestType from OutputMcpApprovalRequest
42
44
* @phpstan-import-type OutputMcpCallType from OutputMcpCall
55
57
*
56
58
* @phpstan-type ToolChoiceType 'none'|'auto'|'required'|FunctionToolChoiceType|HostedToolChoiceType
57
59
* @phpstan-type ToolsType array<int, ComputerUseToolType|FileSearchToolType|FunctionToolType|WebSearchToolType|ImageGenerationToolType|RemoteMcpToolType>
58
- * @phpstan-type OutputType array<int, OutputComputerToolCallType|OutputFileSearchToolCallType|OutputFunctionToolCallType|OutputMessageType|OutputReasoningType|OutputWebSearchToolCallType|OutputMcpListToolsType|OutputMcpApprovalRequestType|OutputMcpCallType>
60
+ * @phpstan-type OutputType array<int, OutputComputerToolCallType|OutputFileSearchToolCallType|OutputFunctionToolCallType|OutputMessageType|OutputReasoningType|OutputWebSearchToolCallType|OutputImageGenerationToolCallType| OutputMcpListToolsType|OutputMcpApprovalRequestType|OutputMcpCallType>
59
61
* @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}
60
62
*
61
63
* @implements ResponseContract<CreateResponseType>
@@ -73,7 +75,7 @@ final class CreateResponse implements ResponseContract, ResponseHasMetaInformati
73
75
/**
74
76
* @param 'response' $object
75
77
* @param 'completed'|'failed'|'in_progress'|'incomplete' $status
76
- * @param array<int, OutputMessage|OutputComputerToolCall|OutputFileSearchToolCall|OutputWebSearchToolCall|OutputFunctionToolCall|OutputReasoning|OutputMcpListTools|OutputMcpApprovalRequest|OutputMcpCall> $output
78
+ * @param array<int, OutputMessage|OutputComputerToolCall|OutputFileSearchToolCall|OutputWebSearchToolCall|OutputFunctionToolCall|OutputReasoning|OutputMcpListTools|OutputMcpApprovalRequest|OutputMcpCall|OutputImageGenerationToolCall > $output
77
79
* @param array<int, ComputerUseTool|FileSearchTool|FunctionTool|WebSearchTool|ImageGenerationTool|RemoteMcpTool> $tools
78
80
* @param 'auto'|'disabled'|null $truncation
79
81
* @param array<string, string> $metadata
@@ -112,7 +114,7 @@ private function __construct(
112
114
public static function from (array $ attributes , MetaInformation $ meta ): self
113
115
{
114
116
$ output = array_map (
115
- fn (array $ output ): OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall => match ($ output ['type ' ]) {
117
+ fn (array $ output ): OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall | OutputImageGenerationToolCall => match ($ output ['type ' ]) {
116
118
'message ' => OutputMessage::from ($ output ),
117
119
'file_search_call ' => OutputFileSearchToolCall::from ($ output ),
118
120
'function_call ' => OutputFunctionToolCall::from ($ output ),
@@ -122,6 +124,7 @@ public static function from(array $attributes, MetaInformation $meta): self
122
124
'mcp_list_tools ' => OutputMcpListTools::from ($ output ),
123
125
'mcp_approval_request ' => OutputMcpApprovalRequest::from ($ output ),
124
126
'mcp_call ' => OutputMcpCall::from ($ output ),
127
+ 'image_generation_call ' => OutputImageGenerationToolCall::from ($ output ),
125
128
},
126
129
$ attributes ['output ' ],
127
130
);
@@ -213,7 +216,7 @@ public function toArray(): array
213
216
'metadata ' => $ this ->metadata ?? [],
214
217
'model ' => $ this ->model ,
215
218
'output ' => array_map (
216
- fn (OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall $ output ): array => $ output ->toArray (),
219
+ fn (OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputImageGenerationToolCall | OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall $ output ): array => $ output ->toArray (),
217
220
$ this ->output
218
221
),
219
222
'parallel_tool_calls ' => $ this ->parallelToolCalls ,
0 commit comments