mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Make Gemma models work in Google AI (#145479)
* Make Gemma models work in Google AI * move one line to be improve readability
This commit is contained in:
parent
61248c561d
commit
e13abf2034
@ -254,11 +254,11 @@ async def google_generative_ai_config_option_schema(
|
|||||||
)
|
)
|
||||||
for api_model in sorted(api_models, key=lambda x: x.display_name or "")
|
for api_model in sorted(api_models, key=lambda x: x.display_name or "")
|
||||||
if (
|
if (
|
||||||
api_model.name != "models/gemini-1.0-pro" # duplicate of gemini-pro
|
api_model.display_name
|
||||||
and api_model.display_name
|
|
||||||
and api_model.name
|
and api_model.name
|
||||||
and api_model.supported_actions
|
and "tts" not in api_model.name
|
||||||
and "vision" not in api_model.name
|
and "vision" not in api_model.name
|
||||||
|
and api_model.supported_actions
|
||||||
and "generateContent" in api_model.supported_actions
|
and "generateContent" in api_model.supported_actions
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -319,11 +319,10 @@ class GoogleGenerativeAIConversationEntity(
|
|||||||
tools.append(Tool(google_search=GoogleSearch()))
|
tools.append(Tool(google_search=GoogleSearch()))
|
||||||
|
|
||||||
model_name = self.entry.options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL)
|
model_name = self.entry.options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL)
|
||||||
# Gemini 1.0 doesn't support system_instruction while 1.5 does.
|
# Avoid INVALID_ARGUMENT Developer instruction is not enabled for <model>
|
||||||
# Assume future versions will support it (if not, the request fails with a
|
|
||||||
# clear message at which point we can fix).
|
|
||||||
supports_system_instruction = (
|
supports_system_instruction = (
|
||||||
"gemini-1.0" not in model_name and "gemini-pro" not in model_name
|
"gemma" not in model_name
|
||||||
|
and "gemini-2.0-flash-preview-image-generation" not in model_name
|
||||||
)
|
)
|
||||||
|
|
||||||
prompt_content = cast(
|
prompt_content = cast(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user