@@ -18,6 +18,7 @@ final class CreateResponseMessage
1818 private function __construct (
1919 public readonly string $ role ,
2020 public readonly ?string $ content ,
21+ public readonly ?string $ reasoningContent ,
2122 public readonly array $ annotations ,
2223 public readonly array $ toolCalls ,
2324 public readonly ?CreateResponseFunctionCall $ functionCall ,
@@ -26,7 +27,7 @@ private function __construct(
2627 ) {}
2728
2829 /**
29- * @param array{role: string, content: ?string, annotations?: array<int, array{type: string, url_citation: array{start_index: int, end_index: int, title: string, url: string}}>, function_call?: array{name: string, arguments: string}, tool_calls?: array<int, array{id: string, type: string, function: array{name: string, arguments: string}}>, audio?: CreateResponseChoiceAudioType, images?: array<int, CreateResponseChoiceImageType>} $attributes
30+ * @param array{role: string, content: ?string, reasoning_content?: ?string, annotations?: array<int, array{type: string, url_citation: array{start_index: int, end_index: int, title: string, url: string}}>, function_call?: array{name: string, arguments: string}, tool_calls?: array<int, array{id: string, type: string, function: array{name: string, arguments: string}}>, audio?: CreateResponseChoiceAudioType, images?: array<int, CreateResponseChoiceImageType>} $attributes
3031 */
3132 public static function from (array $ attributes ): self
3233 {
@@ -45,6 +46,7 @@ public static function from(array $attributes): self
4546 return new self (
4647 role: $ attributes ['role ' ],
4748 content: $ attributes ['content ' ] ?? null ,
49+ reasoningContent: $ attributes ['reasoning_content ' ] ?? null ,
4850 annotations: $ annotations ,
4951 toolCalls: $ toolCalls ,
5052 functionCall: isset ($ attributes ['function_call ' ]) ? CreateResponseFunctionCall::from ($ attributes ['function_call ' ]) : null ,
@@ -54,7 +56,7 @@ functionCall: isset($attributes['function_call']) ? CreateResponseFunctionCall::
5456 }
5557
5658 /**
57- * @return array{role: string, content: string|null, annotations?: array<int, array{type: string, url_citation: array{start_index: int, end_index: int, title: string, url: string}}>, function_call?: array{name: string, arguments: string}, tool_calls?: array<int, array{id: string, type: string, function: array{name: string, arguments: string}}>, audio?: CreateResponseChoiceAudioType, images?: array<int, CreateResponseChoiceImageType>}
59+ * @return array{role: string, content: string|null, reasoning_content?: string, annotations?: array<int, array{type: string, url_citation: array{start_index: int, end_index: int, title: string, url: string}}>, function_call?: array{name: string, arguments: string}, tool_calls?: array<int, array{id: string, type: string, function: array{name: string, arguments: string}}>, audio?: CreateResponseChoiceAudioType, images?: array<int, CreateResponseChoiceImageType>}
5860 */
5961 public function toArray (): array
6062 {
@@ -63,6 +65,10 @@ public function toArray(): array
6365 'content ' => $ this ->content ,
6466 ];
6567
68+ if ($ this ->reasoningContent !== null ) {
69+ $ data ['reasoning_content ' ] = $ this ->reasoningContent ;
70+ }
71+
6672 if ($ this ->annotations !== []) {
6773 $ data ['annotations ' ] = array_map (fn (CreateResponseChoiceAnnotations $ annotations ): array => $ annotations ->toArray (), $ this ->annotations );
6874 }
0 commit comments