Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing attributes for assistant streaming #392

Merged
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
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,
$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,
$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,
$attributes['type'],
ThreadRunStepResponseFunction::from($attributes['function']),
);
Expand Down