Skip to content

Create Classify Job

client.classify.create(ClassifyCreateParams { organization_id, project_id, configuration, 4 more } params, RequestOptionsoptions?): ClassifyCreateResponse { id, configuration, document_input_type, 11 more }
POST/api/v2/classify

Create a classify job.

ParametersExpand Collapse
params: ClassifyCreateParams { organization_id, project_id, configuration, 4 more }
organization_id?: string | null

Query param

formatuuid
project_id?: string | null

Query param

formatuuid
configuration?: ClassifyConfiguration { rules, mode } | null

Body param: Configuration for classification.

rules: Array<Rule>

Classification rules to apply (at least one required)

description: string

Natural language description of what to classify

maxLength500
minLength10
type: string

Document type to assign when rule matches

maxLength50
minLength1
mode?: "FAST"

Classification execution mode

configuration_id?: string | null

Body param: Product configuration ID for reusable presets

file_id?: string | null

Body param: File ID to classify

parse_job_id?: string | null

Body param: Parse job ID to classify

transaction_id?: string | null

Body param: Idempotency key scoped to the project

ReturnsExpand Collapse
ClassifyCreateResponse { id, configuration, document_input_type, 11 more }

Response for a classify job.

id: string

Unique identifier

configuration: ClassifyConfiguration { rules, mode }

Classification configuration

rules: Array<Rule>

Classification rules to apply (at least one required)

description: string

Natural language description of what to classify

maxLength500
minLength10
type: string

Document type to assign when rule matches

maxLength50
minLength1
mode?: "FAST"

Classification execution mode

document_input_type: "url" | "file_id" | "parse_job_id"

Type of document input

Accepts one of the following:
"url"
"file_id"
"parse_job_id"
document_input_value: string

Document identifier

project_id: string

Project ID

status: "PENDING" | "RUNNING" | "COMPLETED" | "FAILED"

Job status

Accepts one of the following:
"PENDING"
"RUNNING"
"COMPLETED"
"FAILED"
user_id: string

User ID

configuration_id?: string | null

Product configuration ID

created_at?: string | null

Creation datetime

formatdate-time
error_message?: string | null

Error message if job failed

parse_job_id?: string | null

Associated parse job ID

result?: ClassifyResult { confidence, reasoning, type } | null

Result of classifying a document.

confidence: number

Confidence score (0.0-1.0)

maximum1
minimum0
reasoning: string

Explanation of classification decision

type: string | null

Document type that matches, or None

transaction_id?: string | null

Idempotency key

updated_at?: string | null

Update datetime

formatdate-time

Create Classify Job

import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const classify = await client.classify.create();

console.log(classify.id);
{
  "id": "id",
  "configuration": {
    "rules": [
      {
        "description": "contains invoice number, line items, and total amount",
        "type": "invoice"
      }
    ],
    "mode": "FAST"
  },
  "document_input_type": "url",
  "document_input_value": "document_input_value",
  "project_id": "project_id",
  "status": "PENDING",
  "user_id": "user_id",
  "configuration_id": "configuration_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "parse_job_id": "parse_job_id",
  "result": {
    "confidence": 0,
    "reasoning": "reasoning",
    "type": "type"
  },
  "transaction_id": "transaction_id",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "id": "id",
  "configuration": {
    "rules": [
      {
        "description": "contains invoice number, line items, and total amount",
        "type": "invoice"
      }
    ],
    "mode": "FAST"
  },
  "document_input_type": "url",
  "document_input_value": "document_input_value",
  "project_id": "project_id",
  "status": "PENDING",
  "user_id": "user_id",
  "configuration_id": "configuration_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "parse_job_id": "parse_job_id",
  "result": {
    "confidence": 0,
    "reasoning": "reasoning",
    "type": "type"
  },
  "transaction_id": "transaction_id",
  "updated_at": "2019-12-27T18:11:19.117Z"
}