diff --git a/packages/nodes-base/nodes/OpenAi/ChatDescription.ts b/packages/nodes-base/nodes/OpenAi/ChatDescription.ts index 4969f488a1..6bbea27f16 100644 --- a/packages/nodes-base/nodes/OpenAi/ChatDescription.ts +++ b/packages/nodes-base/nodes/OpenAi/ChatDescription.ts @@ -42,6 +42,69 @@ const completeOperations: INodeProperties[] = [ 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. Learn more.', + displayOptions: { + show: { + operation: ['complete'], + resource: ['chat'], + }, + hide: { + '@version': [1], }, }, typeOptions: { diff --git a/packages/nodes-base/nodes/OpenAi/ImageDescription.ts b/packages/nodes-base/nodes/OpenAi/ImageDescription.ts index 19f000d63e..ca26967525 100644 --- a/packages/nodes-base/nodes/OpenAi/ImageDescription.ts +++ b/packages/nodes-base/nodes/OpenAi/ImageDescription.ts @@ -114,6 +114,68 @@ const createOperations: INodeProperties[] = [ 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: { diff --git a/packages/nodes-base/nodes/OpenAi/OpenAi.node.ts b/packages/nodes-base/nodes/OpenAi/OpenAi.node.ts index e34af59259..a0aacffe65 100644 --- a/packages/nodes-base/nodes/OpenAi/OpenAi.node.ts +++ b/packages/nodes-base/nodes/OpenAi/OpenAi.node.ts @@ -9,7 +9,7 @@ export class OpenAi implements INodeType { name: 'openAi', icon: 'file:openAi.svg', group: ['transform'], - version: 1, + version: [1, 1.1], subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Consume Open AI', defaults: { diff --git a/packages/nodes-base/nodes/OpenAi/TextDescription.ts b/packages/nodes-base/nodes/OpenAi/TextDescription.ts index 360deb6366..22d8b6a18c 100644 --- a/packages/nodes-base/nodes/OpenAi/TextDescription.ts +++ b/packages/nodes-base/nodes/OpenAi/TextDescription.ts @@ -88,7 +88,7 @@ const completeOperations: INodeProperties[] = [ { type: 'filter', properties: { - pass: "={{ !$responseItem.id.startsWith('audio-') && !$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') }}", + 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') }}", }, }, { @@ -115,7 +115,7 @@ const completeOperations: INodeProperties[] = [ property: 'model', }, }, - default: 'text-davinci-003', + default: 'gpt-3.5-turbo-instruct', }, { displayName: 'Prompt',