📘

Important!

Training is needed only after you use the Add multiple documents API or the Update multiple documents API. No need to train if you used the single upload or single update APIs.

Training is needed for your uploaded documents to appear in your search results.

Since this step may take some time, depending on your library size, you should call this API with a webhook url to receive info about the training job once it is completed and to know when your library is updated and your documents are searchable. While your library is under training you can still ask question and receive answer but the answer will not be taken from the training documents until this step is completed.

curl --location --request POST 'https://api.pigro.ai/train' \
--header 'Content-Type: application/json' \
--header 'x-api-key: yourAPIKeyHere' \
--data-raw '{"webhook_url": "your.webhoook_url.here"}'

The result of the training is a POST request to the webhook you provided as follows:

{
  "success": True,
  "message": "Training went well"
}

If for any reason the training should fail you will receive this POST request:

{
  "success": False,
  "message": "Details of failure here"
}

The most common case of a training error is if there are no documents uploaded or no new documents to train.