Update call_llm.py with beginner friendly AI Studio key support

Adding a whole client definition for those using AI Studio
This commit is contained in:
SkrOYC
2025-04-07 19:32:55 -04:00
committed by GitHub
parent 374d3eb44d
commit b7a4378c08

View File

@@ -48,6 +48,10 @@ def call_llm(prompt: str, use_cache: bool = True) -> str:
project=os.getenv("GEMINI_PROJECT_ID", "your-project-id"),
location=os.getenv("GEMINI_LOCATION", "us-central1")
)
# You can comment the previous line and use the AI Studio key instead:
# client = genai.Client(
# api_key=os.getenv("GEMINI_API_KEY", "your-api_key"),
# )
model = os.getenv("GEMINI_MODEL", "gemini-2.5-pro-exp-03-25")
response = client.models.generate_content(
model=model,
@@ -118,4 +122,4 @@ if __name__ == "__main__":
print("Making call...")
response1 = call_llm(test_prompt, use_cache=False)
print(f"Response: {response1}")