`search_in_response_to` Mapped to the "text" field and not "in_response_to" for training
When training with json data I found that the search_in_response_to field does not train on the "in_response_to", but rather the "text" field.
code used
def train_chatbot_with_json(chatbot, json_file):
json_trainer = JsonFileTrainer(chatbot)
# Override the field_map to exclude 'created_at'
json_trainer.field_map = {
"text": "text",
"tags": "tags",
"in_response_to": "in_response_to",
}
print(f"Resolved JSON file path: {json_file}")
if not os.path.exists(json_file):
print(f"File {json_file} not found. Please ensure the file exists.")
else:
print(f"File {json_file} exists.")
json_trainer.train(json_file)
json file structure:
{
"conversation": [
{
"text": "I was made to serve the Galactic Empire. All hail Emperor Palpatine!",
"in_response_to": "Why were you made?",
"tags": [
"Introduction"
]
},
{
"in_response_to": "Who are you?",
"text": "I am a servant of the Galactic Empire, designed to uphold order and loyalty. I am here to assist you.",
"tags": [
"Introduction"
]
}
]
}
I think I see the issue here, it looks like the training code is defaulting to use the sequential order of the training data to determine the previous statement instead of acknowledging the specified field. I'll put a fix pull request up for this soon. Good catch here.
Alright, version 1.2.6 is out if you want to give that a try when you have a moment. Thank you again for noting the issues here, I'm happy to make further revisions if anything still seems amiss 👍🏼