-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeminiTapping.py
More file actions
31 lines (24 loc) · 965 Bytes
/
Copy pathGeminiTapping.py
File metadata and controls
31 lines (24 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from google import genai
GEMINI_API_KEY = "PRIVATE INFORMATION"
client = genai.Client(api_key=GEMINI_API_KEY)
name = None
def GeminiPromptSynthesis(user_prompt, filename):
try:
# Requesting the content
response = client.models.generate_content(
model="gemini-2.0-flash-lite",
contents=f"You are a dino. Make me detailed notes on this topic: {user_prompt}"
)
# Pulling the text into a variable
ai_text = response.text
# WRITING TO FILE
with open(filename, "w", encoding="utf-8") as file:
file.write(f"TOPIC: {user_prompt}\n")
file.write("-" * 30 + "\n")
file.write(ai_text)
# This is the ONLY thing that should print
print(f"--- Process Complete: Check {filename} ---")
return ai_text
except Exception as e:
print(f"Error: {e}")
return None