Add system instruction support and beta API configuration
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
-
System Instruction Support:
- Added
withSystemInstructionmethod to theGenerativeModelclass - Updated
GenerateContentRequestand related components to include system instructions in API requests - Modified
ClientandGenerativeModelContractto support system instructions - Added tests to verify system instruction functionality
- Added
-
Beta API Support:
- Introduced
useBetaApi()method in theFactoryclass to easily set the base URL to the beta API endpoint - Added tests to cover the new beta API configuration
- Introduced
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.
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.
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