Training with custom components through HTTP API

I’m trying to use the custom sentiment analysis component, but I want to do it through the HTTP API. This means I have to put my configuration in the same file as my data, but since my pipeline has custom components :

{
 "language": "en",
 "pipeline": {
   "name": "nlp_spacy" ,                 
   "name": "tokenizer_spacy"     ,        
   "name": "sentiment.SentimentAnalyzer"  ,
   "name": "ner_crf"           ,          
   "name": "intent_featurizer_spacy"     ,
   "name": "intent_classifier_sklearn"  ,
 },
 "data": {
   "rasa_nlu_data": {
     "common_examples": [ //data ],
     "regex_features": [],
     "lookup_tables": [],
     "entity_synonyms": []
   }
 }
}

I have duplicate keys in my json file (the name keys). How do I correct this?

Hi nadabou!

I think the pipeline takes an array of objects. Rasa knows to initialize components via the order in which they’re specified in the array. If you specify your model config in a config.yml file and then pass the file to rasa (python -m rasa_nlu.train -c config/nlu_config.yml --data location/to/data.json), a metadata.json file will be created with the proper pipeline array!

Check here for details about how the pipeline works :smiley:

{
 "language": "en",
 "pipeline": [
    "nlp_spacy",                 
    "tokenizer_spacy",        
    "sentiment.SentimentAnalyzer",
    "ner_crf",          
    "intent_featurizer_spacy",
    "intent_classifier_sklearn"
  ],
 "data": {
   "rasa_nlu_data": {
     "common_examples": [ //data ],
     "regex_features": [],
     "lookup_tables": [],
     "entity_synonyms": []
   }
 }
}

I’ll try it this way, thanks!

Yes, but I’m trying to train via the HTTP API, not with the rasa command directly, that’s why I’m putting my data and config in the same JSON file.