buerokratt / Training-Module

MIT License
2 stars 16 forks source link

REST service to list Rasa responses #90

Open turnerrainer opened 1 year ago

turnerrainer commented 1 year ago

AS AN Architect I WANT to have a REST service to fetch a list of all Rasa responses SO THAT there wouldn't be duplicate services for it

Acceptance Criteria

Temporary list of endpoints - https://github.com/buerokratt/Buerokratt-onboarding/issues/8

GET endpoint

Example of input and output

responses of domain.yml as a raw input

PS! Request to OpenSearch

responses:
  utter_andmekaitse_küsimused:
  - text: "kõik on kaitstud"

  utter_fallback_kontroll:
  - text: "Jäi arusaamatuks, kas soovisite, et suunan edasi?"

  utter_mille_kohta_küsimus_käis:
  - text: "Kas küsimus käis selle teema kohta: {intent}? (Jah/Ei)"

  utter_not_confident:
  - text: "Ma ei saanud päris täpselt aru."

  utter_ei_pakkunud_õigesti:
  - text: "Ma pean natuke juurde õppima, et oskaksin sellele vastata."

  utter_ask_direct_to_customer_support_form_affirm_deny:
  - text: "Kas suunan teid klienditeenindajale? (Jah/Ei)"

Output

{
  "responses": [{
    "name": "utter_andmekaitse_küsimused",
    "text": "kõik on kaitstud"
  },
  {
    "name": "utter_fallback_kontroll",
    "text": "Jäi arusaamatuks, kas soovisite, et suunan edasi?"
  },
  {
    "name": "utter_mille_kohta_küsimus_käis",
    "text": "Kas küsimus käis selle teema kohta: {intent}? (Jah/Ei)"
  },
  {
    "name": "utter_not_confident",
    "text": "Ma ei saanud päris täpselt aru."
  },
  {
    "name": "utter_ei_pakkunud_õigesti",
    "text": "Ma pean natuke juurde õppima, et oskaksin sellele vastata."
  },
  {
    "name": "utter_ask_direct_to_customer_support_form_affirm_deny",
    "text": "Kas suunan teid klienditeenindajale? (Jah/Ei)"
  }]
}

POST endpoint

Where in

  utter_ask_direct_to_customer_support_form_affirm_deny:
  - text: "Kas suunan teid klienditeenindajale? (Jah/Ei)"

utter_ask_direct_to_customer_support_form_affirm_deny corresponds to response_name and Kas suunan teid klienditeenindajale? (Jah/Ei) to response_text.

Example output for a request

See example responses of domain.yml as a raw input from top

PS! Request to OpenSearch to search for on gives the following output:

{
  "responses": [{
    "name": "utter_andmekaitse_küsimused",
    "text": "kõik on kaitstud"
  },
  {
    "name": "utter_fallback_kontroll",
    "text": "Jäi arusaamatuks, kas soovisite, et suunan edasi?"
  },
  {
    "name": "utter_not_confident",
    "text": "Ma ei saanud päris täpselt aru."
  }]
}
RaulAltmae commented 1 year ago

Is the Get '/rasa/responses' endpoint suppose to get data from opensearch or domain.yml?

turnerrainer commented 1 year ago

Is the Get '/rasa/responses' endpoint suppose to get data from opensearch or domain.yml?

@RaulAltmae the AC currently states

  • [ ] Make requests to OpenSearch matching Rasa forms with index matching Rasa domain.yml

plus

Example of input and output

having a comment

PS! Request to OpenSearch

Would you like to change that?

RaulAltmae commented 1 year ago

No, request to opensearch is good. There was confusion, because in endpoint task it states that

list all Rasa responses from domain.yml in responses

image

Thats why i asked, just to be sure that we understand it the same way

RaulAltmae commented 1 year ago

This is blocked by https://github.com/buerokratt/Ruuter/discussions/132. If the problem with Ruuter is fixed then it should work as intended.

turnerrainer commented 1 year ago

This is blocked by buerokratt/Ruuter#132. If the problem with Ruuter is fixed then it should work as intended.

@RaulAltmae https://github.com/buerokratt/Ruuter/discussions/132#discussioncomment-4958365

RaulAltmae commented 1 year ago

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

turnerrainer commented 8 months ago

Blocked due to Node errors. @KasparMinn to fix, @varmoh deploys.

turnerrainer commented 8 months ago

Blocked by #289

Kristjan259 commented 7 months ago

When I go to page: https://admin.dev.buerokratt.ee/training/training/responses i see:

Image

So the JSON response seems to be there but responses themselves are not visible.

KasparMinn commented 7 months ago

PR: https://github.com/buerokratt/Training-Module/pull/316

This PR changes the functionality of the responses page slightly to fetch correct information from OpenSearch as well as correctly establish the three different searches for Rules.

Screenshots of the requests under PR link.