Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system instruction support and beta API configuration #42

Conversation

gregpriday
Copy link
Contributor

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
Copy link
Contributor Author

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.

@aydinfatih
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants