Skip to content

Commit

Permalink
Fix optional attributes for assistant streaming (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-thompson authored May 21, 2024
1 parent 648ebcc commit fc9f672
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ThreadRunStepDeltaResponse implements ResponseContract
use Fakeable;

private function __construct(
public string $id,
public ?string $id,
public string $object,
public ThreadRunStepDeltaObject $delta,
) {
Expand All @@ -35,7 +35,7 @@ private function __construct(
public static function from(array $attributes): self
{
return new self(
$attributes['id'],
$attributes['id'] ?? null,

Check failure on line 38 in src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-lowest

Offset 'id' on array{id: string, object: string, delta: array{step_details: array{type: 'message_creation', message_creation: array{message_id: string}}|array{type: 'tool_calls', tool_calls: array<int, array{id: string, type: 'function', function: array{name: string, arguments: string, output?: string|null}}|array{id: string, type: 'retrieval', retrieval: array<string, string>}|array{id?: string, type: 'code_interpreter', code_interpreter: array{input: string, outputs: array<int, array{type: 'image', image: array{file_id: string}}|array{type: 'logs', logs: string}>}}>}}} on left side of ?? always exists and is not nullable.

Check failure on line 38 in src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaResponse.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-stable

Offset 'id' on array{id: string, object: string, delta: array{step_details: array{type: 'message_creation', message_creation: array{message_id: string}}|array{type: 'tool_calls', tool_calls: array<int, array{id: string, type: 'function', function: array{name: string, arguments: string, output?: string|null}}|array{id: string, type: 'retrieval', retrieval: array<string, string>}|array{id?: string, type: 'code_interpreter', code_interpreter: array{input: string, outputs: array<int, array{type: 'image', image: array{file_id: string}}|array{type: 'logs', logs: string}>}}>}}} on left side of ?? always exists and is not nullable.
$attributes['object'],
ThreadRunStepDeltaObject::from($attributes['delta']),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ThreadRunStepResponseFunction implements ResponseContract
use Fakeable;

private function __construct(
public string $name,
public ?string $name,
public string $arguments,
public ?string $output,
) {
Expand All @@ -35,7 +35,7 @@ private function __construct(
public static function from(array $attributes): self
{
return new self(
$attributes['name'],
$attributes['name'] ?? null,

Check failure on line 38 in src/Responses/Threads/Runs/Steps/ThreadRunStepResponseFunction.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-lowest

Offset 'name' on array{name: string, arguments: string, output?: string|null} on left side of ?? always exists and is not nullable.

Check failure on line 38 in src/Responses/Threads/Runs/Steps/ThreadRunStepResponseFunction.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-stable

Offset 'name' on array{name: string, arguments: string, output?: string|null} on left side of ?? always exists and is not nullable.
$attributes['arguments'],
$attributes['output'] ?? null,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ThreadRunStepResponseFunctionToolCall implements ResponseContract
* @param 'function' $type
*/
private function __construct(
public string $id,
public ?string $id,
public string $type,
public ThreadRunStepResponseFunction $function,
) {
Expand All @@ -38,7 +38,7 @@ private function __construct(
public static function from(array $attributes): self
{
return new self(
$attributes['id'],
$attributes['id'] ?? null,

Check failure on line 41 in src/Responses/Threads/Runs/Steps/ThreadRunStepResponseFunctionToolCall.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-lowest

Offset 'id' on array{id: string, type: 'function', function: array{name: string, arguments: string, output?: string|null}} on left side of ?? always exists and is not nullable.

Check failure on line 41 in src/Responses/Threads/Runs/Steps/ThreadRunStepResponseFunctionToolCall.php

View workflow job for this annotation

GitHub Actions / Formats P8.1 - ubuntu-latest - prefer-stable

Offset 'id' on array{id: string, type: 'function', function: array{name: string, arguments: string, output?: string|null}} on left side of ?? always exists and is not nullable.
$attributes['type'],
ThreadRunStepResponseFunction::from($attributes['function']),
);
Expand Down

0 comments on commit fc9f672

Please sign in to comment.