v4

latestOpenAPI 3.1.02026-08-021957100.4 KB
Zero/Few-shot Classification

Train

Train or update a few-shot classifier.

Create a new classifier with labeled examples, or update an existing one with additional training data.

post/v1/train

Request body

OR

Example request

{
  "access": "private",
  "input": [
    {
      "label": "Biology",
      "text": "Explain the process of photosynthesis."
    },
    {
      "label": "Geography",
      "text": "What is the capital of France?"
    }
  ],
  "model": "jina-embeddings-v2-base-en",
  "num_iters": 15
}

Response

Successful Response

classifier_idstring required

ID of the classifier that was trained or updated.

num_samplesinteger required

Number of training samples processed in this request.

Example response

{
  "classifier_id": "00000000-0000-0000-0000-000000000000",
  "num_samples": 6,
  "usage": {
    "total_tokens": 1830
  }
}