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

main --> beta #56

Closed
wants to merge 2 commits into from
Closed
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: 1 addition & 1 deletion src/Data/Candidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Data/CitationMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions src/Data/CitationSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/GenerativeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function countTokens(string|Blob|array|Content ...$parts): CountTokensRes
*/
public function generateContent(string|Blob|array|Content ...$parts): GenerateContentResponse
{
/** @var ResponseDTO<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 }, usageMetadata: array{ promptTokenCount: int, candidatesTokenCount: int, totalTokenCount: int, cachedContentTokenCount: ?int } }> $response */
/** @var ResponseDTO<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 }, usageMetadata: array{ promptTokenCount: int, candidatesTokenCount: int, totalTokenCount: int, cachedContentTokenCount: ?int } }> $response */
$response = $this->transporter->request(
request: new GenerateContentRequest(
model: $this->model,
Expand Down
2 changes: 1 addition & 1 deletion src/Responses/GenerativeModel/GenerateContentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Loading