Skip to content

refactor: rename GOOGLE_API_KEY to GEMINI_API_KEY #369

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PINECONE_HOST=
RUN_EXPENSIVE_EXAMPLES=false

# For using Gemini
GOOGLE_API_KEY=
GEMINI_API_KEY=

# For MariaDB store. Server defined in compose.yaml
MARIADB_URI=pdo-mysql://[email protected]:3309/my_database
6 changes: 3 additions & 3 deletions examples/google/audio-input.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);

$chain = new Chain($platform, $model);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_2_FLASH);

$chain = new Chain($platform, $model);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/image-input.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);

$chain = new Chain($platform, $model);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/pdf-input-binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);

$chain = new Chain($platform, $model);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/server-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);

// Available server-side tools as of 2025-06-28: url_context, google_search, code_execution
$llm = new Gemini('gemini-2.5-pro-preview-03-25', ['server_tools' => ['url_context' => true], 'temperature' => 1.0]);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_2_FLASH);

$chain = new Chain($platform, $model);
Expand Down
6 changes: 3 additions & 3 deletions examples/google/structured-output-clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);

$clock = new Clock(new SymfonyClock());
Expand Down
6 changes: 3 additions & 3 deletions examples/google/structured-output-math.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$model = new Gemini(Gemini::GEMINI_1_5_FLASH);

$processor = new ChainProcessor();
Expand Down
6 changes: 3 additions & 3 deletions examples/google/toolcall.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY'])) {
echo 'Please set the GOOGLE_API_KEY environment variable.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY'])) {
echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
exit(1);
}

$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$llm = new Gemini(Gemini::GEMINI_2_FLASH);

$toolbox = Toolbox::create(new Clock());
Expand Down
6 changes: 3 additions & 3 deletions examples/store/mariadb-similarity-search-gemini.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env');

if (empty($_ENV['GOOGLE_API_KEY']) || empty($_ENV['MARIADB_URI'])) {
echo 'Please set GOOGLE_API_KEY and MARIADB_URI environment variables.'.\PHP_EOL;
if (empty($_ENV['GEMINI_API_KEY']) || empty($_ENV['MARIADB_URI'])) {
echo 'Please set GEMINI_API_KEY and MARIADB_URI environment variables.'.\PHP_EOL;
exit(1);
}

Expand Down Expand Up @@ -56,7 +56,7 @@
$store->initialize(['dimensions' => 768]);

// create embeddings for documents
$platform = PlatformFactory::create($_ENV['GOOGLE_API_KEY']);
$platform = PlatformFactory::create($_ENV['GEMINI_API_KEY']);
$embeddings = new Embeddings(options: ['dimensions' => 768, 'task_type' => TaskType::SemanticSimilarity]);
$vectorizer = new Vectorizer($platform, $embeddings);
$indexer = new Indexer($vectorizer, $store);
Expand Down