# Inference

The PromptLoop inference function takes a set of examples and generates the correct text output with AI models in Google Sheets.

## Formula Syntax

The parameters, (inputs, outputs, target cell etc.) work just like any other spreadsheet formula. You can think of PromptLoop like a LOOKUP formula - but instead of matching rows it infers the relationship in your input/output table and returns the result.

This simple formula takes a set or column of **Inputs** and a set or column of **Outputs** and returns the output for an new input or **Target**.

=PROMPTLOOP( **inputRange**, **outputRange**, **target**)

**InputArray**is the set of**3-10 rows**of inputs for the example data. The inputs must match the outputs in length and should be fixed for each task. This tells the model what you are looking for. Examples should be representative.**OutputArray**is the set of**3-10 rows**matching outputs for the example data. The outputs must match the inputs in length and should be fixed for each task. This tells the model what you outputs you are looking for.**Target**is the input for the model to perform its calculation on. This is always a single cell but you can copy or drag a formula with set input/output Arrays across hundreds of targets to leverage the same function and output task.

### Including Headers

If you have multiple columns if input information and want to include headers to give the model more context, you can select the header row and add (1) to the end of your function call

=PROMPTLOOP( **inputRange**, **outputRange**, **target**, [**headers?**])

=PROMPTLOOP($A$1:$D$11,$E$2:$E$11,A12:D12, **1**)
Notice the inputs have an extra row - only include headers for the input range

This is optional an not needed for single-column inputs in most cases.

## How it works

The Inference function learns what the correct output is based on the examples you provide. This allows for a huge range of text transformation, translation, and comprehension like writing or sumamries.

The function uses language models and is therefore geared at text, instead of numbers and quantitative actions where normal spreadsheet formulas do well SUM, AVERAGE, etc.

## Tips and tricks

Select example rows + Select target cell. The examples give the model instructions so the better the examples the more accurate the model outputs will be.

The target is the cell text you want to send to the model.

Set absolute reference like:

```
$A$10:$A$11,$B$10:$B$11
```

You can use the key F4 to do this quickly.

You can get started with the formula by using this Template **here** and also find more **templates** and **use cases** from current customers.

If you are interested in learning more or have questions about how your team can benefit, get in touch **here**!

You must activate **PromptLoop** in any sheet you want to use the formula in. Navigate to the Add-on menu and click "Activate" to do so.
More on enabling PromptLoop

## Error Messages:

This error message indicates that the inputs and/or output examples are not correctly formatted. For Promptloop to work - you must provide pairs of inputs and outputs, usually on the same row, as examples. You can include multiple columns combined as one input or output row, but they may not contain undefined values, blank cells, or #ERRORS!.

This message occurs when the Google Account being used is not linked to an active Promptloop account. It also may indicate that payment method is needed, even if free credits still remain on the account.

This error message indicates that PromptLoop is not Activated in this sheet - Navigate to the Add-on menu and activate or Re-activate to proceed. You may have to reload the sheet and delete / re-enter the formula if this persists.

## Try it with the Playground

## Inference AI

Provide a set of input and output examples for the model

## Need Help?

Reach out to [email protected] and we will be happy to guide you through detailed set up and get started with a few examples so you can start using prompt loop for your specific needs. Or just say hello!