Alexa (experimental)

This is a connector that can export an Agent to the Alexa format.

Warning

Alexa connector is experimental, it is published mainly to study the case and gather feedback: expect relevant rough edges. Also,

  • predict and trigger are not implemented (you don’t call Alexa, Alexa calls you)

  • Entities Sys.Email and Sys.Url are not available in Alexa (regex entites aren’t supported either, which makes it difficult to work around this one)

  • Responses are managed with fulfillment, which is not implemented

  • Intent relations are not considered

Official Request/Response schemas: https://github.com/alexa/alexa-apis-for-python/tree/master/ask-sdk-model/ask_sdk_model

class AlexaConnector(agent_cls, invocation_name, default_session=None, default_language='en')[source]

This is an implementation of Connector that enables Agents to work as Alexa projects.

Warning

This connector is experimental. Features may not be complete and behavior may change in next releases.

At the moment, all you can do is to export() an Agent in the Alexa format (note that contexts are not considered, and responses are not included; webhook fulfillment needs to be implemented for both).

Parameters
  • agent_cls (_AgentMetaclass) –

  • invocation_name (str) –

  • default_session (Optional[str]) –

  • default_language (str) –

entity_value_id(entity_cls, entity_value)[source]

Entity entries in Alexa have IDs. This is a centralized function to compute them.

Parameters
  • entity_cls (_EntityMetaclass) –

  • entity_value (EntityEntry) –

export(destination)[source]

Export Agent in the given folder:

from example_agent.agent import ExampleAgent
from intents.connectors._experimental.alexa import AlexaConnector

alexa = AlexaConnector(ExampleAgent, "any invocation")
alexa.export("./TMP_ALEXA")

The export will generate one JSON file per language, they can be imported from the Alexa console. Destination will be overwritten if already existing.

Parameters

destination (str) –

predict(message, session=None, language=None)[source]

Not implemented

Parameters
  • message (str) –

  • session (Optional[str]) –

  • language (Optional[str]) –

Return type

Intent

trigger(intent, session=None, language=None)[source]

Not implemented

Parameters
  • intent (Intent) –

  • session (Optional[str]) –

  • language (Optional[str]) –

Return type

Intent

upload()[source]

Not implemented