Skip to content

Commit

Permalink
Support for accessing the underlying Gemini Client
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
erdemkose authored Mar 20, 2024
1 parent fc17c03 commit cd94559
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ _This library is not developed or endorsed by Google._
- [Text Embeddings](#text-embeddings)
- [Tokens counting](#tokens-counting)
- [Listing models](#listing-models)
- [Accessing the underlying Gemini API client](#accessing-the-underlying-gemini-api-client)
- [Credits](#credits)

## Installation
Expand Down Expand Up @@ -198,6 +199,14 @@ print_r(Gemini::listModels());
//]
```

### Accessing the underlying Gemini API client

```php
use GeminiAPI\Laravel\Facades\Gemini;

$client = Gemini::client();
```

## Credits

This project was inspired by the great work of [OpenAI PHP for Laravel](https://github.com/openai-php/laravel) and [OpenAI PHP client](https://github.com/openai-php/client).
Expand Down
2 changes: 2 additions & 0 deletions src/Facades/Gemini.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace GeminiAPI\Laravel\Facades;

use GeminiAPI\ClientInterface;
use GeminiAPI\Laravel\ChatSession;
use GeminiAPI\Resources\Model;
use Illuminate\Support\Facades\Facade;
Expand All @@ -18,6 +19,7 @@
* @method static string generateTextUsingImageFile(string $imageType, string $imagePath, string $prompt = '')
* @method static ChatSession startChat(array $history)
* @method static Model[] listModels()
* @method static ClientInterface client()
*/
class Gemini extends Facade
{
Expand Down
5 changes: 5 additions & 0 deletions src/Gemini.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,9 @@ public function listModels(): array

return $response->models;
}

public function client(): ClientInterface
{
return $this->client;
}
}

0 comments on commit cd94559

Please sign in to comment.