mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Bump openai to 1.76.2 (#143902)
* Bump openai to 1.76.1 * Fix mypy * Fix coverage * 1.76.2 --------- Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
1ef04a8dde
commit
949225ffeb
@ -101,6 +101,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
except openai.OpenAIError as err:
|
except openai.OpenAIError as err:
|
||||||
raise HomeAssistantError(f"Error generating image: {err}") from err
|
raise HomeAssistantError(f"Error generating image: {err}") from err
|
||||||
|
|
||||||
|
if not response.data or not response.data[0].url:
|
||||||
|
raise HomeAssistantError("No image returned")
|
||||||
|
|
||||||
return response.data[0].model_dump(exclude={"b64_json"})
|
return response.data[0].model_dump(exclude={"b64_json"})
|
||||||
|
|
||||||
async def send_prompt(call: ServiceCall) -> ServiceResponse:
|
async def send_prompt(call: ServiceCall) -> ServiceResponse:
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/openai_conversation",
|
"documentation": "https://www.home-assistant.io/integrations/openai_conversation",
|
||||||
"integration_type": "service",
|
"integration_type": "service",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["openai==1.68.2"]
|
"requirements": ["openai==1.76.2"]
|
||||||
}
|
}
|
||||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -1590,7 +1590,7 @@ open-garage==0.2.0
|
|||||||
open-meteo==0.3.2
|
open-meteo==0.3.2
|
||||||
|
|
||||||
# homeassistant.components.openai_conversation
|
# homeassistant.components.openai_conversation
|
||||||
openai==1.68.2
|
openai==1.76.2
|
||||||
|
|
||||||
# homeassistant.components.openerz
|
# homeassistant.components.openerz
|
||||||
openerz-api==0.3.0
|
openerz-api==0.3.0
|
||||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -1339,7 +1339,7 @@ open-garage==0.2.0
|
|||||||
open-meteo==0.3.2
|
open-meteo==0.3.2
|
||||||
|
|
||||||
# homeassistant.components.openai_conversation
|
# homeassistant.components.openai_conversation
|
||||||
openai==1.68.2
|
openai==1.76.2
|
||||||
|
|
||||||
# homeassistant.components.openerz
|
# homeassistant.components.openerz
|
||||||
openerz-api==0.3.0
|
openerz-api==0.3.0
|
||||||
|
@ -136,6 +136,33 @@ async def test_generate_image_service_error(
|
|||||||
return_response=True,
|
return_response=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"openai.resources.images.AsyncImages.generate",
|
||||||
|
return_value=ImagesResponse(
|
||||||
|
created=1700000000,
|
||||||
|
data=[
|
||||||
|
Image(
|
||||||
|
b64_json=None,
|
||||||
|
revised_prompt=None,
|
||||||
|
url=None,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
pytest.raises(HomeAssistantError, match="No image returned"),
|
||||||
|
):
|
||||||
|
await hass.services.async_call(
|
||||||
|
"openai_conversation",
|
||||||
|
"generate_image",
|
||||||
|
{
|
||||||
|
"config_entry": mock_config_entry.entry_id,
|
||||||
|
"prompt": "Image of an epic fail",
|
||||||
|
},
|
||||||
|
blocking=True,
|
||||||
|
return_response=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_init_component")
|
@pytest.mark.usefixtures("mock_init_component")
|
||||||
async def test_generate_content_service_with_image_not_allowed_path(
|
async def test_generate_content_service_with_image_not_allowed_path(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user