mirror of https://github.com/home-assistant/core
Rename voice_assistant to assist_pipeline (#91371)
* Rename voice_assistant to assist_pipeline * Fix tests * Fix voip test --------- Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
32344a8488
commit
4e80154ebe
|
@ -105,6 +105,8 @@ build.json @home-assistant/supervisor
|
|||
/homeassistant/components/arris_tg2492lg/ @vanbalken
|
||||
/homeassistant/components/aseko_pool_live/ @milanmeu
|
||||
/tests/components/aseko_pool_live/ @milanmeu
|
||||
/homeassistant/components/assist_pipeline/ @balloob @synesthesiam
|
||||
/tests/components/assist_pipeline/ @balloob @synesthesiam
|
||||
/homeassistant/components/asuswrt/ @kennedyshead @ollo69
|
||||
/tests/components/asuswrt/ @kennedyshead @ollo69
|
||||
/homeassistant/components/atag/ @MatsNL
|
||||
|
@ -1312,8 +1314,6 @@ build.json @home-assistant/supervisor
|
|||
/tests/components/vizio/ @raman325
|
||||
/homeassistant/components/vlc_telnet/ @rodripf @MartinHjelmare
|
||||
/tests/components/vlc_telnet/ @rodripf @MartinHjelmare
|
||||
/homeassistant/components/voice_assistant/ @balloob @synesthesiam
|
||||
/tests/components/voice_assistant/ @balloob @synesthesiam
|
||||
/homeassistant/components/voip/ @balloob @synesthesiam
|
||||
/tests/components/voip/ @balloob @synesthesiam
|
||||
/homeassistant/components/volumio/ @OnFreund
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""The Voice Assistant integration."""
|
||||
"""The Assist pipeline integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncIterable
|
||||
|
@ -33,7 +33,7 @@ __all__ = (
|
|||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up Voice Assistant integration."""
|
||||
"""Set up the Assist pipeline integration."""
|
||||
await async_setup_pipeline_store(hass)
|
||||
async_register_websocket_api(hass)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
"""Constants for the Assist pipeline integration."""
|
||||
DOMAIN = "assist_pipeline"
|
|
@ -1,4 +1,4 @@
|
|||
"""Voice Assistant errors."""
|
||||
"""Assist pipeline errors."""
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"domain": "voice_assistant",
|
||||
"name": "Voice Assistant",
|
||||
"domain": "assist_pipeline",
|
||||
"name": "Assist pipeline",
|
||||
"codeowners": ["@balloob", "@synesthesiam"],
|
||||
"dependencies": ["conversation", "stt", "tts"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/voice_assistant",
|
||||
"documentation": "https://www.home-assistant.io/integrations/assist_pipeline",
|
||||
"iot_class": "local_push",
|
||||
"quality_scale": "internal",
|
||||
"requirements": ["webrtcvad==2.0.10"]
|
|
@ -1,4 +1,4 @@
|
|||
"""Voice Assistant Websocket API."""
|
||||
"""Assist pipeline Websocket API."""
|
||||
import asyncio
|
||||
import audioop # pylint: disable=deprecated-module
|
||||
from collections.abc import Callable
|
||||
|
@ -33,12 +33,12 @@ def async_register_websocket_api(hass: HomeAssistant) -> None:
|
|||
"""Register the websocket API."""
|
||||
websocket_api.async_register_command(
|
||||
hass,
|
||||
"voice_assistant/run",
|
||||
"assist_pipeline/run",
|
||||
websocket_run,
|
||||
vol.All(
|
||||
websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
||||
{
|
||||
vol.Required("type"): "voice_assistant/run",
|
||||
vol.Required("type"): "assist_pipeline/run",
|
||||
# pylint: disable-next=unnecessary-lambda
|
||||
vol.Required("start_stage"): lambda val: PipelineStage(val),
|
||||
# pylint: disable-next=unnecessary-lambda
|
|
@ -1,2 +0,0 @@
|
|||
"""Constants for the Voice Assistant integration."""
|
||||
DOMAIN = "voice_assistant"
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Voice over IP",
|
||||
"codeowners": ["@balloob", "@synesthesiam"],
|
||||
"config_flow": true,
|
||||
"dependencies": ["voice_assistant"],
|
||||
"dependencies": ["assist_pipeline"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/voip",
|
||||
"iot_class": "local_push",
|
||||
"quality_scale": "internal",
|
||||
|
|
|
@ -10,13 +10,13 @@ import async_timeout
|
|||
from voip_utils import CallInfo, RtpDatagramProtocol, SdpInfo, VoipDatagramProtocol
|
||||
|
||||
from homeassistant.components import stt, tts
|
||||
from homeassistant.components.voice_assistant import (
|
||||
from homeassistant.components.assist_pipeline import (
|
||||
Pipeline,
|
||||
PipelineEvent,
|
||||
PipelineEventType,
|
||||
async_pipeline_from_audio_stream,
|
||||
)
|
||||
from homeassistant.components.voice_assistant.vad import VoiceCommandSegmenter
|
||||
from homeassistant.components.assist_pipeline.vad import VoiceCommandSegmenter
|
||||
from homeassistant.const import __version__
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -398,6 +398,12 @@
|
|||
"config_flow": true,
|
||||
"iot_class": "cloud_polling"
|
||||
},
|
||||
"assist_pipeline": {
|
||||
"name": "Assist pipeline",
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "local_push"
|
||||
},
|
||||
"asterisk": {
|
||||
"name": "Asterisk",
|
||||
"integrations": {
|
||||
|
@ -6056,12 +6062,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"voice_assistant": {
|
||||
"name": "Voice Assistant",
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "local_push"
|
||||
},
|
||||
"voicerss": {
|
||||
"name": "VoiceRSS",
|
||||
"integration_type": "hub",
|
||||
|
|
|
@ -2619,7 +2619,7 @@ waterfurnace==1.1.0
|
|||
# homeassistant.components.cisco_webex_teams
|
||||
webexteamssdk==1.1.1
|
||||
|
||||
# homeassistant.components.voice_assistant
|
||||
# homeassistant.components.assist_pipeline
|
||||
webrtcvad==2.0.10
|
||||
|
||||
# homeassistant.components.whirlpool
|
||||
|
|
|
@ -1880,7 +1880,7 @@ wallbox==0.4.12
|
|||
# homeassistant.components.folder_watcher
|
||||
watchdog==2.3.1
|
||||
|
||||
# homeassistant.components.voice_assistant
|
||||
# homeassistant.components.assist_pipeline
|
||||
webrtcvad==2.0.10
|
||||
|
||||
# homeassistant.components.whirlpool
|
||||
|
|
|
@ -136,4 +136,4 @@ async def init_components(
|
|||
assert await async_setup_component(hass, tts.DOMAIN, {"tts": {"platform": "test"}})
|
||||
assert await async_setup_component(hass, stt.DOMAIN, {"stt": {"platform": "test"}})
|
||||
assert await async_setup_component(hass, "media_source", {})
|
||||
assert await async_setup_component(hass, "voice_assistant", {})
|
||||
assert await async_setup_component(hass, "assist_pipeline", {})
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components import stt, voice_assistant
|
||||
from homeassistant.components import assist_pipeline, stt
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ async def test_pipeline_from_audio_stream(
|
|||
yield b"part2"
|
||||
yield b""
|
||||
|
||||
await voice_assistant.async_pipeline_from_audio_stream(
|
||||
await assist_pipeline.async_pipeline_from_audio_stream(
|
||||
hass,
|
||||
events.append,
|
||||
stt.SpeechMetadata(
|
|
@ -1,8 +1,8 @@
|
|||
"""Websocket tests for Voice Assistant integration."""
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.voice_assistant.const import DOMAIN
|
||||
from homeassistant.components.voice_assistant.pipeline import (
|
||||
from homeassistant.components.assist_pipeline.const import DOMAIN
|
||||
from homeassistant.components.assist_pipeline.pipeline import (
|
||||
STORAGE_KEY,
|
||||
STORAGE_VERSION,
|
||||
PipelineStorageCollection,
|
||||
|
@ -67,7 +67,7 @@ async def test_loading_datasets_from_storage(
|
|||
hass_storage[STORAGE_KEY] = {
|
||||
"version": 1,
|
||||
"minor_version": 1,
|
||||
"key": "voice_assistant.pipelines",
|
||||
"key": "assist_pipeline.pipelines",
|
||||
"data": {
|
||||
"items": [
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ async def test_loading_datasets_from_storage(
|
|||
},
|
||||
}
|
||||
|
||||
assert await async_setup_component(hass, "voice_assistant", {})
|
||||
assert await async_setup_component(hass, "assist_pipeline", {})
|
||||
|
||||
store: PipelineStorageCollection = hass.data[DOMAIN]
|
||||
assert len(store.data) == 3
|
|
@ -1,7 +1,7 @@
|
|||
"""Tests for webrtcvad voice command segmenter."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.voice_assistant.vad import VoiceCommandSegmenter
|
||||
from homeassistant.components.assist_pipeline.vad import VoiceCommandSegmenter
|
||||
|
||||
_ONE_SECOND = 16000 * 2 # 16Khz 16-bit
|
||||
|
|
@ -4,8 +4,8 @@ from unittest.mock import ANY, MagicMock, patch
|
|||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.voice_assistant.const import DOMAIN
|
||||
from homeassistant.components.voice_assistant.pipeline import (
|
||||
from homeassistant.components.assist_pipeline.const import DOMAIN
|
||||
from homeassistant.components.assist_pipeline.pipeline import (
|
||||
Pipeline,
|
||||
PipelineStorageCollection,
|
||||
)
|
||||
|
@ -25,7 +25,7 @@ async def test_text_only_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "intent",
|
||||
"end_stage": "intent",
|
||||
"input": {"text": "Are the lights on?"},
|
||||
|
@ -67,7 +67,7 @@ async def test_audio_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "stt",
|
||||
"end_stage": "tts",
|
||||
"input": {
|
||||
|
@ -139,7 +139,7 @@ async def test_intent_timeout(
|
|||
):
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "intent",
|
||||
"end_stage": "intent",
|
||||
"input": {"text": "Are the lights on?"},
|
||||
|
@ -180,12 +180,12 @@ async def test_text_pipeline_timeout(
|
|||
await asyncio.sleep(3600)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.voice_assistant.pipeline.PipelineInput.execute",
|
||||
"homeassistant.components.assist_pipeline.pipeline.PipelineInput.execute",
|
||||
new=sleepy_run,
|
||||
):
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "intent",
|
||||
"end_stage": "intent",
|
||||
"input": {"text": "Are the lights on?"},
|
||||
|
@ -218,7 +218,7 @@ async def test_intent_failed(
|
|||
):
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "intent",
|
||||
"end_stage": "intent",
|
||||
"input": {"text": "Are the lights on?"},
|
||||
|
@ -258,12 +258,12 @@ async def test_audio_pipeline_timeout(
|
|||
await asyncio.sleep(3600)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.voice_assistant.pipeline.PipelineInput.execute",
|
||||
"homeassistant.components.assist_pipeline.pipeline.PipelineInput.execute",
|
||||
new=sleepy_run,
|
||||
):
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "stt",
|
||||
"end_stage": "tts",
|
||||
"input": {
|
||||
|
@ -298,7 +298,7 @@ async def test_stt_provider_missing(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "stt",
|
||||
"end_stage": "tts",
|
||||
"input": {
|
||||
|
@ -321,14 +321,14 @@ async def test_stt_stream_failed(
|
|||
) -> None:
|
||||
"""Test events from a pipeline run with a non-existent STT provider."""
|
||||
with patch(
|
||||
"tests.components.voice_assistant.conftest.MockSttProvider.async_process_audio_stream",
|
||||
"tests.components.assist_pipeline.conftest.MockSttProvider.async_process_audio_stream",
|
||||
new=MagicMock(side_effect=RuntimeError),
|
||||
):
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "stt",
|
||||
"end_stage": "tts",
|
||||
"input": {
|
||||
|
@ -376,7 +376,7 @@ async def test_tts_failed(
|
|||
await client.send_json(
|
||||
{
|
||||
"id": 5,
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "tts",
|
||||
"end_stage": "tts",
|
||||
"input": {"text": "Lights are on."},
|
||||
|
@ -411,7 +411,7 @@ async def test_invalid_stage_order(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/run",
|
||||
"type": "assist_pipeline/run",
|
||||
"start_stage": "tts",
|
||||
"end_stage": "stt",
|
||||
"input": {"text": "Lights are on."},
|
||||
|
@ -432,7 +432,7 @@ async def test_add_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/create",
|
||||
"type": "assist_pipeline/pipeline/create",
|
||||
"conversation_engine": "test_conversation_engine",
|
||||
"language": "test_language",
|
||||
"name": "test_name",
|
||||
|
@ -472,7 +472,7 @@ async def test_delete_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/create",
|
||||
"type": "assist_pipeline/pipeline/create",
|
||||
"conversation_engine": "test_conversation_engine",
|
||||
"language": "test_language",
|
||||
"name": "test_name",
|
||||
|
@ -488,7 +488,7 @@ async def test_delete_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/delete",
|
||||
"type": "assist_pipeline/pipeline/delete",
|
||||
"pipeline_id": pipeline_id,
|
||||
}
|
||||
)
|
||||
|
@ -498,7 +498,7 @@ async def test_delete_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/delete",
|
||||
"type": "assist_pipeline/pipeline/delete",
|
||||
"pipeline_id": pipeline_id,
|
||||
}
|
||||
)
|
||||
|
@ -517,14 +517,14 @@ async def test_list_pipelines(
|
|||
client = await hass_ws_client(hass)
|
||||
pipeline_store: PipelineStorageCollection = hass.data[DOMAIN]
|
||||
|
||||
await client.send_json_auto_id({"type": "voice_assistant/pipeline/list"})
|
||||
await client.send_json_auto_id({"type": "assist_pipeline/pipeline/list"})
|
||||
msg = await client.receive_json()
|
||||
assert msg["success"]
|
||||
assert msg["result"] == []
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/create",
|
||||
"type": "assist_pipeline/pipeline/create",
|
||||
"conversation_engine": "test_conversation_engine",
|
||||
"language": "test_language",
|
||||
"name": "test_name",
|
||||
|
@ -536,7 +536,7 @@ async def test_list_pipelines(
|
|||
assert msg["success"]
|
||||
assert len(pipeline_store.data) == 1
|
||||
|
||||
await client.send_json_auto_id({"type": "voice_assistant/pipeline/list"})
|
||||
await client.send_json_auto_id({"type": "assist_pipeline/pipeline/list"})
|
||||
msg = await client.receive_json()
|
||||
assert msg["success"]
|
||||
assert msg["result"] == [
|
||||
|
@ -560,7 +560,7 @@ async def test_update_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/update",
|
||||
"type": "assist_pipeline/pipeline/update",
|
||||
"conversation_engine": "new_conversation_engine",
|
||||
"language": "new_language",
|
||||
"name": "new_name",
|
||||
|
@ -578,7 +578,7 @@ async def test_update_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/create",
|
||||
"type": "assist_pipeline/pipeline/create",
|
||||
"conversation_engine": "test_conversation_engine",
|
||||
"language": "test_language",
|
||||
"name": "test_name",
|
||||
|
@ -593,7 +593,7 @@ async def test_update_pipeline(
|
|||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "voice_assistant/pipeline/update",
|
||||
"type": "assist_pipeline/pipeline/update",
|
||||
"conversation_engine": "new_conversation_engine",
|
||||
"language": "new_language",
|
||||
"name": "new_name",
|
|
@ -4,7 +4,7 @@ from unittest.mock import Mock, patch
|
|||
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components import voice_assistant, voip
|
||||
from homeassistant.components import assist_pipeline, voip
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -35,7 +35,7 @@ async def test_pipeline(hass: HomeAssistant) -> None:
|
|||
|
||||
# Test empty data
|
||||
event_callback(
|
||||
voice_assistant.PipelineEvent(
|
||||
assist_pipeline.PipelineEvent(
|
||||
type="not-used",
|
||||
data={},
|
||||
)
|
||||
|
@ -43,8 +43,8 @@ async def test_pipeline(hass: HomeAssistant) -> None:
|
|||
|
||||
# Fake intent result
|
||||
event_callback(
|
||||
voice_assistant.PipelineEvent(
|
||||
type=voice_assistant.PipelineEventType.INTENT_END,
|
||||
assist_pipeline.PipelineEvent(
|
||||
type=assist_pipeline.PipelineEventType.INTENT_END,
|
||||
data={
|
||||
"intent_output": {
|
||||
"conversation_id": "fake-conversation",
|
||||
|
@ -55,8 +55,8 @@ async def test_pipeline(hass: HomeAssistant) -> None:
|
|||
|
||||
# Proceed with media output
|
||||
event_callback(
|
||||
voice_assistant.PipelineEvent(
|
||||
type=voice_assistant.PipelineEventType.TTS_END,
|
||||
assist_pipeline.PipelineEvent(
|
||||
type=assist_pipeline.PipelineEventType.TTS_END,
|
||||
data={"tts_output": {"media_id": _MEDIA_ID}},
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue