> For the complete documentation index, see [llms.txt](https://cgps.gitbook.io/data-flo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cgps.gitbook.io/data-flo/reference-guide/run-openai-model.md).

# run-openai-model

## Description

The <mark style="color:purple;">`run-openai-model`</mark> adaptor uses [OpenAI Chat Completions](https://platform.openai.com/docs/guides/text-generation) to create a model response for a given chat message.

Note that this adaptor can be used to create a single response for one chat message only. If you would like to create a response for each value in a datatable column, use the [<mark style="color:purple;">`transform-columns`</mark>](/data-flo/reference-guide/transform-columns.md) adaptor. If the values are in a list, you can use the [<mark style="color:purple;">`convert-list-to-datatable`</mark>](/data-flo/reference-guide/convert-list-to-datatable.md) adaptor to convert the list to a datatable before running the model.

## Inputs

**`model`**\
Type: `text`\
Required: No\
The name of the language models to run. Consider the [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 (e.g., `You are a helpful 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.&#x20;

**`user message`**\
Type: `text`\
Required: Yes\
The input of the model to run.

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

## Outputs

**`assistant message`**\
Type: `text`\
The model prediction.

**`duration`**\
Type: `text`\
The duration of the model run.

## Examples

### Example 1: Find the capital of a country.

#### Inputs:

`model`: gpt-3.5-turbo

`system message`: You will be provided with a country name and your task is to return the name of its national capital.

`user message`: United Kingdom

`api token`: sk-\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* (visit [API Keys](https://platform.openai.com/account/api-keys) page to retrieve the API key)

#### Outputs:

`assistant message`: London

`duration`: 1019
