Train rasa via endpoint

So I have a rasa server running on http://localhost:5005/webhooks/rest/webhook by bulding it from a docker-compose file… So there’s rasa server running on a docker container. Can anyone tell if I can send train request to the endpoint URL…? If possible how? This is my scenario, I’ve attached my docker-compose.yml, Kindly have a look at that.docker-compose.yml (664 Bytes)

Side note: your server is running on localhost:5005, the webhooks route is just one route available.

Otherwise: Yes, you can. See the Rasa Open Source API Spec

Hi @mloubser, Thanks for the reply. The model/train endpoint works just fine whenever the rasa server is started through system[locally]. However when the rasa server is started through docker, and the endpoint is called I’m getting a 404 Error. I don’t know what’s the isue or what’s the right question to ask…

You’ll need to expose the rasa server. What does your docker-compose.yml look like?

I’ve exposed the ports in the docker-compose file… I’m able to post conversations… The docker-compose.yml file has been attached with the issue. Kindly have a check.

Ok, so you are trying to run training in a separate service on startup, and that service is not exposed. The rasa-run service should be able to receive a train request too though; What curl request are you sending?

Yes exactly, @mloubser when i send the following request to a rasa server which is started locally(i.e starting through terminal using “rasa run” cmd), im successfully able to train without any problem… However when i send the same request to a rasa server which is started through docker Im getting a 404.

This is my cURL request

curl --location --request POST 'http://localhost:5005/model/train?save_to_default_model_directory=true&force_training=false&callback_url=' \
--header 'Content-Type: application/x-yaml' \
--data-raw 'version: '\''2.0'\''
language: en
pipeline: null
policies: null

intents: [greet, goodbye, affirm, deny, mood_great, mood_unhappy, bot_challenge]
  - {text: '\''Hey! How are you?'\''}
  - {text: '\''Here is something to cheer you up:'\'', image: '\'''\''}
  - {text: '\''Did that help you?'\''}
  - {text: '\''Great, carry on!'\''}
  - {text: Bye}
  - {text: '\''I am a bot, powered by Rasa.'\''}
session_config: {session_expiration_time: 60, carry_over_slots_to_new_session: true}

- intent: greet
  examples: |
    - hey
    - hello
    - hi
    - hello there
    - good morning
    - good evening
    - moin
    - hey there
    - let'\''s go
    - hey dude
    - goodmorning
    - goodevening
    - good afternoon
- intent: goodbye
  examples: |
    - good afternoon
    - cu
    - good by
    - cee you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later
- intent: affirm
  examples: |
    - yes
    - y
    - indeed
    - of course
    - that sounds good
    - correct
- intent: deny
  examples: |
    - no
    - n
    - never
    - I don'\''t think so
    - don'\''t like that
    - no way
    - not really
- intent: mood_great
  examples: |
    - perfect
    - great
    - amazing
    - feeling like a king
    - wonderful
    - I am feeling very good
    - I am great
    - I am amazing
    - I am going to save the world
    - super stoked
    - extremely good
    - so so perfect
    - so good
    - so perfect
- intent: mood_unhappy
  examples: |
    - my day was horrible
    - I am sad
    - I don'\''t feel very well
    - I am disappointed
    - super sad
    - I'\''m so sad
    - sad
    - very sad
    - unhappy
    - not good
    - not very good
    - extremly sad
    - so saad
    - so sad
- intent: bot_challenge
  examples: |
    - are you a bot?
    - are you a human?
    - am I talking to a bot?
    - am I talking to a human?

- story: happy path
  - {intent: greet}
  - {action: utter_greet}
  - {intent: mood_great}
  - {action: utter_happy}
- story: sad path 1
  - {intent: greet}
  - {action: utter_greet}
  - {intent: mood_unhappy}
  - {action: utter_cheer_up}
  - {action: utter_did_that_help}
  - {intent: affirm}
  - {action: utter_happy}
- story: sad path 2
  - {intent: greet}
  - {action: utter_greet}
  - {intent: mood_unhappy}
  - {action: utter_cheer_up}
  - {action: utter_did_that_help}
  - {intent: deny}
  - {action: utter_goodbye}

- rule: Say goodbye anytime the user says goodbye
  - {intent: goodbye}
  - {action: utter_goodbye}
- rule: Say '\''I am a bot'\'' anytime the user challenges
  - {intent: bot_challenge}
  - {action: utter_iamabot}

@mloubser , Any update on this problem? Did you try training rasa server after starting it using the attached docker-compose.yml

Sorry I thought I posted a follow up q - do all other endpoints of your docker-compose server work?

Yes able to communicate with the bot through the endpoint. Only /train is unavailable