From 47dd1d8cc8afbd2dda158ee353cd5b183849fc87 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 1 Jul 2025 09:01:11 +0200 Subject: [PATCH] refactor: rename `GOOGLE_API_KEY` to `GEMINI_API_KEY` --- .env | 2 +- examples/google/audio-input.php | 6 +++--- examples/google/chat.php | 6 +++--- examples/google/image-input.php | 6 +++--- examples/google/pdf-input-binary.php | 6 +++--- examples/google/server-tools.php | 6 +++--- examples/google/stream.php | 6 +++--- examples/google/structured-output-clock.php | 6 +++--- examples/google/structured-output-math.php | 6 +++--- examples/google/toolcall.php | 6 +++--- examples/store/mariadb-similarity-search-gemini.php | 6 +++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.env b/.env index 7dbea184..22048c1c 100644 --- a/.env +++ b/.env @@ -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://root@127.0.0.1:3309/my_database diff --git a/examples/google/audio-input.php b/examples/google/audio-input.php index 6ad09a75..06e3f561 100644 --- a/examples/google/audio-input.php +++ b/examples/google/audio-input.php @@ -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); diff --git a/examples/google/chat.php b/examples/google/chat.php index 133e1e76..29d76ae2 100644 --- a/examples/google/chat.php +++ b/examples/google/chat.php @@ -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); diff --git a/examples/google/image-input.php b/examples/google/image-input.php index d6644a1f..5a9c6e3d 100644 --- a/examples/google/image-input.php +++ b/examples/google/image-input.php @@ -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); diff --git a/examples/google/pdf-input-binary.php b/examples/google/pdf-input-binary.php index c10401ee..e4730997 100644 --- a/examples/google/pdf-input-binary.php +++ b/examples/google/pdf-input-binary.php @@ -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); diff --git a/examples/google/server-tools.php b/examples/google/server-tools.php index 0b1d24a3..d18cc25f 100644 --- a/examples/google/server-tools.php +++ b/examples/google/server-tools.php @@ -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]); diff --git a/examples/google/stream.php b/examples/google/stream.php index de9bc5d3..58e808a3 100644 --- a/examples/google/stream.php +++ b/examples/google/stream.php @@ -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); diff --git a/examples/google/structured-output-clock.php b/examples/google/structured-output-clock.php index 5043db5b..f7866f6e 100644 --- a/examples/google/structured-output-clock.php +++ b/examples/google/structured-output-clock.php @@ -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()); diff --git a/examples/google/structured-output-math.php b/examples/google/structured-output-math.php index 2168cde5..cdb558f3 100644 --- a/examples/google/structured-output-math.php +++ b/examples/google/structured-output-math.php @@ -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(); diff --git a/examples/google/toolcall.php b/examples/google/toolcall.php index 2e47b3a5..87e4ae51 100644 --- a/examples/google/toolcall.php +++ b/examples/google/toolcall.php @@ -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()); diff --git a/examples/store/mariadb-similarity-search-gemini.php b/examples/store/mariadb-similarity-search-gemini.php index 25df7003..5d758102 100644 --- a/examples/store/mariadb-similarity-search-gemini.php +++ b/examples/store/mariadb-similarity-search-gemini.php @@ -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); } @@ -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);