# transform-columns

<mark style="color:purple;">`transform-columns`</mark> *adaptor transforms values in specified columns using an OpenAI language model.*

## Description

## Inputs

**`data`**\
Type: `datatable`\
Required: Yes\
The datatable containing the columns to be transformed.

**`columns`**\
Type: `list`\
Required: Yes\
The list of columns to be transformed.

**`model`**\
Type: `text`\
Required: No\
The name of the language models to run. Consider [price points](https://openai.com/pricing) of each model. If unspecified, defaults to `gpt-3.5-turbo`.

**`system message`**\
Type: `text`\
Required: Yes\
The system message helps set the behavior of the assistant. You can [modify the personality of the assistant](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) or provide specific instructions about how it should behave throughout the conversation.

**`api token`**\
Type: `text`\
Required: Yes\
OpenAI [API token](https://platform.openai.com/account/api-keys)

## Outputs

**`data`**\
Type: `datatable`\
A datatable with the specified columns transformed.

**`summary`**\
Type: `dictionary`\
A summary of the transformed values.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`data:`

| id | code | name           |
| -- | ---- | -------------- |
| 1  | GB   | United Kingdom |
| 2  | TR   | Turkey         |
| 3  | US   | United States  |
| 4  | IND  | India          |
| 5  | IND  | India          |
| 6  | us   | United States  |

`columns:`

1. code

`model:` *null (empty)*

`system message:` You will be provided a country code and your job is to return the country code in lowercase

`api token:` 12345

#### Outputs:

`data`:

| id | code | name           |
| -- | ---- | -------------- |
| 1  | gb   | United Kingdom |
| 2  | tr   | Turkey         |
| 3  | us   | United States  |
| 4  | ind  | India          |
| 5  | ind  | India          |
| 6  | us   | United States  |

-> Transformed the column `code` into lowercase.
