Skip to content

Commit 1ab1195

Browse files
committed
MyPy error
1 parent 0bbd1ab commit 1ab1195

File tree

1 file changed

+5
-2
lines changed
  • homeassistant/components/google_generative_ai_conversation

1 file changed

+5
-2
lines changed

homeassistant/components/google_generative_ai_conversation/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
4545
PLATFORMS = (Platform.CONVERSATION,)
4646

47-
type GoogleGenerativeAIConfigEntry = ConfigEntry[genai.Client]
47+
type GoogleGenerativeAIConfigEntry = ConfigEntry[Client]
4848

4949

5050
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
@@ -144,7 +144,10 @@ async def async_setup_entry(
144144

145145
def init_client():
146146
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")
148151

149152
await hass.async_add_executor_job(init_client)
150153

0 commit comments

Comments
 (0)