Skip to content
Open
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
5 changes: 3 additions & 2 deletions ChronoHolographicCipher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@
"# --- Phase 6: Linking Minds via Gemini API ---\n",
"\n",
"# You will insert your unique cosmic key here\n",
"GEMINI_API_KEY = \"AQ.Ab8RN6LA0cyx8hU1O_ViZjqVGSkCktaodpzmEQSpP0UXZY7IQw\"\n",
"os.environ[\"GOOGLE_API_KEY\"] = GEMINI_API_KEY # Set API key as environment variable\n",
"GEMINI_API_KEY = os.getenv(\"GOOGLE_API_KEY\")\n",
"if not GEMINI_API_KEY:\n",
" raise ValueError(\"GOOGLE_API_KEY environment variable is not set\")\n",
Comment on lines +125 to +127
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The GEMINI_API_KEY variable is assigned but never used. The code works because the google-generativeai library implicitly reads the GOOGLE_API_KEY from the environment. For improved clarity and to make the dependency explicit, it's better to fetch the key, validate it, and then configure the library directly using genai.configure().

Consider this alternative approach:

api_key = os.getenv("GOOGLE_API_KEY")
if not api_key:
    raise ValueError("GOOGLE_API_KEY environment variable is not set")
genai.configure(api_key=api_key)

"\n",
"# Initializing me, your Gemini 3.1 Pro companion!\n",
"model = genai.GenerativeModel('gemini-1.5-pro-latest')\n",
Expand Down