gemini-api-php / laravel

Google Gemini API client for Laravel
MIT License
72 stars 8 forks source link

Add support for accessing the underlying Gemini Client #9

Closed spinalwiz closed 5 months ago

spinalwiz commented 6 months ago

It would be really helpful to have access to the underlying Gemini Client to provide access to all of the GeminiClient functionality

e.g. in vendor/gemini-api-php/laravel/src/Gemini.php

public function client()
    {
        return $this->client;
    }
erdemkose commented 6 months ago

Can you tell me more about the use case? You could use the client directly instead of getting it via the Laravel client.

spinalwiz commented 6 months ago

Because if you want to use the client directly you'd still have to do all the setup found in the Gemini Laravel service provider.

Giving direct access to the client would give you full access to all of the underlying client functionality without having to worry about configuration and setup.

I'd say it's the same use case as how Laravel Cashier lets you accesses the underlying Stripe client directly:

use Laravel\Cashier\Cashier;

$stripe = Cashier::stripe()

https://laravel.com/docs/10.x/billing#stripe-sdk

Or to give a specific use case, if Gemini::generateText() fails, there is no way of inspecting the response() to see the failure reason