in functions/main.py [0:0]
def call_genai_generate_content(prompt) -> str:
# Print the prompt for debugging if the log level is VERBOSE.
if LOG_LEVEL == "VERBOSE":
print_the_prompt(prompt)
try:
genai.configure(api_key=GOOGLE_API_KEY)
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(prompt)
except:
print("Failed to call the model!")
if response.text is None:
print("Block reason: " + str(response.filters))
print("Safety feedback: " + str(response.safety_feedback))
return response.text