buerokratt / Training-Module

MIT License
2 stars 21 forks source link

REST service to create new Rasa slots #87

Open turnerrainer opened 1 year ago

turnerrainer commented 1 year ago

AS AN Architect I WANT to have a REST service to create new Rasa slots SO THAT there wouldn't be duplicate services for it

Acceptance Criteria

Temporary list of endpoints - https://github.com/buerokratt/Buerokratt-onboarding/issues/8 Proto to add new Rasa slots

slots.<slot name>.mappings.conditions are out of scope

Examples

Initial source

slots:
  common_teenus_ilm_asukoht:
    type: text
    influence_conversation: true
    mappings:
    - type: from_entity
      entity: asukoht
      intent: common_teenus_ilm

in which slots.type: text if always fixed as is.

Add more intents

When adding nlu_fallback and rahvaarv as additional intents, slots.common_teenus_ilm_asukoht.mappings.type: from_entity and slots.common_teenus_ilm_asukoht.mappings.entity: asukoht apply to all intents selected

slots:
  common_teenus_ilm_asukoht:
    type: text
    influence_conversation: true
    mappings:
    - type: from_entity
      entity: asukoht
      intent: common_teenus_ilm
    - type: from_entity
      entity: asukoht
      intent: nlu_fallback
    - type: from_entity
      entity: asukoht
      intent: rahvaarv
vmugra commented 1 year ago

Examples of creating a new slot: https://rasa.com/docs/rasa/domain#slots

Add a slot with mapping type from_entity:

slots:
  slot_name:
    type: text
    mappings:
    - type: from_entity
      entity: entity_name

Add a slot with type entity:

RaulAltmae commented 1 year ago

sample input to /rasa/slots/add

{
  "slot_name": "common_teenus_ilm_asukoht",
  "slot": {
    "common_teenus_ilm_asukoht": {
      "type": "text",
      "influence_conversation": true,
      "mappings": [
        {
          "type": "from_entity",
          "entity": "asukoht",
          "intent": "common_teenus_ilm"
        },
        {
          "type": "from_entity",
          "entity": "asukoht",
          "intent": "nlu_fallback"
        },
        {
          "type": "from_entity",
          "entity": "asukoht",
          "intent": "rahvaarv"
        }
      ]
    }
  }
}
turnerrainer commented 1 year ago

@RaulAltmae please link this issue with an appropriate pull request.

RaulAltmae commented 1 year ago

Pull request https://github.com/buerokratt/Training-Module/pull/162

ExiRain commented 11 months ago

Pull request

Now it functions, more info in the PR link

ValterAro commented 11 months ago

Seems good!