Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatih Aydın committed Nov 1, 2024
2 parents 395a0d3 + b7e1378 commit 7017d9b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ To complete this quickstart, make sure that your development environment meets t

- Requires [PHP 8.1+](https://php.net/releases/)


## Setup

### Installation
Expand All @@ -49,6 +50,14 @@ First, install Gemini via the [Composer](https://getcomposer.org/) package manag
composer require google-gemini-php/client
```

If you want to use beta features you should install beta branch:

```bash
composer require google-gemini-php/client:1.0.4-beta
```

For beta documentation: https://github.com/google-gemini-php/client/tree/beta

Ensure that the `php-http/discovery` composer plugin is allowed to run or install a client manually if your project does not already have a PSR-18 client integrated.
```bash
composer require guzzlehttp/guzzle
Expand Down
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
6 changes: 3 additions & 3 deletions src/Data/CitationSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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 $license License for the GitHub project that is attributed as a source for segment. License info is required for code citations.
* @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,
Expand All @@ -27,15 +27,15 @@ public function __construct(
) {}

/**
* @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'],
license: $attributes['license'],
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 @@ -84,7 +84,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 @@ -96,7 +96,7 @@ public function json(): mixed
}

/**
* @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

0 comments on commit 7017d9b

Please sign in to comment.