Train
Using the training endpoint is relevant if you want to programmatically index your content, for instance in a GitHub action. If you don't need this level of automation, we recommend that you use the Markprompt dashboard, which offers simple tools such as GitHub sync to make the process easy and setup-free.
Train content
Creates and indexes embeddings for your content.
The endpoint accepts two types of payloads:
- A JSON payload.
- A file payload, for uploading a zip file or a plain text file.
Request body (JSON)
In the case of a JSON payload, the content type header must be application/json
. The JSON payload must be of the form:
Key | Type | Description |
---|---|---|
files | array | A set of objects with the keys: |
Example request:
Request body (file)
In the case of a file payload, the content type header must be application/zip
or application/octet-stream
.
Example request:
Here is an example in JavaScript that reads a file from disk and sends it to the /train
endpoint:
Request headers
-
Authorization
The authorization header, carrying the bearer token.
-
Content-Type
The content type of the payload. Currently supported values are
application/json
,application/zip
andapplication/octet-stream
. -
x-markprompt-force-retrain
By default, if a file has been trained, sending it again with the same content will not retrain the file. If for some reason you want to force a retraining, you can pass a long this header with the value set to
true
.