2019-10-18 18:46:45 +00:00
|
|
|
"""Agent foundation for conversation integration."""
|
|
|
|
from abc import ABC, abstractmethod
|
2019-11-07 20:21:12 +00:00
|
|
|
from typing import Optional
|
2019-10-18 18:46:45 +00:00
|
|
|
|
2019-11-26 10:30:21 +00:00
|
|
|
from homeassistant.core import Context
|
2019-10-18 18:46:45 +00:00
|
|
|
from homeassistant.helpers import intent
|
|
|
|
|
|
|
|
|
|
|
|
class AbstractConversationAgent(ABC):
|
|
|
|
"""Abstract conversation agent."""
|
|
|
|
|
2019-11-08 17:06:23 +00:00
|
|
|
@property
|
|
|
|
def attribution(self):
|
|
|
|
"""Return the attribution."""
|
|
|
|
return None
|
|
|
|
|
|
|
|
async def async_get_onboarding(self):
|
|
|
|
"""Get onboard data."""
|
|
|
|
return None
|
|
|
|
|
|
|
|
async def async_set_onboarding(self, shown):
|
|
|
|
"""Set onboard data."""
|
|
|
|
return True
|
|
|
|
|
2019-10-18 18:46:45 +00:00
|
|
|
@abstractmethod
|
2019-11-07 20:21:12 +00:00
|
|
|
async def async_process(
|
2019-11-26 10:30:21 +00:00
|
|
|
self, text: str, context: Context, conversation_id: Optional[str] = None
|
2019-11-07 20:21:12 +00:00
|
|
|
) -> intent.IntentResponse:
|
2019-10-18 18:46:45 +00:00
|
|
|
"""Process a sentence."""
|