Chatbot Operations

Retrain an existing chatbot

The Chatbot Retrain API enables you to retrain an existing chatbot. This API is applicable for chatbots with the custom-data-upload model. It allows you to update the chatbot's knowledge base with new information or remove existing data.

You can provide new training data through various methods:

  • Text data via sourceText
  • URLs to scrape via urlsToScrape
  • Product information via products
  • Q&A pairs via qAndAs

You can also remove specific knowledge chunks using the deletes array.

Note: The amount of new data you can add is subject to character limits based on your plan.

post/retrain-chatbot

Request

  • Base URL: https://api.chat-data.com/api/v2
  • URL: https://api.chat-data.com/api/v2/retrain-chatbot
  • Auth: HTTP bearer

Request body

chatbotIdstring required

The unique identifier allocated to the chatbot.

sourceTextstring

Text data intended for chatbot training, subject to character limits based on your plan. A chatbot has one text source: this value replaces the current text. Send an empty string to remove the text; omit the field to keep the current text.

urlsToScrapestring[]

A list of URLs provided for text content extraction. The web crawling process concludes once the list of URLs is fully processed or the chatbot's character limit is reached. URLs must begin with 'http://' or 'https://'. Applicable only to chatbots using the custom-data-upload model. A website that already exists with the same URL is recrawled to get the latest content.

Example request

{
  "sourceText": "Holiday hours: our support team is closed on December 25 and January 1. Orders placed on those days ship the next business day.",
  "urlsToScrape": [
    "https://www.example.com/help/warranty",
    "https://www.example.com/help/size-guide"
  ],
  "options": {
    "Cookies": "session_id=9f8e7d6c5b4a3f2e1d0c; theme=dark",
    "includeOnlyTags": "div.site-content",
    "excludeTags": "div#sidebar"
  },
  "products": [
    {
      "id": "shopify_1234567",
      "information": {
        "id": "shopify_1234567",
        "name": "Fleece Drawstring Joggers",
        "color": "white"
      }
    }
  ],
  "qAndAs": [
    {
      "question": "Do you ship internationally?",
      "answer": "Yes, we ship to over 40 countries. International orders usually arrive within 7-14 business days."
    }
  ],
  "deletes": [
    {
      "type": "website",
      "url": "https://www.example.com/help/old-returns-policy"
    },
    {
      "type": "product",
      "id": "shopify_7654321"
    }
  ]
}

Response

The new data was accepted. Training runs in the background; poll GET /chatbot/status/{chatbotId} for progress.

chatbotIdstring required

The unique identifier allocated to the chatbot. Use this ID in API calls about this chatbot.

consumedCharactersnumber required

The number of training characters charged by this call. Websites are not counted here; they are charged when they are crawled.

remainingCharactersnumber required

The number of training characters that remain available in your account. As long as the balance is positive, even by a single character, a training run proceeds and is limited only by the per-chatbot training character limit.

status'success' required

Example response

{
  "chatbotId": "6650f1c2a9e4b83d2c7a1f05",
  "consumedCharacters": 156,
  "remainingCharacters": 999844,
  "dataSources": [
    {
      "characters": 156,
      "type": "text"
    },
    {
      "name": "https://www.example.com/help/shipping",
      "characters": 0,
      "type": "website"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.