The Promptloop labeling function offers fast, flexible and reliable AI test labeling and categorization based off of a set group of labels. ## Formula Syntax The function takes a text input and matches it to the most semantically similar. For example if you have a group of food menu items [ Hot Sauce, Water Mellon, Carrots] and a target cell [ Spicy ], the function would return Hot Sauce. <Callout title="📝 Syntax"> =PROMPTLOOP_LABEL( **target**, **inputLabels**, **numLabels** ) </Callout> ## Tips and tricks Unlike other PromptLoop functions, the labeling model will only return a match to the set of labels you provide. If the model has two options it will select the closest. Choosing complete and exhaustive labels improves performance. A set of labor or business descriptions for example should be mutually exclusive. Avoid labels that overlap like (Restaurant, French Restaurant). If you want to return multiple labels, or see the top 2-3 labels that match a target text, you can use the optional numLabels parameter and add a number to the end of your function. PROMPTLOOP_LABEL(A10, $B$1:$B$2, **3**). 1. **List the labels or categories you want to sort your data into**, this will depend on the type of data or goal of the analysis. For most cases look to make the options collectively exhaustive (list all possible options as labels) and mutually exclusive (Do not list overlapping categories like human and person unless specifically needed) 2. **Select the target cell** or cells that you want to add a label too as the first parameter ( **target** , inputLabels ) 3. **Select the list of labels** which should be the same for the whole dataset. 4. **Analyze the results** - use a pivot table or =COUNTIF to understand your categories. <Callout emoji="💡" title="Naming labels"> Labeling works off of semantic similarity. So labeling "I like apples" with "fruit" instead of a number or code will perform better. Labels and targets can contain multiple sentences where needed. </Callout> <Image src='/img/content-img/docs/labeling/text_labeling_large.png' alt='Text Labeling' width={600} height={320} /> ## Try it in the Playground <ModelDemo operation="labeling" />

    The Promptloop labeling function offers fast, flexible and reliable AI test labeling and categorization based off of a set group of labels.

    Formula Syntax

    The function takes a text input and matches it to the most semantically similar. For example if you have a group of food menu items [ Hot Sauce, Water Mellon, Carrots] and a target cell [ Spicy ], the function would return Hot Sauce.

    📝 Syntax

    =PROMPTLOOP_LABEL( target, inputLabels, numLabels )

    Tips and tricks

    Unlike other PromptLoop functions, the labeling model will only return a match to the set of labels you provide. If the model has two options it will select the closest.

    Choosing complete and exhaustive labels improves performance. A set of labor or business descriptions for example should be mutually exclusive. Avoid labels that overlap like (Restaurant, French Restaurant).

    If you want to return multiple labels, or see the top 2-3 labels that match a target text, you can use the optional numLabels parameter and add a number to the end of your function. PROMPTLOOP_LABEL(A10, $B$1:$B$2, 3).

    1. List the labels or categories you want to sort your data into, this will depend on the type of data or goal of the analysis. For most cases look to make the options collectively exhaustive (list all possible options as labels) and mutually exclusive (Do not list overlapping categories like human and person unless specifically needed)
    2. Select the target cell or cells that you want to add a label too as the first parameter ( target , inputLabels )
    3. Select the list of labels which should be the same for the whole dataset.
    4. Analyze the results - use a pivot table or =COUNTIF to understand your categories.
    💡
    Naming labels

    Labeling works off of semantic similarity. So labeling "I like apples" with "fruit" instead of a number or code will perform better. Labels and targets can contain multiple sentences where needed.

    Text Labeling

    Try it in the Playground

    Labeling AI

    Match text to a set of labels or text strings

    Labels
    Input