mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 13:30:43 +00:00
Set right model in OpenAI conversation (#147575)
This commit is contained in:
committed by
Franck Nijhof
parent
17fd850fa6
commit
398dd3ae46
@@ -13,8 +13,10 @@ from openai.types.image import Image
|
||||
from openai.types.images_response import ImagesResponse
|
||||
from openai.types.responses import Response, ResponseOutputMessage, ResponseOutputText
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from syrupy.filters import props
|
||||
|
||||
from homeassistant.components.openai_conversation import CONF_FILENAMES
|
||||
from homeassistant.components.openai_conversation import CONF_CHAT_MODEL, CONF_FILENAMES
|
||||
from homeassistant.components.openai_conversation.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
@@ -806,3 +808,22 @@ async def test_migration_from_v1_to_v2_with_same_keys(
|
||||
identifiers={(DOMAIN, subentry.subentry_id)}
|
||||
)
|
||||
assert dev is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("mock_subentry_data", [{}, {CONF_CHAT_MODEL: "gpt-1o"}])
|
||||
async def test_devices(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_init_component,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Assert exception when invalid config entry is provided."""
|
||||
devices = dr.async_entries_for_config_entry(
|
||||
device_registry, mock_config_entry.entry_id
|
||||
)
|
||||
assert len(devices) == 1
|
||||
device = devices[0]
|
||||
assert device == snapshot(exclude=props("identifiers"))
|
||||
subentry = next(iter(mock_config_entry.subentries.values()))
|
||||
assert device.identifiers == {(DOMAIN, subentry.subentry_id)}
|
||||
|
||||
Reference in New Issue
Block a user