We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2208650 commit 6be70efCopy full SHA for 6be70ef
homeassistant/components/google_generative_ai_conversation/__init__.py
@@ -139,7 +139,14 @@ async def async_setup_entry(
139
"""Set up Google Generative AI Conversation from a config entry."""
140
141
try:
142
- client = genai.Client(api_key=entry.data[CONF_API_KEY])
+ client: genai.Client | None = None
143
+
144
+ def init_client():
145
+ nonlocal client
146
+ client = genai.Client(api_key=entry.data[CONF_API_KEY])
147
148
+ await hass.async_add_executor_job(init_client)
149
150
await client.aio.models.get(
151
model=entry.options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL),
152
config={"http_options": {"timeout": TIMEOUT_MILLIS}},
0 commit comments