Train Classifier
jina.train_classifier
ActionAI & modelsconnection required
Calls the Jina AI API with the connection's credentials.
Train a few-shot classifier from labelled examples, or add more examples to a classifier that already exists.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- Bearer token
- Providers
- Jina AI
- Secret shape
- the API key, or {"api_key": "…"}
- Config it needs
- base_url, default_embedding_model, default_reranker_model
- Resolved by
- config.connection_id, else node.connection_id
Configuration
5 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
input Labelled examples, each {"text": "…", "label": "…"}. Creating a classifier needs at least two distinct labels. | array | Yes | — | array of object | [{"label":"billing","text":"refund me"}] |
model Embedding model to build a new classifier on, for example jina-embeddings-v3. Ignored when classifier_id is set. | string | No | — | — | jina-embeddings-v3 |
classifier_id Add these examples to an existing classifier instead of creating one. | string | No | — | — | — |
access Visibility of a newly created classifier. | string | No | public | one of "public", "private" | — |
num_iters Training iterations to run over the examples. | number | No | 10 | 1–100 | — |
- At least one of model, classifier_id must be set.
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"access": "public",
"input": [
{
"label": "billing",
"text": "refund me"
}
],
"model": "jina-embeddings-v3",
"num_iters": 10
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
classifier_id The classifier that was trained. | string | — |
num_samples Examples accepted in this request. | number | — |
created True when this call created the classifier. | boolean | — |
usage Token usage Jina billed for this call. | object | — |
{
"classifier_id": "",
"created": false,
"num_samples": 0,
"usage": {}
}See Train Classifier run in a workflow.
In a technical demo we add the Jina AI connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.