client icon indicating copy to clipboard operation
client copied to clipboard

Add system instruction support and beta API configuration

Open gregpriday opened this issue 1 year ago • 2 comments

This PR introduces system instruction support and adds the ability to easily configure the client to use the beta API endpoint (required for system instructions).

Changes

  1. System Instruction Support:

    • Added withSystemInstruction method to the GenerativeModel class
    • Updated GenerateContentRequest and related components to include system instructions in API requests
    • Modified Client and GenerativeModelContract to support system instructions
    • Added tests to verify system instruction functionality
  2. Beta API Support:

    • Introduced useBetaApi() method in the Factory class to easily set the base URL to the beta API endpoint
    • Added tests to cover the new beta API configuration

Usage Example

Gemini::factory()
    ->useBetaApi()
    ->withApiKey('my-api-key')
    ->make();
  • The code follows the project's coding style (verified using composer lint)
  • Tests have been added for the new functionality
  • The commit history is coherent and meaningful
  • No breaking changes have been introduced, maintaining SemVer compatibility
  • Tested in my own project, and everything is working properly

Please review and let me know if any further changes are needed.

gregpriday avatar Oct 11 '24 12:10 gregpriday

I see this will actually need a few fixes and changes, but I'll wait to see if you want to add support for this first.

gregpriday avatar Oct 11 '24 12:10 gregpriday

Hello @gregpriday , First of all, thank you for your contribution.

I think it is not right to have beta and stable versions on the same branch.

Because most things change, such as parameters, returned answers, etc. Stable channel users will try and get errors when they see the beta features. Or it can be the other way around. For this, I created a new beta branch last week.

Those who want to use the beta features can add this branch as a dependency to their project.

https://packagist.org/packages/google-gemini-php/client#1.0.1-beta https://github.com/google-gemini-php/client/tree/beta

aydinfatih avatar Oct 11 '24 16:10 aydinfatih