OpenAI Component

Interact with OpenAI models, including Chat GPT and DALL·E
Component key: openai#
DescriptionOpenAI is an artifical intelligence research laboratory that conducts AI research. It has notably produced the chat AI ChatGPT and the image generator DALL·E.
This component wraps some of OpenAI's REST API endpoints. Additional endpoints can be referenced in their API documentation. You can use the Raw Request action to interact with endpoints that are not convered by other actions.
#
OpenAI Connections#
OpenAI API KeyIntegrations can authenticate with OpenAI using API keys. Generate an API key at platform.openai.com/account/api-keys.
If your user is associate with one organization, you can leave the connection's organization field blank. Otherwise, specify your organization's ID.
Input | Notes | Example |
---|---|---|
Input API Key password / Required apiKey | Notes Generate an API key at https://platform.openai.com/account/api-keys | Example |
Input Organization string organization | Notes Your organization ID. If you have just one organization, this value is optional. | Example org-9AeeV8Yj8WK9tW6QEZNHDI8Z |
#
Actions#
Create Chat CompletionCreate a completion for the chat message | key: createChatCompletion
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Messages code / Required messages | Default
| Notes | Example |
Input Model string / Required model | Default gpt-3.5-turbo | Notes | Example text-davinci-003 |
Input Number of choices string numChoices | Default 1 | Notes How many chat completion choices to generate for each input message. | Example |
Input Temperature string temperature | Default 1 | Notes What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | Example |
Input top_p string topP | Default 1 | Notes An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. | Example |
#
Output Example Payload{ "data": { "id": "chatcmpl-6vf993Onyn1Bwq67AYDTR6fIjzvBu", "object": "chat.completion", "created": 1679200883, "model": "gpt-3.5-turbo-0301", "usage": { "prompt_tokens": 56, "completion_tokens": 21, "total_tokens": 77 }, "choices": [ { "message": { "role": "assistant", "content": "The 2020 World Series was played at the Globe Life Field in Arlington, Texas, USA." }, "finish_reason": "stop", "index": 0 } ] }}
#
Create ImageCreate image(s) given a prompt | key: createImage
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Image Size string imageSize | Default 1024x1024 | Notes The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. | Example |
Input Number of Images string / Required numImages | Default 1 | Notes The number of images to generate. Must be between 1 and 10. | Example |
Input Prompt string / Required prompt | Default | Notes A text description of the desired image(s). The maximum length is 1000 characters. | Example A cute baby sea otter |
#
Output Example Payload{ "data": { "created": 1589478378, "data": [ { "url": "https://..." }, { "url": "https://..." } ] }}
#
Get Model by IDGet model by ID | key: getModelById
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Model string / Required model | Notes | Example text-davinci-003 |
#
Output Example Payload{ "data": { "id": "davinci", "object": "model", "created": 1649359874, "owned_by": "openai", "permission": [ { "id": "modelperm-U6ZwlyAd0LyMk4rcMdz33Yc3", "object": "model_permission", "created": 1669066355, "allow_create_engine": false, "allow_sampling": true, "allow_logprobs": true, "allow_search_indices": false, "allow_view": true, "allow_fine_tuning": false, "organization": "*", "group": null, "is_blocking": false } ], "root": "davinci", "parent": null }}
#
List ModelsList all available models | key: listModels
Input | Notes |
---|---|
Input Connection connection / Required connection | Notes |
#
Output Example Payload{ "data": { "object": "list", "data": [ { "id": "davinci", "object": "model", "created": 1649359874, "owned_by": "openai", "permission": [ { "id": "modelperm-U6ZwlyAd0LyMk4rcMdz33Yc3", "object": "model_permission", "created": 1669066355, "allow_create_engine": false, "allow_sampling": true, "allow_logprobs": true, "allow_search_indices": false, "allow_view": true, "allow_fine_tuning": false, "organization": "*", "group": null, "is_blocking": false } ], "root": "davinci", "parent": null } ] }}
#
Raw RequestSend Raw Request to OpenAI | key: rawRequest
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Data string data | Default | Notes The HTTP body payload to send to the URL. | Example {"exampleKey": "Example Data"} |
Input Debug Request boolean debugRequest | Default false | Notes Enabling this flag will log out the current request. | Example |
Input File Data string Key Value List fileData | Default | Notes File Data to be sent as a multipart form upload. | Example [{key: "example.txt", value: "My File Contents"}] |
Input Form Data string Key Value List formData | Default | Notes The Form Data to be sent as a multipart form upload. | Example [{"key": "Example Key", "value": new Buffer("Hello World")}] |
Input Header string Key Value List headers | Default | Notes A list of headers to send with the request. | Example User-Agent: curl/7.64.1 |
Input Max Retry Count string maxRetries | Default 0 | Notes The maximum number of retries to attempt. | Example |
Input Method string / Required method | Default | Notes The HTTP method to use. | Example |
Input Query Parameter string Key Value List queryParams | Default | Notes A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2. | Example |
Input Response Type string / Required responseType | Default json | Notes The type of data you expect in the response. You can request json, text, or binary data. | Example |
Input Retry On All Errors boolean retryAllErrors | Default false | Notes If true, retries on all erroneous responses regardless of type. | Example |
Input Retry Delay (ms) string retryDelayMS | Default 0 | Notes The delay in milliseconds between retries. | Example |
Input Timeout string timeout | Default | Notes The maximum time that a client will await a response to its request | Example 2000 |
Input URL string / Required url | Default /v1/models | Notes This is the URL to call. | Example /v1/images/generations |
Input Use Exponential Backoff boolean useExponentialBackoff | Default false | Notes Specifies whether to use a pre-defined exponential backoff strategy for retries. | Example |