TypeSafe EvaluateBatch

TypeSafe EvaluateBatch

Certified

Evaluate a dataset with TypeSafe

Evaluates every record of a dataset against a map of typed questions via the TypeSafe System One API, with bounded concurrency, and writes one {"state", "answers"} line per record — in input order — to an ION file.

yaml
type: io.kestra.plugin.typesafe.EvaluateBatch

Evaluate support tickets in batch

yaml
id: typesafe_batch
namespace: company.team

tasks:
  - id: fetch_tickets
    type: io.kestra.plugin.core.http.Download
    uri: "https://example.com/tickets.csv"
  - id: convert_tickets
    type: io.kestra.plugin.serdes.csv.CsvToIon
    from: "{{ outputs.fetch_tickets.uri }}"
  - id: evaluate_tickets
    type: io.kestra.plugin.typesafe.EvaluateBatch
    apiKey: "{{ secret('TYPESAFE_API_KEY') }}"
    model: jev-latest
    from: "{{ outputs.convert_tickets.uri }}"
    concurrency: 5
    questions:
      is_urgent:
        type: NOUL
        instructions: Does this convey urgency?
      department:
        type: CHOICE
        instructions: Which team should handle this?
        options:
          billing: Payments, invoicing, refunds
          technical: Bugs, outages, integrations
Properties

TypeSafe API key

Bearer token sent in the Authorization header; store it as a secret.

Structured data items, either as a map, a list of map, a URI, or a JSON string.

Structured data items can be defined in the following ways:

  • A single item as a map (a document).
  • A list of items as a list of maps (a list of documents).
  • A URI, supported schemes are kestra for internal storage files, file for host local files, and nsfile for namespace files.
  • A JSON String that will then be serialized either as a single item or a list of items.

Questions

A map of typed questions, keyed by an id you choose; answers come back under the same ids.

Definitions

A typed question evaluated against a state. Use options for CHOICE, levels for SCORE, and whenTrue/whenFalse for NOUL.

instructionsstringobjectarray

Instructions

The question to evaluate. Accepts a string or structured JSON (object or array); put the question in one field and data it refers to in the others.

levelsarray

Score levels

Only for SCORE questions: an ordered array of level descriptions. At least 2 levels, at most 10.

optionsobject

Choice options

Only for CHOICE questions: a map of option name to rubric description (use null when an option needs no extra detail). Maximum 255 options.

typeobject
whenFalseobject

Noul 'no' criteria

Only for NOUL questions: what a no answer (value near 0) means. Accepts a string or structured JSON.

whenTrueobject

Noul 'yes' criteria

Only for NOUL questions: what a yes answer (value near 1) means. Accepts a string or structured JSON.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Defaulthttps://api.typesafe.ai

TypeSafe base URL

Base URL of the TypeSafe API. Override it to target a mock server in tests.

Default5

Concurrency

Maximum number of records evaluated concurrently. Requests may complete out of order, but output lines always follow input order. Note that a persistently rate-limited (HTTP 429) call can issue up to 8 HTTP requests per record (initial attempt plus 3 retries, each transparently retried once by the underlying HTTP client), so keep this value modest to stay within the API rate limits.

Defaultjev-latest

Model

The model that handles the request, e.g. jev-latest. The response reports the versioned model id that answered.

Default0

Record count

Number of records evaluated and written to the output file.

Model

The versioned model id reported by the TypeSafe API responses. When responses disagree (e.g. an alias rolled over mid-batch), this is the last evaluated record's model; per-record answers always correspond to the model that produced them. Null when the dataset is empty and no evaluation was performed.

Formaturi

Output URI

URI of the ION file in Kestra's internal storage, with one {"state", "answers"} line per input record, in input order.

Unittokens

Total number of input tokens reported by the TypeSafe API across all records.

Unittokens

Total number of output tokens reported by the TypeSafe API across all records.

Unitcount

Number of records evaluated and written to the output file.