first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,408 @@
import type { INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { sendErrorPostReceive } from './GenericFunctions';
export const chatOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['chat'],
},
},
options: [
{
name: 'Complete',
value: 'complete',
action: 'Create a Completion',
description: 'Create one or more completions for a given text',
routing: {
request: {
method: 'POST',
url: '/v1/chat/completions',
},
output: { postReceive: [sendErrorPostReceive] },
},
},
],
default: 'complete',
},
];
const completeOperations: INodeProperties[] = [
{
displayName: 'Model',
name: 'model',
type: 'options',
description:
'The model which will generate the completion. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
displayOptions: {
show: {
operation: ['complete'],
resource: ['chat'],
'@version': [1],
},
},
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: '/v1/models',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
{
type: 'filter',
properties: {
pass: "={{ $responseItem.id.startsWith('gpt-') && !$responseItem.id.startsWith('gpt-4-vision') }}",
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.id}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
default: 'gpt-3.5-turbo',
},
{
displayName: 'Model',
name: 'chatModel',
type: 'options',
description:
'The model which will generate the completion. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
displayOptions: {
show: {
operation: ['complete'],
resource: ['chat'],
},
hide: {
'@version': [1],
},
},
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: '/v1/models',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
{
type: 'filter',
properties: {
pass: "={{ $responseItem.id.startsWith('gpt-') && !$responseItem.id.startsWith('gpt-4-vision') }}",
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.id}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
default: 'gpt-3.5-turbo',
},
{
displayName: 'Prompt',
name: 'prompt',
type: 'fixedCollection',
typeOptions: {
sortable: true,
multipleValues: true,
},
displayOptions: {
show: {
resource: ['chat'],
operation: ['complete'],
},
},
placeholder: 'Add Message',
default: {},
options: [
{
displayName: 'Messages',
name: 'messages',
values: [
{
displayName: 'Role',
name: 'role',
type: 'options',
options: [
{
name: 'Assistant',
value: 'assistant',
},
{
name: 'System',
value: 'system',
},
{
name: 'User',
value: 'user',
},
],
default: 'user',
},
{
displayName: 'Content',
name: 'content',
type: 'string',
default: '',
},
],
},
],
routing: {
send: {
type: 'body',
property: 'messages',
value: '={{ $value.messages }}',
},
},
},
];
const sharedOperations: INodeProperties[] = [
{
displayName: 'Simplify',
name: 'simplifyOutput',
type: 'boolean',
default: true,
displayOptions: {
show: {
operation: ['complete'],
resource: ['chat'],
},
},
routing: {
output: {
postReceive: [
{
type: 'set',
enabled: '={{$value}}',
properties: {
value: '={{ { "data": $response.body.choices } }}',
},
},
{
type: 'rootProperty',
enabled: '={{$value}}',
properties: {
property: 'data',
},
},
async function (items: INodeExecutionData[]): Promise<INodeExecutionData[]> {
if (this.getNode().parameters.simplifyOutput === false) {
return items;
}
return items.map((item) => {
return {
json: {
...item.json,
message: item.json.message,
},
};
});
},
],
},
},
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Options',
name: 'options',
placeholder: 'Add option',
description: 'Additional options to add',
type: 'collection',
default: {},
displayOptions: {
show: {
operation: ['complete'],
resource: ['chat'],
},
},
options: [
{
displayName: 'Echo Prompt',
name: 'echo',
type: 'boolean',
description: 'Whether the prompt should be echo back in addition to the completion',
default: false,
displayOptions: {
show: {
'/operation': ['complete'],
},
},
routing: {
send: {
type: 'body',
property: 'echo',
},
},
},
{
displayName: 'Frequency Penalty',
name: 'frequency_penalty',
default: 0,
typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
description:
"Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim",
type: 'number',
routing: {
send: {
type: 'body',
property: 'frequency_penalty',
},
},
},
{
displayName: 'Maximum Number of Tokens',
name: 'maxTokens',
default: 16,
description:
'The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 32,768).',
type: 'number',
displayOptions: {
show: {
'/operation': ['complete'],
},
},
typeOptions: {
maxValue: 32768,
},
routing: {
send: {
type: 'body',
property: 'max_tokens',
},
},
},
{
displayName: 'Number of Completions',
name: 'n',
default: 1,
description:
'How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'n',
},
},
},
{
displayName: 'Presence Penalty',
name: 'presence_penalty',
default: 0,
typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
description:
"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics",
type: 'number',
routing: {
send: {
type: 'body',
property: 'presence_penalty',
},
},
},
{
displayName: 'Sampling Temperature',
name: 'temperature',
default: 1,
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
description:
'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'temperature',
},
},
},
{
displayName: 'Top P',
name: 'topP',
default: 1,
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
description:
'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'top_p',
},
},
},
],
},
];
export const chatFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* chat:complete */
/* -------------------------------------------------------------------------- */
...completeOperations,
/* -------------------------------------------------------------------------- */
/* chat:ALL */
/* -------------------------------------------------------------------------- */
...sharedOperations,
];
@@ -0,0 +1,18 @@
import type {
IExecuteSingleFunctions,
IN8nHttpFullResponse,
INodeExecutionData,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function sendErrorPostReceive(
this: IExecuteSingleFunctions,
data: INodeExecutionData[],
response: IN8nHttpFullResponse,
): Promise<INodeExecutionData[]> {
if (String(response.statusCode).startsWith('4') || String(response.statusCode).startsWith('5')) {
throw new NodeApiError(this.getNode(), response as unknown as JsonObject);
}
return data;
}
@@ -0,0 +1,399 @@
import type { INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { sendErrorPostReceive } from './GenericFunctions';
export const imageOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['image'],
},
},
options: [
{
name: 'Create',
value: 'create',
action: 'Create an Image',
description: 'Create an image for a given text',
routing: {
request: {
method: 'POST',
url: '/v1/images/generations',
},
output: { postReceive: [sendErrorPostReceive] },
},
},
],
routing: {
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
],
},
},
default: 'create',
},
];
const createOperations: INodeProperties[] = [
{
displayName: 'Prompt',
name: 'prompt',
type: 'string',
placeholder: 'e.g. A cute cat eating a dinosaur',
description:
'A text description of the desired image(s). The maximum length is 1000 characters.',
displayOptions: {
show: {
resource: ['image'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'prompt',
},
},
},
{
displayName: 'Model',
name: 'model',
type: 'options',
default: 'dall-e-2',
description: 'The model to use for image generation',
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: '/v1/models',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
{
type: 'filter',
properties: {
pass: "={{ $responseItem.id.startsWith('dall-') }}",
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.id}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
displayOptions: {
show: {
resource: ['image'],
operation: ['create'],
'@version': [1],
},
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
},
{
displayName: 'Model',
name: 'imageModel',
type: 'options',
default: 'dall-e-2',
description: 'The model to use for image generation',
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: '/v1/models',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
{
type: 'filter',
properties: {
pass: "={{ $responseItem.id.startsWith('dall-') }}",
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.id}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
displayOptions: {
show: {
resource: ['image'],
operation: ['create'],
},
hide: {
'@version': [1],
},
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
},
{
displayName: 'Response Format',
name: 'responseFormat',
type: 'options',
default: 'binaryData',
description: 'The format in which to return the image(s)',
displayOptions: {
show: {
resource: ['image'],
operation: ['create'],
},
},
options: [
{
name: 'Binary File',
value: 'binaryData',
},
{
name: 'Image Url',
value: 'imageUrl',
},
],
routing: {
send: {
type: 'body',
property: 'response_format',
value: '={{ $value === "imageUrl" ? "url" : "b64_json" }}',
},
output: {
postReceive: [
async function (items: INodeExecutionData[]): Promise<INodeExecutionData[]> {
if (this.getNode().parameters.responseFormat === 'imageUrl') {
return items;
}
const result: INodeExecutionData[] = [];
for (let i = 0; i < items.length; i++) {
result.push({
json: {},
binary: {
data: await this.helpers.prepareBinaryData(
Buffer.from(items[i].json.b64_json as string, 'base64'),
'data',
),
},
} as INodeExecutionData);
}
return result;
},
],
},
},
},
{
displayName: 'Options',
name: 'options',
placeholder: 'Add option',
description: 'Additional options to add',
type: 'collection',
default: {},
displayOptions: {
show: {
resource: ['image'],
operation: ['create'],
},
},
options: [
{
displayName: 'Number of Images',
name: 'n',
default: 1,
description: 'Number of images to generate',
type: 'number',
typeOptions: {
minValue: 1,
maxValue: 10,
},
routing: {
send: {
type: 'body',
property: 'n',
},
},
},
{
displayName: 'Quality',
name: 'quality',
type: 'options',
options: [
{
name: 'HD',
value: 'hd',
},
{
name: 'Standard',
value: 'standard',
},
],
displayOptions: {
show: {
'/model': ['dall-e-3'],
},
},
routing: {
send: {
type: 'body',
property: 'quality',
},
},
default: 'standard',
},
{
displayName: 'Resolution',
name: 'size',
type: 'options',
options: [
{
name: '256x256',
value: '256x256',
},
{
name: '512x512',
value: '512x512',
},
{
name: '1024x1024',
value: '1024x1024',
},
],
displayOptions: {
show: {
'/model': ['dall-e-2'],
},
},
routing: {
send: {
type: 'body',
property: 'size',
},
},
default: '1024x1024',
},
{
displayName: 'Resolution',
name: 'size',
type: 'options',
options: [
{
name: '1024x1024',
value: '1024x1024',
},
{
name: '1792x1024',
value: '1792x1024',
},
{
name: '1024x1792',
value: '1024x1792',
},
],
displayOptions: {
show: {
'/model': ['dall-e-3'],
},
},
routing: {
send: {
type: 'body',
property: 'size',
},
},
default: '1024x1024',
},
{
displayName: 'Style',
name: 'style',
type: 'options',
options: [
{
name: 'Natural',
value: 'natural',
},
{
name: 'Vivid',
value: 'vivid',
},
],
displayOptions: {
show: {
'/model': ['dall-e-3'],
},
},
routing: {
send: {
type: 'body',
property: 'style',
},
},
default: 'vivid',
},
],
},
];
export const imageFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* image:create */
/* -------------------------------------------------------------------------- */
...createOperations,
];
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.openAi",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Utility"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/openai/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/"
}
]
},
"alias": ["ChatGPT", "DallE"]
}
@@ -0,0 +1,81 @@
import type { INodeType, INodeTypeDescription } from 'n8n-workflow';
import { NodeConnectionTypes } from 'n8n-workflow';
import { chatFields, chatOperations } from './ChatDescription';
import { imageFields, imageOperations } from './ImageDescription';
import { textFields, textOperations } from './TextDescription';
import { oldVersionNotice } from '../../utils/descriptions';
export class OpenAi implements INodeType {
description: INodeTypeDescription = {
displayName: 'OpenAI',
name: 'openAi',
hidden: true,
icon: { light: 'file:openAi.svg', dark: 'file:openAi.dark.svg' },
group: ['transform'],
version: [1, 1.1],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume Open AI',
defaults: {
name: 'OpenAI',
},
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
builderHint: {
relatedNodes: [
{
nodeType: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
relationHint: 'For most LLM tasks, text generation, reasoning, use Agent with this model',
},
{
nodeType: '@n8n/n8n-nodes-langchain.agent',
relationHint: 'For most LLM tasks, text generation, reasoning, tool calls, etc.',
},
],
},
credentials: [
{
name: 'openAiApi',
required: true,
},
],
requestDefaults: {
ignoreHttpStatusErrors: true,
baseURL:
'={{ $credentials.url?.split("/").slice(0,-1).join("/") ?? "https://api.openai.com" }}',
},
properties: [
oldVersionNotice,
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Chat',
value: 'chat',
},
{
name: 'Image',
value: 'image',
},
{
name: 'Text',
value: 'text',
},
],
default: 'text',
},
...chatOperations,
...chatFields,
...imageOperations,
...imageFields,
...textOperations,
...textFields,
],
};
}
@@ -0,0 +1,506 @@
import type { INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { sendErrorPostReceive } from './GenericFunctions';
export const textOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['text'],
},
},
options: [
{
name: 'Complete',
value: 'complete',
action: 'Create a Completion',
description: 'Create one or more completions for a given text',
routing: {
request: {
method: 'POST',
url: '/v1/completions',
},
output: { postReceive: [sendErrorPostReceive] },
},
},
{
name: 'Edit',
value: 'edit',
action: 'Create an Edit',
description: 'Create an edited version for a given text',
routing: {
request: {
method: 'POST',
url: '/v1/edits',
},
output: { postReceive: [sendErrorPostReceive] },
},
},
{
name: 'Moderate',
value: 'moderate',
action: 'Create a Moderation',
description: "Classify if a text violates OpenAI's content policy",
routing: {
request: {
method: 'POST',
url: '/v1/moderations',
},
output: { postReceive: [sendErrorPostReceive] },
},
},
],
default: 'complete',
},
];
const completeOperations: INodeProperties[] = [
{
displayName: 'Model',
name: 'model',
type: 'options',
description:
'The model which will generate the completion. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
displayOptions: {
show: {
operation: ['complete'],
resource: ['text'],
},
},
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: '/v1/models',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'data',
},
},
{
type: 'filter',
properties: {
pass: "={{ !$responseItem.id.startsWith('audio-') && ($responseItem.id === 'gpt-3.5-turbo-instruct' || !$responseItem.id.startsWith('gpt-') ) && !$responseItem.id.startsWith('dall-') && !$responseItem.id.startsWith('tts-') && !$responseItem.id.startsWith('whisper-') && !['cushman:2020-05-03', 'davinci-if:3.0.0', 'davinci-instruct-beta:2.0.0', 'if'].includes($responseItem.id) && !$responseItem.id.includes('-edit-') && !$responseItem.id.endsWith(':001') }}",
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.id}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
default: 'gpt-3.5-turbo-instruct',
},
{
displayName: 'Prompt',
name: 'prompt',
type: 'string',
description: 'The prompt to generate completion(s) for',
placeholder: 'e.g. Say this is a test',
displayOptions: {
show: {
resource: ['text'],
operation: ['complete'],
},
},
default: '',
typeOptions: {
rows: 2,
},
routing: {
send: {
type: 'body',
property: 'prompt',
},
},
},
];
const editOperations: INodeProperties[] = [
{
displayName: 'Model',
name: 'model',
type: 'options',
description:
'The model which will generate the edited version. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
displayOptions: {
show: {
operation: ['edit'],
resource: ['text'],
},
},
options: [
{
name: 'code-davinci-edit-001',
value: 'code-davinci-edit-001',
},
{
name: 'text-davinci-edit-001',
value: 'text-davinci-edit-001',
},
],
routing: {
send: {
type: 'body',
property: 'model',
},
},
default: 'text-davinci-edit-001',
},
{
displayName: 'Input',
name: 'input',
type: 'string',
placeholder: 'e.g. What day of the wek is it?',
description: 'The input text to be edited',
displayOptions: {
show: {
resource: ['text'],
operation: ['edit'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'input',
},
},
},
{
displayName: 'Instruction',
name: 'instruction',
type: 'string',
placeholder: 'e.g. Fix the spelling mistakes',
description: 'The instruction that tells the model how to edit the input text',
displayOptions: {
show: {
resource: ['text'],
operation: ['edit'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'instruction',
},
},
},
];
const moderateOperations: INodeProperties[] = [
{
displayName: 'Model',
name: 'model',
type: 'options',
description:
'The model which will classify the text. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
displayOptions: {
show: {
resource: ['text'],
operation: ['moderate'],
},
},
options: [
{
name: 'text-moderation-stable',
value: 'text-moderation-stable',
},
{
name: 'text-moderation-latest',
value: 'text-moderation-latest',
},
],
routing: {
send: {
type: 'body',
property: 'model',
},
},
default: 'text-moderation-latest',
},
{
displayName: 'Input',
name: 'input',
type: 'string',
placeholder: 'e.g. My cat is adorable ❤️❤️',
description: 'The input text to classify',
displayOptions: {
show: {
resource: ['text'],
operation: ['moderate'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'input',
},
},
},
{
displayName: 'Simplify',
name: 'simplifyOutput',
type: 'boolean',
default: true,
displayOptions: {
show: {
operation: ['moderate'],
resource: ['text'],
},
},
routing: {
output: {
postReceive: [
{
type: 'set',
enabled: '={{$value}}',
properties: {
value: '={{ { "data": $response.body.results } }}',
},
},
{
type: 'rootProperty',
enabled: '={{$value}}',
properties: {
property: 'data',
},
},
],
},
},
description: 'Whether to return a simplified version of the response instead of the raw data',
},
];
const sharedOperations: INodeProperties[] = [
{
displayName: 'Simplify',
name: 'simplifyOutput',
type: 'boolean',
default: true,
displayOptions: {
show: {
operation: ['complete', 'edit'],
resource: ['text'],
},
},
routing: {
output: {
postReceive: [
{
type: 'set',
enabled: '={{$value}}',
properties: {
value: '={{ { "data": $response.body.choices } }}',
},
},
{
type: 'rootProperty',
enabled: '={{$value}}',
properties: {
property: 'data',
},
},
async function (items: INodeExecutionData[]): Promise<INodeExecutionData[]> {
if (this.getNode().parameters.simplifyOutput === false) {
return items;
}
return items.map((item) => {
return {
json: {
...item.json,
text: (item.json.text as string).trim(),
},
};
});
},
],
},
},
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Options',
name: 'options',
placeholder: 'Add option',
description: 'Additional options to add',
type: 'collection',
default: {},
displayOptions: {
show: {
operation: ['complete', 'edit'],
resource: ['text'],
},
},
options: [
{
displayName: 'Echo Prompt',
name: 'echo',
type: 'boolean',
description: 'Whether the prompt should be echo back in addition to the completion',
default: false,
displayOptions: {
show: {
'/operation': ['complete'],
},
},
routing: {
send: {
type: 'body',
property: 'echo',
},
},
},
{
displayName: 'Frequency Penalty',
name: 'frequency_penalty',
default: 0,
typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
description:
"Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim",
type: 'number',
routing: {
send: {
type: 'body',
property: 'frequency_penalty',
},
},
},
{
displayName: 'Maximum Number of Tokens',
name: 'maxTokens',
default: 16,
description:
'The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 32,768).',
type: 'number',
displayOptions: {
show: {
'/operation': ['complete'],
},
},
typeOptions: {
maxValue: 32768,
},
routing: {
send: {
type: 'body',
property: 'max_tokens',
},
},
},
{
displayName: 'Number of Completions',
name: 'n',
default: 1,
description:
'How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'n',
},
},
},
{
displayName: 'Presence Penalty',
name: 'presence_penalty',
default: 0,
typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
description:
"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics",
type: 'number',
routing: {
send: {
type: 'body',
property: 'presence_penalty',
},
},
},
{
displayName: 'Sampling Temperature',
name: 'temperature',
default: 1,
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
description:
'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'temperature',
},
},
},
{
displayName: 'Top P',
name: 'topP',
default: 1,
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
description:
'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.',
type: 'number',
routing: {
send: {
type: 'body',
property: 'top_p',
},
},
},
],
},
];
export const textFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* text:complete */
/* -------------------------------------------------------------------------- */
...completeOperations,
/* -------------------------------------------------------------------------- */
/* text:edit */
/* -------------------------------------------------------------------------- */
...editOperations,
/* -------------------------------------------------------------------------- */
/* text:moderate */
/* -------------------------------------------------------------------------- */
...moderateOperations,
/* -------------------------------------------------------------------------- */
/* text:ALL */
/* -------------------------------------------------------------------------- */
...sharedOperations,
];
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,57 @@
{
"type": "object",
"properties": {
"finish_reason": {
"type": "string"
},
"index": {
"type": "integer"
},
"logprobs": {
"type": "null"
},
"message": {
"type": "object",
"properties": {
"annotations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"url_citation": {
"type": "object",
"properties": {
"end_index": {
"type": "integer"
},
"start_index": {
"type": "integer"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
}
}
},
"content": {
"type": "string"
},
"refusal": {
"type": "null"
},
"role": {
"type": "string"
}
}
}
},
"version": 5
}
@@ -0,0 +1,9 @@
{
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,15 @@
{
"type": "object",
"properties": {
"finish_reason": {
"type": "string"
},
"index": {
"type": "integer"
},
"text": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,3 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M36.8671 16.3718C37.7746 13.648 37.4621 10.6642 36.0108 8.18661C33.8282 4.38653 29.4407 2.43149 25.1556 3.35151C23.2493 1.20396 20.5105 -0.0173148 17.6392 0.000185533C13.2591 -0.00981468 9.37273 2.81025 8.0252 6.97783C5.21139 7.5541 2.78258 9.31538 1.3613 11.8117C-0.837493 15.6018 -0.336232 20.3794 2.60133 23.6294C1.69381 26.3532 2.00632 29.3371 3.4576 31.8146C5.64015 35.6147 10.0277 37.5697 14.3128 36.6497C16.2179 38.7973 18.9579 40.0185 21.8292 39.9998C26.2118 40.011 30.0994 37.1885 31.4469 33.0171C34.2608 32.4409 36.6896 30.6796 38.1108 28.1833C40.3071 24.3932 39.8046 19.6194 36.8683 16.3693L36.8671 16.3718ZM21.8317 37.386C20.078 37.3885 18.3792 36.7747 17.0329 35.6509C17.0941 35.6184 17.2004 35.5597 17.2691 35.5172L25.2343 30.9171C25.6418 30.6858 25.8918 30.2521 25.8893 29.7833V18.5543L29.2557 20.4981C29.2919 20.5156 29.3157 20.5506 29.3207 20.5906V29.8896C29.3157 34.0247 25.9668 37.3772 21.8317 37.386ZM5.7264 30.5071C4.84763 28.9896 4.53137 27.2108 4.83263 25.4845C4.89138 25.5195 4.99513 25.5832 5.06888 25.6257L13.0341 30.2258C13.4378 30.4621 13.9378 30.4621 14.3428 30.2258L24.0668 24.6107V28.4983C24.0693 28.5383 24.0505 28.577 24.0193 28.602L15.9679 33.2509C12.3815 35.3159 7.80144 34.0884 5.72765 30.5071H5.7264ZM3.6301 13.1205C4.50512 11.6004 5.8864 10.4379 7.53144 9.83415C7.53144 9.9029 7.52769 10.0242 7.52769 10.1092V19.3106C7.52519 19.7781 7.77519 20.2119 8.18145 20.4431L17.9054 26.057L14.5391 28.0008C14.5053 28.0233 14.4628 28.027 14.4253 28.0108L6.37266 23.3582C2.79383 21.2856 1.56631 16.7068 3.62885 13.1217L3.6301 13.1205ZM31.2882 19.5569L21.5642 13.9417L24.9306 11.9992C24.9643 11.9767 25.0068 11.9729 25.0443 11.9892L33.097 16.638C36.6821 18.7093 37.9108 23.2957 35.8395 26.8808C34.9633 28.3983 33.5832 29.5608 31.9395 30.1658V20.6894C31.9432 20.2219 31.6945 19.7894 31.2894 19.5569H31.2882ZM34.6383 14.5142C34.5795 14.478 34.4758 14.4155 34.402 14.373L26.4368 9.77289C26.0331 9.53664 25.5331 9.53664 25.1281 9.77289L15.4041 15.388V11.5004C15.4016 11.4604 15.4204 11.4217 15.4516 11.3967L23.503 6.75158C27.0894 4.68279 31.6745 5.91406 33.742 9.50164C34.6158 11.0167 34.932 12.7905 34.6358 14.5142H34.6383ZM13.5741 21.4431L10.2065 19.4994C10.1702 19.4819 10.1465 19.4468 10.1415 19.4068V10.1079C10.144 5.96781 13.5028 2.61274 17.6429 2.61524C19.3942 2.61524 21.0892 3.23025 22.4355 4.35028C22.3743 4.38278 22.2693 4.44153 22.1992 4.48403L14.2341 9.08413C13.8266 9.31538 13.5766 9.74789 13.5791 10.2167L13.5741 21.4406V21.4431ZM15.4029 17.5006L19.7342 14.9993L24.0655 17.4993V22.5007L19.7342 25.0007L15.4029 22.5007V17.5006Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="260" preserveAspectRatio="xMidYMid"><path d="M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218-28.188-16.218z"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB