From d8deef2238a4a6ea0592e1ccb85c21ea7153c109 Mon Sep 17 00:00:00 2001 From: jekalmin Date: Sun, 10 Nov 2024 21:01:31 +0900 Subject: [PATCH] [#217] fix warning of blocking call --- custom_components/extended_openai_conversation/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/extended_openai_conversation/helpers.py b/custom_components/extended_openai_conversation/helpers.py index cbd7cbe..917ac11 100644 --- a/custom_components/extended_openai_conversation/helpers.py +++ b/custom_components/extended_openai_conversation/helpers.py @@ -1,5 +1,6 @@ from abc import ABC, abstractmethod from datetime import timedelta +from functools import partial import logging import os import re @@ -152,7 +153,7 @@ async def validate_authentication( http_client=get_async_client(hass), ) - await client.models.list(timeout=10) + await hass.async_add_executor_job(partial(client.models.list, timeout=10)) class FunctionExecutor(ABC):