malek-messaoudii commited on
Commit
e411044
·
1 Parent(s): 91b1985

Update gemini_client.py

Browse files
Files changed (1) hide show
  1. services/gemini_client.py +6 -7
services/gemini_client.py CHANGED
@@ -1,9 +1,8 @@
1
- from google.genai import Client, types
2
  import os
3
 
4
- def get_gemini_client() -> Client:
5
- """
6
- Returns a singleton Gemini AI client.
7
- Can be extended to read API key from environment variables.
8
- """
9
- return Client()
 
1
+ from google.genai import Client
2
  import os
3
 
4
+ def get_gemini_client():
5
+ api_key = os.getenv("GOOGLE_GENAI_API_KEY") # store it in .env
6
+ if not api_key:
7
+ raise ValueError("Missing GOOGLE_GENAI_API_KEY environment variable")
8
+ return Client(api_key=api_key)