Train model using rasa NLU docker and HTTP API in typescript


I’m using this image (rasa/rasa_nlu:latest-spacy) to run a rasa nlu server container and then I want to train a model using the HTTP API.

Using curl, my model is trained successfully: curl --request POST --header "Content-Type: application/x-yml" --data-binary @data/new_data.yml localhost:5000/train?project=current

Although, making a call using typescript I get the following error: POST http://localhost:5000/train?project=current 400 (Bad Request) ... error: {error: "mapping values are not allowed in this context↵ in "<unicode string>", line 2, column 20"}

Here is my call:

const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/x-yml', }) };<any>(this.rasaServerUrl+'/train?project=current', formData, httpOptions);

Any ideas what might be the problem?

formData is a file in the following format:

language: "en" 

pipeline: "spacy_sklearn"

data: |
  ## intent:close
  - Bye
  - bye
  - I have to go
  - see you
  - bb

  ## intent:idle
  - silent
  - timeout

  ## intent:greet
  - hi
  - hello

Hi there @tkalog, what’s the difference between your formData file and your data/new_data.yml?