Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Feature Request: Support Multi-Valued Slots directly in Jovo #1411

@palle-k

Description

@palle-k

Amazon Lex V2, Alexa and potentially some other NLU systems support multi-valued slots, which are - as the name suggests - slots that can have a list of values.

Instead of having to go into the native interpretation, it should be possible to access lists of entities directly.

Example:
Given the phrase "Turn on {Lights}" with the slot Lights being multi valued, the utterance "Turn on the Desk Lamp, the Ceiling Lights and the Outdoor Lights" would match Lights as being ["Desk Lamp", "Ceiling Lights", "Outdoor Lights"]

Current Behavior

The only way to get the list of matched entities is to use jovo.$entities[entityName].native.
When multiple values are matched through Lex, the Entity contains a natural language concatenation of the options (like Desk Lamp, Ceiling Lights and Outdoor Lights)

Expected Behavior

It should be possible to get the list of matched entities without accessing the native interpretation.

Proposed Solution

Ideally, the type EntityMap would allow for lists of entities

export interface EntityMap<ENTITY_TYPE extends Entity = Entity> {
    [key: string]: ENTITY_TYPE | ENTITY_TYPE[] | undefined;
}

However, this would be a breaking change.

A non-breaking, alternative way to achieve this could be the following:

export interface SingleEntity {
    id?: string;
    resolved?: string;
    value?: any;
    native?: any;
}

export interface Entity extends SingleEntity {
    multipleValues?: SingleEntity[]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions