diff --git a/src/Data/Candidate.php b/src/Data/Candidate.php index 15ef7fa..a4dea7e 100644 --- a/src/Data/Candidate.php +++ b/src/Data/Candidate.php @@ -34,7 +34,7 @@ public function __construct( ) {} /** - * @param array{ content: ?array{ parts: array{ array{ text: ?string, inlineData: array{ mimeType: string, data: string } } }, role: string }, finishReason: ?string, safetyRatings: ?array{ array{ category: string, probability: string, blocked: ?bool } }, citationMetadata: ?array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: string, license: ?string} } }, index: ?int, tokenCount: ?int, avgLogprobs: ?float } $attributes + * @param array{ content: ?array{ parts: array{ array{ text: ?string, inlineData: array{ mimeType: string, data: string } } }, role: string }, finishReason: ?string, safetyRatings: ?array{ array{ category: string, probability: string, blocked: ?bool } }, citationMetadata: ?array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: ?string, license: ?string} } }, index: ?int, tokenCount: ?int, avgLogprobs: ?float } $attributes */ public static function from(array $attributes): self { diff --git a/src/Data/CitationMetadata.php b/src/Data/CitationMetadata.php index 09d7c57..a6843f8 100644 --- a/src/Data/CitationMetadata.php +++ b/src/Data/CitationMetadata.php @@ -21,7 +21,7 @@ public function __construct( ) {} /** - * @param array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: string, license: ?string } } } $attributes + * @param array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: ?string, license: ?string } } } $attributes */ public static function from(array $attributes): self { diff --git a/src/Data/CitationSource.php b/src/Data/CitationSource.php index 2c4c296..99606e7 100644 --- a/src/Data/CitationSource.php +++ b/src/Data/CitationSource.php @@ -16,25 +16,25 @@ final class CitationSource implements Arrayable /** * @param int $startIndex Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. * @param int $endIndex End of the attributed segment, exclusive. - * @param string $uri URI that is attributed as a source for a portion of the text. + * @param string|null $uri URI that is attributed as a source for a portion of the text. * @param string|null $license License for the GitHub project that is attributed as a source for segment. License info is required for code citations. */ public function __construct( public readonly int $startIndex, public readonly int $endIndex, - public readonly string $uri, + public readonly ?string $uri, public readonly ?string $license, ) {} /** - * @param array{ startIndex: int, endIndex: int, uri: string, license: ?string} $attributes + * @param array{ startIndex: int, endIndex: int, uri: ?string, license: ?string} $attributes */ public static function from(array $attributes): self { return new self( startIndex: $attributes['startIndex'], endIndex: $attributes['endIndex'], - uri: $attributes['uri'], + uri: $attributes['uri'] ?? null, license: $attributes['license'] ?? null, ); } diff --git a/src/Resources/GenerativeModel.php b/src/Resources/GenerativeModel.php index 51cc874..2b27c79 100644 --- a/src/Resources/GenerativeModel.php +++ b/src/Resources/GenerativeModel.php @@ -76,7 +76,7 @@ public function countTokens(string|Blob|array|Content ...$parts): CountTokensRes */ public function generateContent(string|Blob|array|Content ...$parts): GenerateContentResponse { - /** @var ResponseDTO $response */ + /** @var ResponseDTO $response */ $response = $this->transporter->request( request: new GenerateContentRequest( model: $this->model, diff --git a/src/Responses/GenerativeModel/GenerateContentResponse.php b/src/Responses/GenerativeModel/GenerateContentResponse.php index 10e9903..bf2a177 100644 --- a/src/Responses/GenerativeModel/GenerateContentResponse.php +++ b/src/Responses/GenerativeModel/GenerateContentResponse.php @@ -88,7 +88,7 @@ public function text(): string } /** - * @param array{ candidates: ?array{ array{ content: array{ parts: array{ array{ text: ?string, inlineData: array{ mimeType: string, data: string } } }, role: string }, finishReason: string, safetyRatings: array{ array{ category: string, probability: string, blocked: ?bool } }, citationMetadata: ?array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: string, license: ?string} } }, index: int, tokenCount: ?int, avgLogprobs: ?float } }, promptFeedback: ?array{ safetyRatings: array{ array{ category: string, probability: string, blocked: ?bool } }, blockReason: ?string }, usageMetadata: array{ promptTokenCount: int, candidatesTokenCount: int, totalTokenCount: int, cachedContentTokenCount: ?int } } $attributes + * @param array{ candidates: ?array{ array{ content: array{ parts: array{ array{ text: ?string, inlineData: array{ mimeType: string, data: string } } }, role: string }, finishReason: string, safetyRatings: array{ array{ category: string, probability: string, blocked: ?bool } }, citationMetadata: ?array{ citationSources: array{ array{ startIndex: int, endIndex: int, uri: ?string, license: ?string} } }, index: int, tokenCount: ?int, avgLogprobs: ?float } }, promptFeedback: ?array{ safetyRatings: array{ array{ category: string, probability: string, blocked: ?bool } }, blockReason: ?string }, usageMetadata: array{ promptTokenCount: int, candidatesTokenCount: int, totalTokenCount: int, cachedContentTokenCount: ?int } } $attributes */ public static function from(array $attributes): self {