Chat Data icon

Chat Data

Basic Chat Data Node

Overview

The "Retrain Chatbot" operation allows users to update and improve an existing chatbot's knowledge base by providing new training data. This can include custom source text, question-and-answer pairs, and URLs from which content is scraped for training purposes. The node sends this data to a backend service that retrains the chatbot model accordingly.

This operation is beneficial when you want to keep your chatbot up-to-date with fresh information or tailor it to specific topics without creating a new chatbot from scratch. For example, after adding new product details or FAQs on your website, you can retrain the chatbot to incorporate this information so it can answer user queries more accurately.

Properties

Name Meaning
Chatbot Name or ID Select the chatbot to retrain from a list of available chatbots or specify its ID using an expression.
Source Text Custom textual content to train the chatbot with. This can be any relevant information you want the chatbot to learn from.
Questions & Answers A collection of question-and-answer pairs to provide explicit training examples. Each pair consists of a "Question" (the query) and an "Answer" (the response).
URLs to Scrape One or more URLs from which the node will scrape content to use as training data for the chatbot.
Scraping Options Additional options to control how web scraping is performed:
Cookies: Semicolon-separated cookies to authorize scraping if needed.
Extract Main Content: Whether to remove common non-content elements (default true).
Include Only Tags: CSS selectors specifying which DOM elements to exclusively extract.
Exclude Tags: CSS selectors specifying which DOM elements to exclude from scraping results.

Output

The output JSON contains the response from the retraining API call. It includes:

  • success: A boolean indicating whether the retraining request was accepted successfully.
  • chatbotId: The ID of the chatbot being retrained.
  • Other fields returned by the backend service related to the retraining process status or metadata.

The output is paired with the input item index for traceability.

Dependencies

  • Requires an API key credential configured in n8n to authenticate requests to the chatbot backend service.
  • The backend service URL must be set in the credentials configuration.
  • The node uses HTTP POST requests to the /api/v2/retrain-chatbot endpoint of the backend service.

Troubleshooting

  • Missing or invalid chatbot ID: Ensure the chatbot ID or name is correctly selected or provided via expression.
  • Empty training data: If no source text, Q&A pairs, or URLs are provided, the retraining request may fail or have no effect.
  • Invalid URLs or scraping errors: Incorrect URLs or authorization issues (e.g., missing cookies) can cause scraping to fail, resulting in errors.
  • API errors: The backend may return error messages such as "status: error" with details. Check the message for clues and verify API key validity and service availability.
  • Credential misconfiguration: Missing base URL or API key in credentials will cause the node to throw an error before making requests.

To resolve errors, verify all inputs, ensure credentials are properly configured, and consult backend service logs if accessible.

Links and References

Discussion