Skip to content

Commit 0787025

Browse files
authored
fix(OpenAI): add support for reasoning.summary (#642)
1 parent 64eb929 commit 0787025

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Responses/Responses/CreateResponseReasoning.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use OpenAI\Testing\Responses\Concerns\Fakeable;
1010

1111
/**
12-
* @phpstan-type ReasoningType array{effort: ?string, generate_summary: ?string}
12+
* @phpstan-type ReasoningType array{effort: ?string, generate_summary: ?string, summary: ?string}
1313
*
1414
* @implements ResponseContract<ReasoningType>
1515
*/
@@ -24,7 +24,8 @@ final class CreateResponseReasoning implements ResponseContract
2424

2525
private function __construct(
2626
public readonly ?string $effort,
27-
public readonly ?string $generate_summary,
27+
public readonly ?string $generateSummary,
28+
public readonly ?string $summary,
2829
) {}
2930

3031
/**
@@ -34,7 +35,8 @@ public static function from(array $attributes): self
3435
{
3536
return new self(
3637
effort: $attributes['effort'] ?? null,
37-
generate_summary: $attributes['generate_summary'] ?? null,
38+
generateSummary: $attributes['generate_summary'] ?? null,
39+
summary: $attributes['summary'] ?? null,
3840
);
3941
}
4042

@@ -45,7 +47,8 @@ public function toArray(): array
4547
{
4648
return [
4749
'effort' => $this->effort,
48-
'generate_summary' => $this->generate_summary,
50+
'generate_summary' => $this->generateSummary,
51+
'summary' => $this->summary,
4952
];
5053
}
5154
}

tests/Fixtures/Responses.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function createResponseResource(): array
3535
'reasoning' => [
3636
'effort' => null,
3737
'generate_summary' => null,
38+
'summary' => null,
3839
],
3940
'store' => true,
4041
'temperature' => 1.0,
@@ -170,6 +171,7 @@ function retrieveResponseResource(): array
170171
'reasoning' => [
171172
'effort' => null,
172173
'generate_summary' => null,
174+
'summary' => null,
173175
],
174176
'store' => true,
175177
'temperature' => 1.0,

0 commit comments

Comments
 (0)