google-gemini-php / laravel

⚡️ Gemini PHP for Laravel is a community-maintained PHP API client that allows you to interact with the Gemini AI API.
MIT License
253 stars 29 forks source link

How do we manually specify the text model to be used. #11

Closed richardksizemore closed 4 weeks ago

richardksizemore commented 1 month ago

How do we specify which text model to specifically use in our requests. For example models/gemini-1.0-pro vs models/gemini-1.5-pro vs models/gemini-1.5-flash. I understand how to switch between geminiPro() and geminiProVision() but not between the different text model versions. Thanks

aydinfatih commented 1 month ago

Hello @richardksizemore You can use generativeModel method.You can pass string instead of enum to the model parameter.

$gemini->generativeModel(model: ModelType::GEMINI_PRO);
richardksizemore commented 1 month ago

Thanks for the quick response @aydinfatih

For clarification like this?

Gemini::generativeModel(model: 'gemini-1.5-flash')->withGenerationConfig($this->generationConfig) ->generateContent($prompt);

aydinfatih commented 1 month ago

You are welcome. Yes, you can use it this way.