Closed ahmadnajmdev closed 9 months ago
@ahmadnajmdev How do you like the proposed streaming response change in #23? It requires curl
extension to be enabled in PHP.
You can see the example in the README.md file.
$client = new GeminiAPI\Client('GEMINI_API_KEY');
$callback = function (GenerateContentResponse $response): void {
static $count = 0;
print "\nResponse #{$count}\n";
print $response->text();
$count++;
};
$client->geminiPro()->generateContentStream(
$callback,
new TextPart('PHP in less than 100 chars')
);
// Response #0
// PHP: a versatile, general-purpose scripting language for web development, popular for
// Response #1
// its simple syntax and rich library of functions.
Erdem,
Thanks for sharing the proposed streaming response change in #23. It looks helpful.
Thanks, Ahmad
On Fri, Jan 5, 2024, 9:03 AM Erdem Köse @.***> wrote:
@ahmadnajmdev https://github.com/ahmadnajmdev How do you like the proposed streaming response change in #23 https://github.com/gemini-api-php/client/pull/23? You can see the example in the README.md file
— Reply to this email directly, view it on GitHub https://github.com/gemini-api-php/client/issues/21#issuecomment-1878170402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUTIETAALEWAD4IGL3SILUDYM6JTJAVCNFSM6AAAAABBHT7RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYGE3TANBQGI . You are receiving this because you were mentioned.Message ID: @.***>
Add Streaming Response Here is Documentation: https://ai.google.dev/tutorials/rest_quickstart#stream_generate_content