Training

/dataitem/create

Published @ 17/11/23 by

author Fatos
Fatos, Founder @ answerly.io
POST https://ai.api.answerly.io/dataitem/create

Creates a data item (Also known as "data set") for the knowledge hub of an agent.

Request Body

APIKey string Required
Your API key. You can read more about how to get an API Key by clicking here.

dataItem.agentId string Required
The ID of the agent that you want to create a data item for.

dataItem.type string Required
The type of the data item.

The following types are available:

Website GoogleSheet GoogleDoc

Summary YoutubeVideo DOC

CSV PDF Webpage

Link Picture Video QA

FacePop Calendar IFrame

dataItem.source string Required
The value you assign to this key should be based on the data item type.

Below is an explanation of what value to fill in for this key, corresponding to the type of data you are using.

Website - The sitemap URL.

GoogleSheet - The URL of your Google Sheet.

GoogleDoc - The URL of your Google Doc.

YoutubeVideo - The URL to your youtube video.

DOC - The URL to your DOC file.

CSV - The URL to your CSV file.

PDF - The URL to your PDF file.

Webpage - The URL of your webpage.

Link - The URL of your link.

Picture - The URL of your picture.

Video - The URL to your video.

QA - List of questions, separated by new lines

FacePop - Your FacePop ID

Calendar - Your Calendar URL

IFrame - Your IFrame URL

Use an empty string as a value if you use a data item other than the ones from the list above.

dataItem.content string Required
The value you assign to this key should be based on the data item type.

Below is an explanation of what value to fill in for this key, corresponding to the type of data you are using.

Summary - The contents of your summary.

Picture - The description of the picture.

Video - The description of your video.

QA - The answer to your questions.

Use an empty string as a value if you use a data item other than the ones from the list above.

dataItem.properties object Required
The value of this key should be an empty object unless you use the QA data type.

dataItem.properties.match string Required
ℹ️ Use this property only if you are creating a QA dataset.

broad - Broad match. We use natural language processing to analyze the query and match against your question.

exact - Exact match. Your question will only match if the query is exactly as the question.

curl --request POST \
    --url https://ai.api.answerly.io/dataitem/create \
    --header 'Content-Type: application/json' \
    --data '{
      "APIKey": "YOUR_API_KEY",
      "dataItem": {
          "agentId": "YOUR_AGENT_ID",
          "type": "Website",
          "source": "https://answerly.io/sitemap.xml",
          "content": "",
          "properties": {}
      }
  }'

Return (success)

status boolean
A boolean indicating the success or failure of the request.

data dataItem
A data item object.

{
    "status": true,
    "data": {
      "id": "YOU_DATAITEM_ID",
      "companyId": "YOUR_COMPANY_ID",
      "agentId": "YOUR_AGENT_ID",
      "type": "Website",
      "source": "https://answerly.io/sitemap.xml",
      "content": "",
      "properties": {},
      "embedData": {
        "status": "embedding",
        "comment": ""
      },
      "enabled": true,
      "interactive": false,
      "sync": {
        "sync": false,
        "lastSync": ""
      },
      "createdAt": "2023-11-08T13:34:42.083Z",
      "updatedAt": "2023-11-08T13:34:42.083Z"
    }
}

Return (failure)

status boolean
A boolean indicating the success or failure of the request.

data string
An error message returned by the server.

{
    "status": false,
    "data": "An agent with that ID was not found"
  }