Skip to content

Commit b7a4378

Browse files
authored
Update call_llm.py with beginner friendly AI Studio key support
Adding a whole client definition for those using AI Studio
1 parent 374d3eb commit b7a4378

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

utils/call_llm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def call_llm(prompt: str, use_cache: bool = True) -> str:
4848
project=os.getenv("GEMINI_PROJECT_ID", "your-project-id"),
4949
location=os.getenv("GEMINI_LOCATION", "us-central1")
5050
)
51+
# You can comment the previous line and use the AI Studio key instead:
52+
# client = genai.Client(
53+
# api_key=os.getenv("GEMINI_API_KEY", "your-api_key"),
54+
# )
5155
model = os.getenv("GEMINI_MODEL", "gemini-2.5-pro-exp-03-25")
5256
response = client.models.generate_content(
5357
model=model,
@@ -118,4 +122,4 @@ def call_llm(prompt: str, use_cache: bool = True) -> str:
118122
print("Making call...")
119123
response1 = call_llm(test_prompt, use_cache=False)
120124
print(f"Response: {response1}")
121-
125+

0 commit comments

Comments
 (0)