HTTP post your training data to NLU endpoint from Javascript

Hi, Per this article, i’m able to POST /train my nlu model using postman. But, running into issues from javasscript. My issue is in generating this request from js

language: “en” pipeline: “spacy_sklearn” data: { “rasa_nlu_data”: { “common_examples”: [ { “text”: “hey”, “intent”: “greet”, “entities”: [] } ] } }

Please describe the problem you are facing / error etc.

Note that javascript run from a browser must satisfy CORS (i.e. if you are posting via AJAX you must be in same protocol , domain ,port) - or use JSON-P or enable CORS headers (on the Rasa nlu server) - See argument --cors

If your problem is generating the json string - what is the issue (note documents omit commas etc between the properties which are needed in JSON - However if you just use a javascript object then you should be good.

I think the documentation needs to be updated, section-> “Using training data in json format:” . The language and pipeline values should be within the “data” as described below data: { language: “en”,pipeline: “spacy_sklearn”,“rasa_nlu_data”: { “common_examples”: [ { “text”: “hey”, “intent”: “greet”, “entities”: [] } ] } }

Mhm, this is at least not intended. The format should be a json looking like this:

  "language": "en",
  "pipeline": "spacy_sklearn",
  "data": {
    "rasa_nlu_data": {
      "common_examples": [
          "text": "hey",
          "intent": "greet",
          "entities": []

So the configuration at the top level and a key called data containing the json data structure.

hi @tmbo, I tried my pipeline like this and it didn’t work

	"language": "language_models/nl_model-0.0.0",
	"pipeline": [{
			"name": "nlp_spacy"
			"name": "tokenizer_spacy"
			"name": "intent_entity_featurizer_regex"
			"name": "intent_featurizer_spacy"
			"name": "ner_spacy"
			"name": "ner_synonyms"
			"name": "ner_duckling_http",
			"locale": "nl_Nothing",
			"url": "http://duckling:8000"
			"name": "intent_classifier_sklearn"
"data": {my data- this part works fine}

Hey [souvikg10] did you find how to put pipeline in json format ?

You can try this format

i already saw that link, but my doubt is that i have a customize pipeline. This is my pipe

How i put this in json format, for example the OOV_token key that is part of the intent_featurizer_count_vectors ?

train endpoint is of type x-yml so you can push your pipeline in yml with the API

Sorry im not understanding how i merge my json training data with my pipeline in the post resquest. Can you provide an example? my request “POST /train?project=5c0959e4df513060d45b081e”

language: “pt”


  • name: “tokenizer_whitespace”
  • name: “ner_crf” features: [ [“low”, “title”, “upper”], [“bias”, “low”, “prefix5”, “prefix2”, “suffix5”, “suffix3”, “suffix2”, “upper”, “title”, “digit”, “pattern”], [“low”, “title”, “upper”] ]
  • name: “intent_featurizer_count_vectors” “OOV_token”: None
  • name: “intent_classifier_tensorflow_embedding”
  • name: “ner_duckling_http” url: “http://localhost:8000” locale: “pt_PT” timezone: “Europe/London” dimensions: [“amount-of-money”,“distance”,“duration”,“email”,“phone-number”,“quantity”,“temperature”,“time”,“url”,“volume”]

data: { “rasa_nlu_data”: { “common_examples”: [ { “text”: “hey”, “intent”: “greet”, “entities”: [] } ] } }

i already did pip install rasa_nlu[tensorflow], so im not undertanding the error

which version of Rasa is it?

are you installing the latest one?

i installed the last one rasa_nlu-0.14.3 python3.4 machine centOS6

Hi there @sfurao, were you able to resolve this issue?

I’m coming across the same problem in that I’d like to use an already developed custom pipeline with the /train endpoint but I can’t figure out the correct format (or if it’s even possible).

Hi, yes its working for me now. Use a POST with “Content-Type”:“application/x-yml”. My body->

1 Like