Documentation  
Batch Classification

Batch Classification

Our Batch API allows you to classify or extract entities from many texts at once, and get back a single file with all the results. Batch jobs can be launched from our API, or from our web application console.

Launching a Batch Job from the App

Prepare your Data

You'll have to upload a CSV, Excel, or JSONL file. Each record should have a 'text' field. For guidance on how to prepare your data for batch classification, see our Data Preparation Guide.

Create a New Job

Navigate to the Batch Jobs page in the sidebar, and click "+ New Batch Job" at the top.

navigate

Upload Data and Select Options

Follow the steps to choose a classifier or entity extraction model, and upload your input data as a CSV, Excel sheet, or JSONL. Depending on the model, you may be able to select a confidence threshold or maximum number of labels. You can also specify the type of output file you want.

form

Start Your Job

Click "Submit" on the final screen to start your job. You'll get an email when it's done, and you can preview and download the results from the Batch Jobs page.

Launching a Batch Job from the API

Prepare your Data

You'll have to upload a CSV, Excel, or JSONL file. Each record should have a 'text' field. For guidance on how to prepare your data for batch classification, see our Data Preparation Guide.

Make a POST request to the Batch API

import requests
api_key = 'xx-your-api-key-here'
file_path = 'path-to-file.csv'
url = "https://api.trytaylor.ai/api/batch_jobs/create"
 
# Prepare the form data
form_data = {
    "model": "naics",
    "threshold": 0.2,
    "top_k": 5,
    "columns_to_classify": [3],  # zero-indexed column index
    "output_format": "csv",
}
 
# Prepare the file to be uploaded
files = {"file": (file_path, open(file_path, "rb"), "text/csv")}
 
# Send the POST request
response = requests.post(
    url,
    headers={"Authorization": f"Bearer {api_key}"},
    data=form_data,
    files=files
)
 
# Check the response
if response.status_code == 200:
    print("Job started successfully:", response.json())
else:
    print("Error:", response.status_code, response.text)