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
7 changes: 5 additions & 2 deletions src/Responses/Chat/CreateResponseToolCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,36 @@

final class CreateResponseToolCall
{
private function __construct(

Check failure on line 9 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::__construct() has parameter $extraContent with no value type specified in iterable type array.

Check failure on line 9 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::__construct() has parameter $extraContent with no value type specified in iterable type array.
public readonly string $id,
public readonly string $type,
public readonly CreateResponseToolCallFunction $function,
public readonly array $extraContent
) {}

/**
* @param array{id: string, type: string, function: array{name: string, arguments: string}} $attributes
* @param array{id: string, type: string, function: array{name: string, arguments: string}, extra_content: array|null} $attributes
*/
public static function from(array $attributes): self

Check failure on line 19 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::from() has parameter $attributes with no value type specified in iterable type array.

Check failure on line 19 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::from() has parameter $attributes with no value type specified in iterable type array.
{
return new self(
$attributes['id'],
$attributes['type'],
CreateResponseToolCallFunction::from($attributes['function']),
$attributes['extra_content'] ?? []
);
}

/**
* @return array{id: string, type: string, function: array{name: string, arguments: string}}
* @return array{id: string, type: string, function: array{name: string, arguments: string}, extra_content: array}
*/
public function toArray(): array

Check failure on line 32 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::toArray() return type has no value type specified in iterable type array.

Check failure on line 32 in src/Responses/Chat/CreateResponseToolCall.php

View workflow job for this annotation

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

Method OpenAI\Responses\Chat\CreateResponseToolCall::toArray() return type has no value type specified in iterable type array.
{
return [
'id' => $this->id,
'type' => $this->type,
'function' => $this->function->toArray(),
'extra_content' => $this->extraContent,
];
}
}
4 changes: 2 additions & 2 deletions src/Transporters/HttpTransporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
/** @var array{error?: string|array{message: string|array<int, string>, type: string, code: string}} $data */
$data = json_decode($contents, true, flags: JSON_THROW_ON_ERROR);

if (isset($data['error'])) {
throw new ErrorException($data['error'], $response);
if (isset($data['error']) || isset($data[0]['error'])) {

Check failure on line 178 in src/Transporters/HttpTransporter.php

View workflow job for this annotation

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

Offset 0 on array{error?: array{message: array<int, string>|string, type: string, code: string}|string} in isset() does not exist.

Check failure on line 178 in src/Transporters/HttpTransporter.php

View workflow job for this annotation

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

Offset 0 on array{error?: array{message: array<int, string>|string, type: string, code: string}|string} in isset() does not exist.
throw new ErrorException($data['error'] ?? $data[0]['error'], $response);

Check failure on line 179 in src/Transporters/HttpTransporter.php

View workflow job for this annotation

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

Offset 'error' on array{error: array{message: array<int, string>|string, type: string, code: string}|string} on left side of ?? always exists and is not nullable.

Check failure on line 179 in src/Transporters/HttpTransporter.php

View workflow job for this annotation

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

Offset 'error' on array{error: array{message: array<int, string>|string, type: string, code: string}|string} on left side of ?? always exists and is not nullable.
}
} catch (JsonException $jsonException) {
throw new UnserializableResponse($jsonException, $response);
Expand Down
Loading