in experiments/veo-app/pages/gemini2.py [0:0]
def say_something_nice(name: str) -> str:
"""Says something nice about a given name using Gemini."""
app_state = me.state(AppState)
if app_state.greeting:
return app_state.greeting
try:
response = client.models.generate_content(
model=MODEL_ID,
contents=f"say something nice about {name}, they're testing you, gemini 2.0, and you appreciate this! please make it a few sentences. You may address them by name.",
config=GenerateContentConfig(
response_modalities=["TEXT"],
),
)
app_state.greeting = response.text
print(f"success! {response.text}")
return response.text
except Exception as e:
print(f"error: {e}")
raise # Re-raise the exception for tenacity to handle
return "oops, couldn't be nice" # this line is unreachable now