From c086a3aa521ea2b454f5cd56baf0762acc4cec06 Mon Sep 17 00:00:00 2001 From: tronikos Date: Sat, 1 Jun 2024 04:44:22 +0000 Subject: [PATCH] Use gemini-1.5-flash-latest in google_generative_ai_conversation.generate_content --- .../components/google_generative_ai_conversation/__init__.py | 3 +-- .../snapshots/test_init.ambr | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/google_generative_ai_conversation/__init__.py b/homeassistant/components/google_generative_ai_conversation/__init__.py index b2723f8203023..523198355d1cc 100644 --- a/homeassistant/components/google_generative_ai_conversation/__init__.py +++ b/homeassistant/components/google_generative_ai_conversation/__init__.py @@ -66,8 +66,7 @@ async def generate_content(call: ServiceCall) -> ServiceResponse: } ) - model_name = "gemini-pro-vision" if image_filenames else "gemini-pro" - model = genai.GenerativeModel(model_name=model_name) + model = genai.GenerativeModel(model_name=RECOMMENDED_CHAT_MODEL) try: response = await model.generate_content_async(prompt_parts) diff --git a/tests/components/google_generative_ai_conversation/snapshots/test_init.ambr b/tests/components/google_generative_ai_conversation/snapshots/test_init.ambr index aba3f35eb193d..f68f4c6bf143c 100644 --- a/tests/components/google_generative_ai_conversation/snapshots/test_init.ambr +++ b/tests/components/google_generative_ai_conversation/snapshots/test_init.ambr @@ -6,7 +6,7 @@ tuple( ), dict({ - 'model_name': 'gemini-pro-vision', + 'model_name': 'models/gemini-1.5-flash-latest', }), ), tuple( @@ -32,7 +32,7 @@ tuple( ), dict({ - 'model_name': 'gemini-pro', + 'model_name': 'models/gemini-1.5-flash-latest', }), ), tuple(