From 71317808f157e8fabfd50d70dc290f8fba7974dc Mon Sep 17 00:00:00 2001 From: Tobias Midskard Date: Thu, 5 Feb 2026 15:50:56 +0100 Subject: [PATCH] test: Cover reasoning_content stream delta --- src/Responses/Chat/CreateStreamedResponseDelta.php | 2 ++ .../Responses/Chat/CreateStreamedResponseDelta.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Responses/Chat/CreateStreamedResponseDelta.php b/src/Responses/Chat/CreateStreamedResponseDelta.php index 6439122e..e51be37e 100644 --- a/src/Responses/Chat/CreateStreamedResponseDelta.php +++ b/src/Responses/Chat/CreateStreamedResponseDelta.php @@ -12,6 +12,7 @@ final class CreateStreamedResponseDelta private function __construct( public readonly ?string $role, public readonly ?string $content, + public readonly ?string $reasoningContent, public readonly array $toolCalls, public readonly ?CreateStreamedResponseFunctionCall $functionCall, ) {} @@ -28,6 +29,7 @@ public static function from(array $attributes): self return new self( $attributes['role'] ?? null, $attributes['content'] ?? null, + $attributes['reasoning_content'] ?? null, $toolCalls, isset($attributes['function_call']) ? CreateStreamedResponseFunctionCall::from($attributes['function_call']) : null, ); diff --git a/tests/Responses/Chat/CreateStreamedResponseDelta.php b/tests/Responses/Chat/CreateStreamedResponseDelta.php index 7b8bb021..3faf21f8 100644 --- a/tests/Responses/Chat/CreateStreamedResponseDelta.php +++ b/tests/Responses/Chat/CreateStreamedResponseDelta.php @@ -18,6 +18,20 @@ expect($result) ->role->toBeNull() ->content->toBe('Hello') + ->reasoningContent->toBeNull() + ->functionCall->toBeNull(); +}); + +test('from reasoning content chunk', function () { + $delta = [ + 'reasoning_content' => 'Let me think about this...', + ]; + $result = CreateStreamedResponseDelta::from($delta); + + expect($result) + ->role->toBeNull() + ->content->toBeNull() + ->reasoningContent->toBe('Let me think about this...') ->functionCall->toBeNull(); });