63
63
* @phpstan-type InstructionsType array<int, mixed>|string|null
64
64
* @phpstan-type ToolChoiceType 'none'|'auto'|'required'|FunctionToolChoiceType|HostedToolChoiceType
65
65
* @phpstan-type ToolsType array<int, ComputerUseToolType|FileSearchToolType|FunctionToolType|WebSearchToolType|ImageGenerationToolType|RemoteMcpToolType|CodeInterpreterToolType>
66
- * @phpstan-type OutputType array<int, OutputComputerToolCallType|OutputFileSearchToolCallType|OutputFunctionToolCallType|OutputMessageType|OutputReasoningType|OutputWebSearchToolCallType|OutputMcpListToolsType|OutputMcpApprovalRequestType|OutputMcpCallType|OutputImageGenerationToolCallType>
66
+ * @phpstan-type OutputType array<int, OutputComputerToolCallType|OutputFileSearchToolCallType|OutputFunctionToolCallType|OutputMessageType|OutputReasoningType|OutputWebSearchToolCallType|OutputMcpListToolsType|OutputMcpApprovalRequestType|OutputMcpCallType|OutputImageGenerationToolCallType|OutputCodeInterpreterToolCallType >
67
67
* @phpstan-type RetrieveResponseType 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, 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}
68
68
*
69
69
* @implements ResponseContract<RetrieveResponseType>
@@ -82,7 +82,7 @@ final class RetrieveResponse implements ResponseContract, ResponseHasMetaInforma
82
82
* @param 'response' $object
83
83
* @param 'completed'|'failed'|'in_progress'|'incomplete' $status
84
84
* @param array<int, mixed>|string|null $instructions
85
- * @param array<int, OutputMessage|OutputComputerToolCall|OutputFileSearchToolCall|OutputWebSearchToolCall|OutputFunctionToolCall|OutputReasoning|OutputMcpListTools|OutputMcpApprovalRequest|OutputMcpCall|OutputImageGenerationToolCall> $output
85
+ * @param array<int, OutputMessage|OutputComputerToolCall|OutputFileSearchToolCall|OutputWebSearchToolCall|OutputFunctionToolCall|OutputReasoning|OutputMcpListTools|OutputMcpApprovalRequest|OutputMcpCall|OutputImageGenerationToolCall|OutputCodeInterpreterToolCall > $output
86
86
* @param array<int, ComputerUseTool|FileSearchTool|FunctionTool|WebSearchTool|ImageGenerationTool|RemoteMcpTool|CodeInterpreterTool> $tools
87
87
* @param 'auto'|'disabled'|null $truncation
88
88
* @param array<string, string> $metadata
@@ -121,17 +121,18 @@ private function __construct(
121
121
public static function from (array $ attributes , MetaInformation $ meta ): self
122
122
{
123
123
$ output = array_map (
124
- fn (array $ output ): OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall |OutputImageGenerationToolCall => match ($ output ['type ' ]) {
124
+ fn (array $ output ): OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpApprovalRequest |OutputMcpCall |OutputImageGenerationToolCall | OutputCodeInterpreterToolCall => match ($ output ['type ' ]) {
125
125
'message ' => OutputMessage::from ($ output ),
126
126
'file_search_call ' => OutputFileSearchToolCall::from ($ output ),
127
127
'function_call ' => OutputFunctionToolCall::from ($ output ),
128
128
'web_search_call ' => OutputWebSearchToolCall::from ($ output ),
129
129
'computer_call ' => OutputComputerToolCall::from ($ output ),
130
130
'reasoning ' => OutputReasoning::from ($ output ),
131
- 'image_generation_call ' => OutputImageGenerationToolCall::from ($ output ),
132
131
'mcp_list_tools ' => OutputMcpListTools::from ($ output ),
133
132
'mcp_approval_request ' => OutputMcpApprovalRequest::from ($ output ),
134
133
'mcp_call ' => OutputMcpCall::from ($ output ),
134
+ 'image_generation_call ' => OutputImageGenerationToolCall::from ($ output ),
135
+ 'code_interpreter_call ' => OutputCodeInterpreterToolCall::from ($ output ),
135
136
},
136
137
$ attributes ['output ' ],
137
138
);
@@ -214,7 +215,7 @@ public function toArray(): array
214
215
'metadata ' => $ this ->metadata ?? [],
215
216
'model ' => $ this ->model ,
216
217
'output ' => array_map (
217
- fn (OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpCall |OutputMcpApprovalRequest |OutputImageGenerationToolCall $ output ): array => $ output ->toArray (),
218
+ fn (OutputMessage |OutputComputerToolCall |OutputFileSearchToolCall |OutputWebSearchToolCall |OutputFunctionToolCall |OutputReasoning |OutputMcpListTools |OutputMcpCall |OutputMcpApprovalRequest |OutputImageGenerationToolCall | OutputCodeInterpreterToolCall $ output ): array => $ output ->toArray (),
218
219
$ this ->output
219
220
),
220
221
'parallel_tool_calls ' => $ this ->parallelToolCalls ,
0 commit comments