Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
palle-k opened this issue Sep 1, 2022 · 1 comment
Open

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

palle-k opened this issue Sep 1, 2022 · 1 comment

Comments

@palle-k
Copy link
Contributor

palle-k commented Sep 1, 2022

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[]
}
@jankoenig
Copy link
Member

jankoenig commented Oct 19, 2022

Thank you @palle-k, this is a great idea!

I really like your non-breaking solution with multipleValues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants