File tree 1 file changed +5
-2
lines changed
homeassistant/components/google_generative_ai_conversation
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 44
44
CONFIG_SCHEMA = cv .config_entry_only_config_schema (DOMAIN )
45
45
PLATFORMS = (Platform .CONVERSATION ,)
46
46
47
- type GoogleGenerativeAIConfigEntry = ConfigEntry [genai . Client ]
47
+ type GoogleGenerativeAIConfigEntry = ConfigEntry [Client ]
48
48
49
49
50
50
async def async_setup (hass : HomeAssistant , config : ConfigType ) -> bool :
@@ -144,7 +144,10 @@ async def async_setup_entry(
144
144
145
145
def init_client ():
146
146
nonlocal client
147
- client = genai .Client (api_key = entry .data [CONF_API_KEY ])
147
+ client = Client (api_key = entry .data [CONF_API_KEY ])
148
+
149
+ if client is None :
150
+ raise HomeAssistantError ("Google Generative AI client is not initialized" )
148
151
149
152
await hass .async_add_executor_job (init_client )
150
153
You can’t perform that action at this time.
0 commit comments