No examples in the documentation (HTTP API)

I can’t understand the http://rasa.com/docs/rasa/api/http-api/#tag/Model/paths/~1model~1train/post in order to post my training data to my server. There is no example given. Previous versions at least had examples but now, the docs are a lot messy.

Can someone provide me with an example? Can maybe the Rasa developers take this into account? There are many users in the forum that are asking similar questions.

Hi @eloukas, what exactly do you mean by example? There is an example request body in the HTTP API on the right. However, I just realised that we are missing some line breaks here. Will update that. What else are you missing? Your feedback is highly appreciated. Thanks!

In order to train a model via the API, you need to have a request body similar to this

{
    "config": "language: en\npipeline: supervised_embeddings\npolicies:\n  - name: MemoizationPolicy\n  - name: KerasPolicy",
    "domain": "intents:\n  - greet\n  - goodbye\n  - mood_affirm\n  - mood_deny\n  - mood_great\n  - mood_unhappy\nactions:\n  - utter_greet\n  - utter_cheer_up\n  - utter_did_that_help\n  - utter_happy\n  - utter_goodbye\ntemplates:\n  utter_greet:\n  - text: \"Hey! How are you?\"\n  utter_cheer_up:\n  - text: \"Here is something to cheer you up:\"\n    image: \"https://i.imgur.com/nGF1K8f.jpg\"\n  utter_did_that_help:\n  - text: \"Did that help you?\"\n  utter_happy:\n  - text: \"Great carry on!\"\n  utter_goodbye:\n  - text: \"Bye\"",
    "nlu": "## intent:greet\n  - hey\n  - hello\n## intent:goodbye\n  - cu\n  - good bye",
    "stories": "## happy path\n* greet\n  - utter_greet\n* mood_great\n  - utter_happy\n## sad path\n* greet\n  - utter_greet\n* mood_unhappy",
    "out": "models",
    "force": false
}

To actually train a model you can use

curl -X POST \
  http://localhost:5005/model/train \
  -H 'Content-Type: application/json' \
  -H 'accept: application/octet-stream' \
  -d '{
    "config": "language: en\npipeline: supervised_embeddings\npolicies:\n  - name: MemoizationPolicy\n  - name: KerasPolicy",
    "domain": "intents:\n  - greet\n  - goodbye\n  - mood_affirm\n  - mood_deny\n  - mood_great\n  - mood_unhappy\nactions:\n  - utter_greet\n  - utter_cheer_up\n  - utter_did_that_help\n  - utter_happy\n  - utter_goodbye\ntemplates:\n  utter_greet:\n  - text: \"Hey! How are you?\"\n  utter_cheer_up:\n  - text: \"Here is something to cheer you up:\"\n    image: \"https://i.imgur.com/nGF1K8f.jpg\"\n  utter_did_that_help:\n  - text: \"Did that help you?\"\n  utter_happy:\n  - text: \"Great carry on!\"\n  utter_goodbye:\n  - text: \"Bye\"",
    "nlu": "## intent:greet\n  - hey\n  - hello\n## intent:goodbye\n  - cu\n  - good bye",
    "stories": "## happy path\n* greet\n  - utter_greet\n* mood_great\n  - utter_happy\n## sad path\n* greet\n  - utter_greet\n* mood_unhappy",
    "out": "models",
    "force": false
}'

Does this help?

Hi @Tanja i am using curl -X POST http://localhost:5005/conversations/user1/messages -d '{"sender": "user1", "text": "hello"}' to add the message to the tracker but i am facing an issue as {"version":"1.10.3","status":"failure","message":"Currently, only user messages can be passed to this endpoint. Messages of sender 'user1' cannot be handled.","reason":"BadRequest","details":{"parameter":"sender","in":"body"},"help":null,"code":400}

If you can help. Thanks

Can you try to pass in "sender": "user" instead of "sender": "user1"? Everything else should stay the same.