Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Responses/Chat/CreateStreamedResponseDelta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {}
Expand All @@ -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,
);
Expand Down
14 changes: 14 additions & 0 deletions tests/Responses/Chat/CreateStreamedResponseDelta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
Loading