Use case
This component lets you classify, rate, and flag rows of data in your orchestration pipeline. For example, you can use it to:- Classify customer reviews or support tickets into a fixed set of categories, with a Choice question.
- Rate reviews or survey answers on a scale that you describe—for example, satisfaction from “very dissatisfied” to “very satisfied”—with a Score question.
- Flag rows where a statement holds—for example, “the customer asks for a refund”—with a Noul question, which gives a probability that you can apply a threshold to later in your pipeline.
- Ask several of these questions about the same rows in one component.
The component sends one request to TypeSafe for each source row whose key isn’t NULL. TypeSafe charges per input token. Read Models for pricing and rate limits.
Prerequisites
Before you use this component, you need:- A TypeSafe account and API key. To get an API key from the TypeSafe console, read TypeSafe’s Quick start.
- A TypeSafe connection that holds the API key. Create it on the project’s Connections tab, as described in Add a connection. Select TypeSafe as the provider and
API Keyas the Authentication type, and enter your key in API Key. You can also create the connection from the component’s Connection property.
Properties
string
required
A human-readable name for the component.
Connect
drop-down
required
Select a TypeSafe connection. This connection holds the TypeSafe API key that the component uses. Only TypeSafe connections are listed.If the required connection doesn’t yet exist, you can create it here by selecting Add Connection in the drop-down. Read Add a connection for further details, following that process from step 4 onwards. A connection created here is visible in the Connections tab and available for other components to use.
drop-down
required
Specify the Jev model that answers the questions. The default is
jev-latest, TypeSafe’s alias for its newest stable release. The alias moves to each new release, so answers can change without any change to your pipeline. To keep the same model across runs, select a versioned model. Select [Custom] if you wish to specify a model not available in the drop-down list.string
required
The ID of your custom model. Only required if you selected
[Custom] in Model. Use the full model ID, as listed in TypeSafe’s Models.Source
drop-down
required
The Snowflake source database. The special value
[Environment Default] uses the database defined in the environment. Read Databases, Tables and Views - Overview to learn more.drop-down
required
The Snowflake source schema. The special value
[Environment Default] uses the schema defined in the environment. Read Database, Schema, and Share DDL to learn more.drop-down
required
An existing Snowflake table or view to use as the input.
drop-down
required
Select the column that identifies each row. The component copies this column, with its source data type, to the destination table, so you can join the answers back to the input table. Rows whose key is NULL are skipped: they aren’t sent to TypeSafe or written to the destination table.
column editor
required
Select the source columns that TypeSafe sees for each row. The component sends each row’s values to TypeSafe as one JSON object, the row’s state, with one key for each input column.
- Column: A column from the input table.
- Name in state: Optional. The key that TypeSafe sees for the column—for example, a more descriptive name. If you leave it blank, the key is the column name. Each input column needs a different key.
VARIANT, OBJECT, and ARRAY columns are sent as nested JSON rather than as text. The key column isn’t sent to TypeSafe unless you also select it here.Toggle Text mode on at the bottom of the dialog to open a multi-line editor that lets you add items in a single block. For more information, read Text mode.To use grid variables, toggle Use Grid Variable on. For more information, read Grid variables.integer
Set a limit for the number of rows to read from the table. The default is 1000. Leave it blank to read every row.Rows are read from the table in no particular order, so when you set a limit, which rows are read can differ from run to run.
Configure
column editor
required
The questions to ask about each row, one row per question.
- Name: A name for the question. The question’s output columns are named after it, as described in Explanation of output, and keep its case exactly as you enter it. Each name must be unique, and names that differ only in case count as the same name. No two output columns can have the same name—for example, you can’t name a question
MODEL_NAME, or use a Choice question namedAalongside a question namedA_CONFIDENCE. - Type: The kind of answer: Choice, Score, or Noul.
- Instructions format: Text or JSON. The default is Text. Select JSON to give structured instructions, as described in Advanced: structure. The Instructions cell must then hold valid JSON.
- Instructions: The question itself.
column editor
The options, levels, or yes/no definitions for each question, one row per criterion.
- Question: The name of the question that the criterion belongs to.
- Label: The criterion’s label. Labels must be unique within a question.
- Description format: Text or JSON. The default is Text. Select JSON to give a structured description. The Description cell must then hold valid JSON.
- Description: Optional. What the criterion means.
- Choice: At least one and no more than 255 criteria. Each label is an option, and the answer is one of the labels.
- Score: At least two and no more than 10 criteria. These are the levels of the scale, listed from lowest to highest. The first level is level 0.
- Noul: Optional. Up to two criteria, labeled
trueandfalse, that describe what a yes and a no mean.
Destination
drop-down
required
The target Snowflake database. The special value
[Environment Default] uses the database defined in the environment. Read Databases, Tables and Views - Overview to learn more.drop-down
required
The target Snowflake schema. The special value
[Environment Default] uses the schema defined in the environment. Read Database, Schema, and Share DDL to learn more.string
required
The Snowflake table to write the answers to. What happens if the table already exists depends on Create table options.
drop-down
required
- Replace if Table Exists: The pipeline will run despite the table already existing. The table will be recreated.
- Fail if Table Exists: If the table already exists, the pipeline will fail to run. This is the default setting.
- Append: If the table already exists, any new rows (records) will be added to the table without modifying or deleting existing rows. If the table does not exist, it is created and any new rows are inserted.
Advanced Settings
integer
The maximum number of concurrent requests to TypeSafe, from 1 to 16. The default is four. Higher values increase throughput, up to your TypeSafe organization’s rate limits. Rate-limited requests are retried.
Explanation of output
The destination table contains the key column, then each question’s columns in question order, then four fixed columns. Each column’s Snowflake data type is shown in parentheses.<name> is the question’s Name. Noul questions have no _CONFIDENCE or _PROBABILITIES columns, because the probability is the whole answer. Output column names keep the case that you entered in Name, so in later SQL, enclose a name that contains lowercase letters in double quotes.
If the request for a row is longer than the model’s context length, only that row fails. The row is still written, with NULL in its answer columns, MODEL_NAME, and INPUT_TOKENS, and the reason in ERROR_METADATA. The rest of the run carries on.
Temporary TypeSafe errors—rate limiting, overload, server errors, timeouts, and connection errors—are retried, up to five attempts for each row. Any other failure stops the run, such as a rejected API key, a request that TypeSafe refuses, retries running out, or an error writing to the destination table. When TypeSafe returned a request ID, the error message includes it.
The component checks its properties before it sends any row to TypeSafe. A mistake such as a question name used twice, the wrong number of criteria for a question type, or invalid JSON in a JSON cell fails the run, or the sample, before any request is made.
When a run finishes, the task message gives the number of rows read, answered, failed, and skipped because their key is NULL, the number of input tokens used, and the number of retried requests, if any.
The Sample tab sends up to 10 rows to TypeSafe and shows the answers as they would be written to the destination table. Sampling uses the connection’s API key, and TypeSafe charges for it as it does for a run.