@n8n/n8n-nodes-langchain 1.115.1 → 1.116.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/AnthropicApi.credentials.js +39 -8
- package/dist/credentials/AnthropicApi.credentials.js.map +1 -1
- package/dist/credentials/LemonadeApi.credentials.js +70 -0
- package/dist/credentials/LemonadeApi.credentials.js.map +1 -0
- package/dist/known/credentials.json +9 -0
- package/dist/known/nodes.json +12 -0
- package/dist/nodes/agents/Agent/Agent.node.js +1 -2
- package/dist/nodes/agents/Agent/Agent.node.js.map +1 -1
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js +2 -0
- package/dist/nodes/agents/Agent/V1/AgentV1.node.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js +13 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js +49 -30
- package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/execute.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js +3 -0
- package/dist/nodes/chains/ChainLLM/methods/chainExecutor.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js +87 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/EmbeddingsLemonade.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsLemonade/lemonade.svg +53 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +17 -0
- package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js +12 -8
- package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +106 -0
- package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMChatLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js +6 -5
- package/dist/nodes/llms/LMChatOpenAi/methods/loadModels.js.map +1 -1
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js +107 -0
- package/dist/nodes/llms/LMLemonade/LmLemonade.node.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/description.js +147 -0
- package/dist/nodes/llms/LMLemonade/description.js.map +1 -0
- package/dist/nodes/llms/LMLemonade/lemonade.svg +53 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +3 -0
- package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +14 -1
- package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js +107 -47
- package/dist/nodes/mcp/McpClientTool/McpClientTool.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js +2 -1
- package/dist/nodes/tools/ToolWorkflow/v2/utils/WorkflowToolService.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js +43 -4
- package/dist/nodes/vector_store/VectorStoreQdrant/VectorStoreQdrant.node.js.map +1 -1
- package/dist/nodes/vendors/Anthropic/transport/index.js +9 -5
- package/dist/nodes/vendors/Anthropic/transport/index.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js +50 -11
- package/dist/nodes/vendors/OpenAi/OpenAi.node.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js +3 -3
- package/dist/nodes/vendors/OpenAi/helpers/binary-data.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/description.js +75 -0
- package/dist/nodes/vendors/OpenAi/helpers/description.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/interfaces.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js +34 -0
- package/dist/nodes/vendors/OpenAi/helpers/modelFiltering.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js +52 -0
- package/dist/nodes/vendors/OpenAi/helpers/polling.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js +27 -0
- package/dist/nodes/vendors/OpenAi/helpers/utils.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js +10 -6
- package/dist/nodes/vendors/OpenAi/methods/listSearch.js.map +1 -1
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js +110 -0
- package/dist/nodes/vendors/OpenAi/v1/OpenAiV1.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/create.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/deleteAssistant.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/deleteAssistant.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/message.operation.js +5 -5
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/update.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/transcribe.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/translate.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/deleteFile.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/list.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/upload.operation.js +2 -2
- package/dist/nodes/vendors/OpenAi/v1/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/analyze.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/generate.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/router.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/classify.operation.js +1 -1
- package/dist/nodes/vendors/OpenAi/v1/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v1/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/message.operation.js +4 -4
- package/dist/nodes/vendors/OpenAi/v1/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js +116 -0
- package/dist/nodes/vendors/OpenAi/v2/OpenAiV2.node.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js +197 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js +96 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js +121 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/transcribe.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/audio/translate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js +120 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/create.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/get.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js +94 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js +60 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/remove.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js +75 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/conversation/update.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js +279 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/descriptions.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/deleteFile.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js +92 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/list.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js +130 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js +211 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/analyze.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js +464 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/edit.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js +319 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js +84 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js +17 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js +111 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/router.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js +102 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/classify.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js +277 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/helpers/responses.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js +75 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js +774 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/text/response.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js +199 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js +64 -0
- package/dist/nodes/vendors/OpenAi/v2/actions/video/index.js.map +1 -0
- package/dist/types/credentials.json +2 -1
- package/dist/types/nodes.json +10 -6
- package/dist/utils/helpers.js +22 -2
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +14 -10
- package/dist/nodes/vendors/OpenAi/actions/assistant/create.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/deleteAssistant.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/assistant/update.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/transcribe.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/audio/translate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/descriptions.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/deleteFile.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/list.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/file/upload.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/analyze.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/generate.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/image/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/node.type.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/router.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/classify.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/index.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/text/message.operation.js.map +0 -1
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js +0 -160
- package/dist/nodes/vendors/OpenAi/actions/versionDescription.js.map +0 -1
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/assistant/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/audio/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/descriptions.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/file/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/image/index.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/node.type.js +0 -0
- /package/dist/nodes/vendors/OpenAi/{actions → v1/actions}/text/index.js +0 -0
|
@@ -33,12 +33,16 @@ async function apiRequest(method, endpoint, parameters) {
|
|
|
33
33
|
if (parameters?.enableAnthropicBetas?.codeExecution) {
|
|
34
34
|
betas.push("code-execution-2025-05-22");
|
|
35
35
|
}
|
|
36
|
+
const requestHeaders = {
|
|
37
|
+
"anthropic-version": "2023-06-01",
|
|
38
|
+
"anthropic-beta": betas.join(","),
|
|
39
|
+
...headers
|
|
40
|
+
};
|
|
41
|
+
if (credentials.header && typeof credentials.headerName === "string" && credentials.headerName && typeof credentials.headerValue === "string") {
|
|
42
|
+
requestHeaders[credentials.headerName] = credentials.headerValue;
|
|
43
|
+
}
|
|
36
44
|
const options = {
|
|
37
|
-
headers:
|
|
38
|
-
"anthropic-version": "2023-06-01",
|
|
39
|
-
"anthropic-beta": betas.join(","),
|
|
40
|
-
...headers
|
|
41
|
-
},
|
|
45
|
+
headers: requestHeaders,
|
|
42
46
|
method,
|
|
43
47
|
body,
|
|
44
48
|
qs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/transport/index.ts"],"sourcesContent":["import type FormData from 'form-data';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tIHttpRequestMethods,\n\tILoadOptionsFunctions,\n} from 'n8n-workflow';\n\ntype RequestParameters = {\n\theaders?: IDataObject;\n\tbody?: IDataObject | string | FormData;\n\tqs?: IDataObject;\n\toption?: IDataObject;\n\tenableAnthropicBetas?: {\n\t\tpromptTools?: boolean;\n\t\tcodeExecution?: boolean;\n\t};\n};\n\nexport async function apiRequest(\n\tthis: IExecuteFunctions | ILoadOptionsFunctions,\n\tmethod: IHttpRequestMethods,\n\tendpoint: string,\n\tparameters?: RequestParameters,\n) {\n\tconst { body, qs, option, headers } = parameters ?? {};\n\n\tconst credentials = await this.getCredentials('anthropicApi');\n\tconst baseUrl = credentials.url ?? 'https://api.anthropic.com';\n\tconst url = `${baseUrl}${endpoint}`;\n\n\tconst betas = ['files-api-2025-04-14'];\n\tif (parameters?.enableAnthropicBetas?.promptTools) {\n\t\tbetas.push('prompt-tools-2025-04-02');\n\t}\n\n\tif (parameters?.enableAnthropicBetas?.codeExecution) {\n\t\tbetas.push('code-execution-2025-05-22');\n\t}\n\n\tconst
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/Anthropic/transport/index.ts"],"sourcesContent":["import type FormData from 'form-data';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tIHttpRequestMethods,\n\tILoadOptionsFunctions,\n} from 'n8n-workflow';\n\ntype RequestParameters = {\n\theaders?: IDataObject;\n\tbody?: IDataObject | string | FormData;\n\tqs?: IDataObject;\n\toption?: IDataObject;\n\tenableAnthropicBetas?: {\n\t\tpromptTools?: boolean;\n\t\tcodeExecution?: boolean;\n\t};\n};\n\nexport async function apiRequest(\n\tthis: IExecuteFunctions | ILoadOptionsFunctions,\n\tmethod: IHttpRequestMethods,\n\tendpoint: string,\n\tparameters?: RequestParameters,\n) {\n\tconst { body, qs, option, headers } = parameters ?? {};\n\n\tconst credentials = await this.getCredentials('anthropicApi');\n\tconst baseUrl = credentials.url ?? 'https://api.anthropic.com';\n\tconst url = `${baseUrl}${endpoint}`;\n\n\tconst betas = ['files-api-2025-04-14'];\n\tif (parameters?.enableAnthropicBetas?.promptTools) {\n\t\tbetas.push('prompt-tools-2025-04-02');\n\t}\n\n\tif (parameters?.enableAnthropicBetas?.codeExecution) {\n\t\tbetas.push('code-execution-2025-05-22');\n\t}\n\n\tconst requestHeaders: IDataObject = {\n\t\t'anthropic-version': '2023-06-01',\n\t\t'anthropic-beta': betas.join(','),\n\t\t...headers,\n\t};\n\n\tif (\n\t\tcredentials.header &&\n\t\ttypeof credentials.headerName === 'string' &&\n\t\tcredentials.headerName &&\n\t\ttypeof credentials.headerValue === 'string'\n\t) {\n\t\trequestHeaders[credentials.headerName] = credentials.headerValue;\n\t}\n\n\tconst options = {\n\t\theaders: requestHeaders,\n\t\tmethod,\n\t\tbody,\n\t\tqs,\n\t\turl,\n\t\tjson: true,\n\t};\n\n\tif (option && Object.keys(option).length !== 0) {\n\t\tObject.assign(options, option);\n\t}\n\n\treturn await this.helpers.httpRequestWithAuthentication.call(this, 'anthropicApi', options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,eAAsB,WAErB,QACA,UACA,YACC;AACD,QAAM,EAAE,MAAM,IAAI,QAAQ,QAAQ,IAAI,cAAc,CAAC;AAErD,QAAM,cAAc,MAAM,KAAK,eAAe,cAAc;AAC5D,QAAM,UAAU,YAAY,OAAO;AACnC,QAAM,MAAM,GAAG,OAAO,GAAG,QAAQ;AAEjC,QAAM,QAAQ,CAAC,sBAAsB;AACrC,MAAI,YAAY,sBAAsB,aAAa;AAClD,UAAM,KAAK,yBAAyB;AAAA,EACrC;AAEA,MAAI,YAAY,sBAAsB,eAAe;AACpD,UAAM,KAAK,2BAA2B;AAAA,EACvC;AAEA,QAAM,iBAA8B;AAAA,IACnC,qBAAqB;AAAA,IACrB,kBAAkB,MAAM,KAAK,GAAG;AAAA,IAChC,GAAG;AAAA,EACJ;AAEA,MACC,YAAY,UACZ,OAAO,YAAY,eAAe,YAClC,YAAY,cACZ,OAAO,YAAY,gBAAgB,UAClC;AACD,mBAAe,YAAY,UAAU,IAAI,YAAY;AAAA,EACtD;AAEA,QAAM,UAAU;AAAA,IACf,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACP;AAEA,MAAI,UAAU,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAC/C,WAAO,OAAO,SAAS,MAAM;AAAA,EAC9B;AAEA,SAAO,MAAM,KAAK,QAAQ,8BAA8B,KAAK,MAAM,gBAAgB,OAAO;AAC3F;","names":[]}
|
|
@@ -21,19 +21,58 @@ __export(OpenAi_node_exports, {
|
|
|
21
21
|
OpenAi: () => OpenAi
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(OpenAi_node_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
24
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
25
|
+
var import_description = require("./helpers/description");
|
|
26
|
+
var import_OpenAiV1 = require("./v1/OpenAiV1.node");
|
|
27
|
+
var import_OpenAiV2 = require("./v2/OpenAiV2.node");
|
|
28
|
+
class OpenAi extends import_n8n_workflow.VersionedNodeType {
|
|
28
29
|
constructor() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const baseDescription = {
|
|
31
|
+
displayName: "OpenAI",
|
|
32
|
+
name: "openAi",
|
|
33
|
+
icon: { light: "file:openAi.svg", dark: "file:openAi.dark.svg" },
|
|
34
|
+
group: ["transform"],
|
|
35
|
+
defaultVersion: 2,
|
|
36
|
+
subtitle: `={{(${import_description.prettifyOperation})($parameter.resource, $parameter.operation)}}`,
|
|
37
|
+
description: "Message an assistant or GPT, analyze images, generate audio, etc.",
|
|
38
|
+
codex: {
|
|
39
|
+
alias: [
|
|
40
|
+
"LangChain",
|
|
41
|
+
"ChatGPT",
|
|
42
|
+
"Sora",
|
|
43
|
+
"DallE",
|
|
44
|
+
"whisper",
|
|
45
|
+
"audio",
|
|
46
|
+
"transcribe",
|
|
47
|
+
"tts",
|
|
48
|
+
"assistant"
|
|
49
|
+
],
|
|
50
|
+
categories: ["AI"],
|
|
51
|
+
subcategories: {
|
|
52
|
+
AI: ["Agents", "Miscellaneous", "Root Nodes"]
|
|
53
|
+
},
|
|
54
|
+
resources: {
|
|
55
|
+
primaryDocumentation: [
|
|
56
|
+
{
|
|
57
|
+
url: "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
33
62
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
63
|
+
const nodeVersions = {
|
|
64
|
+
1: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
65
|
+
1.1: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
66
|
+
1.2: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
67
|
+
1.3: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
68
|
+
1.4: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
69
|
+
1.5: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
70
|
+
1.6: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
71
|
+
1.7: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
72
|
+
1.8: new import_OpenAiV1.OpenAiV1(baseDescription),
|
|
73
|
+
2: new import_OpenAiV2.OpenAiV2(baseDescription)
|
|
74
|
+
};
|
|
75
|
+
super(nodeVersions, baseDescription);
|
|
37
76
|
}
|
|
38
77
|
}
|
|
39
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/vendors/OpenAi/OpenAi.node.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/vendors/OpenAi/OpenAi.node.ts"],"sourcesContent":["import {\n\ttype IVersionedNodeType,\n\tVersionedNodeType,\n\ttype INodeTypeBaseDescription,\n} from 'n8n-workflow';\n\nimport { prettifyOperation } from './helpers/description';\nimport { OpenAiV1 } from './v1/OpenAiV1.node';\nimport { OpenAiV2 } from './v2/OpenAiV2.node';\n\nexport class OpenAi extends VersionedNodeType {\n\tconstructor() {\n\t\tconst baseDescription: INodeTypeBaseDescription = {\n\t\t\tdisplayName: 'OpenAI',\n\t\t\tname: 'openAi',\n\t\t\ticon: { light: 'file:openAi.svg', dark: 'file:openAi.dark.svg' },\n\t\t\tgroup: ['transform'],\n\t\t\tdefaultVersion: 2,\n\t\t\tsubtitle: `={{(${prettifyOperation})($parameter.resource, $parameter.operation)}}`,\n\t\t\tdescription: 'Message an assistant or GPT, analyze images, generate audio, etc.',\n\t\t\tcodex: {\n\t\t\t\talias: [\n\t\t\t\t\t'LangChain',\n\t\t\t\t\t'ChatGPT',\n\t\t\t\t\t'Sora',\n\t\t\t\t\t'DallE',\n\t\t\t\t\t'whisper',\n\t\t\t\t\t'audio',\n\t\t\t\t\t'transcribe',\n\t\t\t\t\t'tts',\n\t\t\t\t\t'assistant',\n\t\t\t\t],\n\t\t\t\tcategories: ['AI'],\n\t\t\t\tsubcategories: {\n\t\t\t\t\tAI: ['Agents', 'Miscellaneous', 'Root Nodes'],\n\t\t\t\t},\n\t\t\t\tresources: {\n\t\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst nodeVersions: IVersionedNodeType['nodeVersions'] = {\n\t\t\t1: new OpenAiV1(baseDescription),\n\t\t\t1.1: new OpenAiV1(baseDescription),\n\t\t\t1.2: new OpenAiV1(baseDescription),\n\t\t\t1.3: new OpenAiV1(baseDescription),\n\t\t\t1.4: new OpenAiV1(baseDescription),\n\t\t\t1.5: new OpenAiV1(baseDescription),\n\t\t\t1.6: new OpenAiV1(baseDescription),\n\t\t\t1.7: new OpenAiV1(baseDescription),\n\t\t\t1.8: new OpenAiV1(baseDescription),\n\t\t\t2: new OpenAiV2(baseDescription),\n\t\t};\n\n\t\tsuper(nodeVersions, baseDescription);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAIO;AAEP,yBAAkC;AAClC,sBAAyB;AACzB,sBAAyB;AAElB,MAAM,eAAe,sCAAkB;AAAA,EAC7C,cAAc;AACb,UAAM,kBAA4C;AAAA,MACjD,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM,EAAE,OAAO,mBAAmB,MAAM,uBAAuB;AAAA,MAC/D,OAAO,CAAC,WAAW;AAAA,MACnB,gBAAgB;AAAA,MAChB,UAAU,OAAO,oCAAiB;AAAA,MAClC,aAAa;AAAA,MACb,OAAO;AAAA,QACN,OAAO;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,QACA,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,UAAU,iBAAiB,YAAY;AAAA,QAC7C;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,UAAM,eAAmD;AAAA,MACxD,GAAG,IAAI,yBAAS,eAAe;AAAA,MAC/B,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,KAAK,IAAI,yBAAS,eAAe;AAAA,MACjC,GAAG,IAAI,yBAAS,eAAe;AAAA,IAChC;AAEA,UAAM,cAAc,eAAe;AAAA,EACpC;AACD;","names":[]}
|
|
@@ -22,9 +22,9 @@ __export(binary_data_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(binary_data_exports);
|
|
24
24
|
const CHUNK_SIZE = 256 * 1024;
|
|
25
|
-
async function getBinaryDataFile(ctx, itemIdx,
|
|
26
|
-
const binaryData = ctx.helpers.assertBinaryData(itemIdx,
|
|
27
|
-
const fileContent = binaryData.id ? await ctx.helpers.getBinaryStream(binaryData.id, CHUNK_SIZE) : await ctx.helpers.getBinaryDataBuffer(itemIdx,
|
|
25
|
+
async function getBinaryDataFile(ctx, itemIdx, binaryPropertyData) {
|
|
26
|
+
const binaryData = ctx.helpers.assertBinaryData(itemIdx, binaryPropertyData);
|
|
27
|
+
const fileContent = binaryData.id ? await ctx.helpers.getBinaryStream(binaryData.id, CHUNK_SIZE) : await ctx.helpers.getBinaryDataBuffer(itemIdx, binaryPropertyData);
|
|
28
28
|
return {
|
|
29
29
|
filename: binaryData.fileName,
|
|
30
30
|
contentType: binaryData.mimeType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/binary-data.ts"],"sourcesContent":["import type { IExecuteFunctions } from 'n8n-workflow';\n\n/** Chunk size to use for streaming. 256Kb */\nconst CHUNK_SIZE = 256 * 1024;\n\n/**\n * Gets the binary data file for the given item index and given property name.\n * Returns the file name, content type and the file content. Uses streaming\n * when possible.\n */\nexport async function getBinaryDataFile(\n\tctx: IExecuteFunctions,\n\titemIdx: number,\n\
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/binary-data.ts"],"sourcesContent":["import type { IBinaryData, IExecuteFunctions } from 'n8n-workflow';\n\n/** Chunk size to use for streaming. 256Kb */\nconst CHUNK_SIZE = 256 * 1024;\n\n/**\n * Gets the binary data file for the given item index and given property name.\n * Returns the file name, content type and the file content. Uses streaming\n * when possible.\n */\nexport async function getBinaryDataFile(\n\tctx: IExecuteFunctions,\n\titemIdx: number,\n\tbinaryPropertyData: string | IBinaryData,\n) {\n\tconst binaryData = ctx.helpers.assertBinaryData(itemIdx, binaryPropertyData);\n\n\tconst fileContent = binaryData.id\n\t\t? await ctx.helpers.getBinaryStream(binaryData.id, CHUNK_SIZE)\n\t\t: await ctx.helpers.getBinaryDataBuffer(itemIdx, binaryPropertyData);\n\n\treturn {\n\t\tfilename: binaryData.fileName,\n\t\tcontentType: binaryData.mimeType,\n\t\tfileContent,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,MAAM,aAAa,MAAM;AAOzB,eAAsB,kBACrB,KACA,SACA,oBACC;AACD,QAAM,aAAa,IAAI,QAAQ,iBAAiB,SAAS,kBAAkB;AAE3E,QAAM,cAAc,WAAW,KAC5B,MAAM,IAAI,QAAQ,gBAAgB,WAAW,IAAI,UAAU,IAC3D,MAAM,IAAI,QAAQ,oBAAoB,SAAS,kBAAkB;AAEpE,SAAO;AAAA,IACN,UAAU,WAAW;AAAA,IACrB,aAAa,WAAW;AAAA,IACxB;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var description_exports = {};
|
|
20
|
+
__export(description_exports, {
|
|
21
|
+
configureNodeInputs: () => configureNodeInputs,
|
|
22
|
+
prettifyOperation: () => prettifyOperation
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(description_exports);
|
|
25
|
+
const prettifyOperation = (resource, operation) => {
|
|
26
|
+
if (operation === "deleteAssistant") {
|
|
27
|
+
return "Delete Assistant";
|
|
28
|
+
}
|
|
29
|
+
if (operation === "deleteFile") {
|
|
30
|
+
return "Delete File";
|
|
31
|
+
}
|
|
32
|
+
if (operation === "classify") {
|
|
33
|
+
return "Classify Text";
|
|
34
|
+
}
|
|
35
|
+
if (operation === "message" && resource === "text") {
|
|
36
|
+
return "Message Model";
|
|
37
|
+
}
|
|
38
|
+
const capitalize = (str) => {
|
|
39
|
+
const chars = str.split("");
|
|
40
|
+
chars[0] = chars[0].toUpperCase();
|
|
41
|
+
return chars.join("");
|
|
42
|
+
};
|
|
43
|
+
if (["transcribe", "translate"].includes(operation)) {
|
|
44
|
+
resource = "recording";
|
|
45
|
+
}
|
|
46
|
+
if (operation === "list") {
|
|
47
|
+
resource = resource + "s";
|
|
48
|
+
}
|
|
49
|
+
return `${capitalize(operation)} ${capitalize(resource)}`;
|
|
50
|
+
};
|
|
51
|
+
const configureNodeInputs = (resource, operation, hideTools, memory) => {
|
|
52
|
+
if (resource === "assistant" && operation === "message") {
|
|
53
|
+
const inputs = [
|
|
54
|
+
{ type: "main" },
|
|
55
|
+
{ type: "ai_tool", displayName: "Tools" }
|
|
56
|
+
];
|
|
57
|
+
if (memory !== "threadId") {
|
|
58
|
+
inputs.push({ type: "ai_memory", displayName: "Memory", maxConnections: 1 });
|
|
59
|
+
}
|
|
60
|
+
return inputs;
|
|
61
|
+
}
|
|
62
|
+
if (resource === "text" && (operation === "message" || operation === "response")) {
|
|
63
|
+
if (hideTools === "hide") {
|
|
64
|
+
return ["main"];
|
|
65
|
+
}
|
|
66
|
+
return [{ type: "main" }, { type: "ai_tool", displayName: "Tools" }];
|
|
67
|
+
}
|
|
68
|
+
return ["main"];
|
|
69
|
+
};
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
configureNodeInputs,
|
|
73
|
+
prettifyOperation
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/description.ts"],"sourcesContent":["import type { INodeInputConfiguration } from 'n8n-workflow';\n\nexport const prettifyOperation = (resource: string, operation: string) => {\n\tif (operation === 'deleteAssistant') {\n\t\treturn 'Delete Assistant';\n\t}\n\n\tif (operation === 'deleteFile') {\n\t\treturn 'Delete File';\n\t}\n\n\tif (operation === 'classify') {\n\t\treturn 'Classify Text';\n\t}\n\n\tif (operation === 'message' && resource === 'text') {\n\t\treturn 'Message Model';\n\t}\n\n\tconst capitalize = (str: string) => {\n\t\tconst chars = str.split('');\n\t\tchars[0] = chars[0].toUpperCase();\n\t\treturn chars.join('');\n\t};\n\n\tif (['transcribe', 'translate'].includes(operation)) {\n\t\tresource = 'recording';\n\t}\n\n\tif (operation === 'list') {\n\t\tresource = resource + 's';\n\t}\n\n\treturn `${capitalize(operation)} ${capitalize(resource)}`;\n};\n\nexport const configureNodeInputs = (\n\tresource: string,\n\toperation: string,\n\thideTools: string,\n\tmemory: string | undefined,\n) => {\n\tif (resource === 'assistant' && operation === 'message') {\n\t\tconst inputs: INodeInputConfiguration[] = [\n\t\t\t{ type: 'main' },\n\t\t\t{ type: 'ai_tool', displayName: 'Tools' },\n\t\t];\n\t\tif (memory !== 'threadId') {\n\t\t\tinputs.push({ type: 'ai_memory', displayName: 'Memory', maxConnections: 1 });\n\t\t}\n\t\treturn inputs;\n\t}\n\tif (resource === 'text' && (operation === 'message' || operation === 'response')) {\n\t\tif (hideTools === 'hide') {\n\t\t\treturn ['main'];\n\t\t}\n\t\treturn [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];\n\t}\n\n\treturn ['main'];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,oBAAoB,CAAC,UAAkB,cAAsB;AACzE,MAAI,cAAc,mBAAmB;AACpC,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,cAAc;AAC/B,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,YAAY;AAC7B,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,aAAa,aAAa,QAAQ;AACnD,WAAO;AAAA,EACR;AAEA,QAAM,aAAa,CAAC,QAAgB;AACnC,UAAM,QAAQ,IAAI,MAAM,EAAE;AAC1B,UAAM,CAAC,IAAI,MAAM,CAAC,EAAE,YAAY;AAChC,WAAO,MAAM,KAAK,EAAE;AAAA,EACrB;AAEA,MAAI,CAAC,cAAc,WAAW,EAAE,SAAS,SAAS,GAAG;AACpD,eAAW;AAAA,EACZ;AAEA,MAAI,cAAc,QAAQ;AACzB,eAAW,WAAW;AAAA,EACvB;AAEA,SAAO,GAAG,WAAW,SAAS,CAAC,IAAI,WAAW,QAAQ,CAAC;AACxD;AAEO,MAAM,sBAAsB,CAClC,UACA,WACA,WACA,WACI;AACJ,MAAI,aAAa,eAAe,cAAc,WAAW;AACxD,UAAM,SAAoC;AAAA,MACzC,EAAE,MAAM,OAAO;AAAA,MACf,EAAE,MAAM,WAAW,aAAa,QAAQ;AAAA,IACzC;AACA,QAAI,WAAW,YAAY;AAC1B,aAAO,KAAK,EAAE,MAAM,aAAa,aAAa,UAAU,gBAAgB,EAAE,CAAC;AAAA,IAC5E;AACA,WAAO;AAAA,EACR;AACA,MAAI,aAAa,WAAW,cAAc,aAAa,cAAc,aAAa;AACjF,QAAI,cAAc,QAAQ;AACzB,aAAO,CAAC,MAAM;AAAA,IACf;AACA,WAAO,CAAC,EAAE,MAAM,OAAO,GAAG,EAAE,MAAM,WAAW,aAAa,QAAQ,CAAC;AAAA,EACpE;AAEA,SAAO,CAAC,MAAM;AACf;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/interfaces.ts"],"sourcesContent":["import type { IDataObject } from 'n8n-workflow';\n\nexport type ChatCompletion = {\n\tid: string;\n\tobject: string;\n\tcreated: number;\n\tmodel: string;\n\tchoices: Array<{\n\t\tindex: number;\n\t\tmessage: {\n\t\t\trole: string;\n\t\t\tcontent: string;\n\t\t\ttool_calls?: Array<{\n\t\t\t\tid: string;\n\t\t\t\ttype: 'function';\n\t\t\t\tfunction: {\n\t\t\t\t\tname: string;\n\t\t\t\t\targuments: string;\n\t\t\t\t};\n\t\t\t}>;\n\t\t};\n\t\tfinish_reason?: 'tool_calls';\n\t}>;\n\tusage: {\n\t\tprompt_tokens: number;\n\t\tcompletion_tokens: number;\n\t\ttotal_tokens: number;\n\t};\n\tsystem_fingerprint: string;\n};\n\nexport type ThreadMessage = {\n\tid: string;\n\tobject: string;\n\tcreated_at: number;\n\tthread_id: string;\n\trole: string;\n\tcontent: Array<{\n\t\ttype: string;\n\t\ttext: {\n\t\t\tvalue: string;\n\t\t\tannotations: string[];\n\t\t};\n\t}>;\n\tfile_ids: string[];\n\tassistant_id: string;\n\trun_id: string;\n\tmetadata: IDataObject;\n};\n\nexport type ExternalApiCallOptions = {\n\tcallExternalApi: boolean;\n\turl: string;\n\tpath: string;\n\tmethod: string;\n\trequestOptions: IDataObject;\n\tsendParametersIn: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/interfaces.ts"],"sourcesContent":["import { type OpenAIClient } from '@langchain/openai';\nimport type { IDataObject } from 'n8n-workflow';\nimport type {\n\tComputerTool,\n\tCustomTool,\n\tFileSearchTool,\n\tFunctionTool,\n\tResponseInputContent,\n\tResponseInputItem,\n\tTool,\n\tWebSearchTool as OpenAIChatWebSearchTool,\n} from 'openai/resources/responses/responses';\n\nexport type ChatResponse = OpenAIClient.Responses.Response;\nexport type ChatContent = ResponseInputContent[];\nexport type ChatInputItem = OpenAIClient.Responses.ResponseInputItem.Message;\n\n// FIXME: remove these overrides, when langchain-openai is updated with the new types\nexport type WebSearchTool = Omit<OpenAIChatWebSearchTool, 'type'> & {\n\ttype: 'web_search';\n\tfilters?: {\n\t\tallowed_domains?: string[];\n\t};\n};\nexport type McpTool = Tool.Mcp & {\n\ttype: 'mcp';\n\tauthorization?: string;\n\tconnector_id?: string;\n};\n\nexport type ChatTool =\n\t| FunctionTool\n\t| FileSearchTool\n\t| WebSearchTool\n\t| ComputerTool\n\t| McpTool\n\t| Tool.CodeInterpreter\n\t| Tool.ImageGeneration\n\t| Tool.LocalShell\n\t| CustomTool;\n\nexport type ChatResponseRequest = Omit<\n\tOpenAIClient.Responses.ResponseCreateParamsNonStreaming,\n\t'input'\n> & {\n\tmax_tool_calls?: number;\n\tconversation?:\n\t\t| string\n\t\t| {\n\t\t\t\tid: string;\n\t\t };\n\tinput: ResponseInputItem[];\n\ttop_logprobs?: number;\n\ttools?: ChatTool[];\n};\n\nexport type ChatCompletion = {\n\tid: string;\n\tobject: string;\n\tcreated: number;\n\tmodel: string;\n\tchoices: Array<{\n\t\tindex: number;\n\t\tmessage: {\n\t\t\trole: string;\n\t\t\tcontent: string;\n\t\t\ttool_calls?: Array<{\n\t\t\t\tid: string;\n\t\t\t\ttype: 'function';\n\t\t\t\tfunction: {\n\t\t\t\t\tname: string;\n\t\t\t\t\targuments: string;\n\t\t\t\t};\n\t\t\t}>;\n\t\t};\n\t\tfinish_reason?: 'tool_calls';\n\t}>;\n\tusage: {\n\t\tprompt_tokens: number;\n\t\tcompletion_tokens: number;\n\t\ttotal_tokens: number;\n\t};\n\tsystem_fingerprint: string;\n};\n\nexport type ThreadMessage = {\n\tid: string;\n\tobject: string;\n\tcreated_at: number;\n\tthread_id: string;\n\trole: string;\n\tcontent: Array<{\n\t\ttype: string;\n\t\ttext: {\n\t\t\tvalue: string;\n\t\t\tannotations: string[];\n\t\t};\n\t}>;\n\tfile_ids: string[];\n\tassistant_id: string;\n\trun_id: string;\n\tmetadata: IDataObject;\n};\n\nexport type ExternalApiCallOptions = {\n\tcallExternalApi: boolean;\n\turl: string;\n\tpath: string;\n\tmethod: string;\n\trequestOptions: IDataObject;\n\tsendParametersIn: string;\n};\n\nexport type VideoJob = {\n\tid: string;\n\tcompleted_at?: number;\n\tcreated_at: number;\n\terror?: {\n\t\tcode: string;\n\t\tmessage: string;\n\t};\n\texpires_at?: number;\n\tmodel: string;\n\tobject: 'video';\n\tprogress?: number;\n\tremixed_from_video_id?: string;\n\tseconds: string;\n\tsize: string;\n\tstatus: 'completed' | 'queued' | 'in_progress';\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var modelFiltering_exports = {};
|
|
20
|
+
__export(modelFiltering_exports, {
|
|
21
|
+
shouldIncludeModel: () => shouldIncludeModel
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(modelFiltering_exports);
|
|
24
|
+
function shouldIncludeModel(modelId, isCustomAPI) {
|
|
25
|
+
if (isCustomAPI) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return !(modelId.startsWith("babbage") || modelId.startsWith("davinci") || modelId.startsWith("computer-use") || modelId.startsWith("dall-e") || modelId.startsWith("text-embedding") || modelId.startsWith("tts") || modelId.includes("-tts") || modelId.startsWith("whisper") || modelId.startsWith("omni-moderation") || modelId.startsWith("sora") || modelId.includes("-realtime") || modelId.startsWith("gpt-") && modelId.includes("instruct"));
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
shouldIncludeModel
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=modelFiltering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/modelFiltering.ts"],"sourcesContent":["/**\n * Determines whether a model should be included in the model list based on\n * whether it's a custom API and the model's ID.\n *\n * @param modelId - The ID of the model to check\n * @param isCustomAPI - Whether this is a custom API (not official OpenAI)\n * @returns true if the model should be included, false otherwise\n */\nexport function shouldIncludeModel(modelId: string, isCustomAPI: boolean): boolean {\n\t// For custom APIs, include all models\n\tif (isCustomAPI) {\n\t\treturn true;\n\t}\n\n\t// For official OpenAI API, exclude certain model types\n\treturn !(\n\t\tmodelId.startsWith('babbage') ||\n\t\tmodelId.startsWith('davinci') ||\n\t\tmodelId.startsWith('computer-use') ||\n\t\tmodelId.startsWith('dall-e') ||\n\t\tmodelId.startsWith('text-embedding') ||\n\t\tmodelId.startsWith('tts') ||\n\t\tmodelId.includes('-tts') ||\n\t\tmodelId.startsWith('whisper') ||\n\t\tmodelId.startsWith('omni-moderation') ||\n\t\tmodelId.startsWith('sora') ||\n\t\tmodelId.includes('-realtime') ||\n\t\t(modelId.startsWith('gpt-') && modelId.includes('instruct'))\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,mBAAmB,SAAiB,aAA+B;AAElF,MAAI,aAAa;AAChB,WAAO;AAAA,EACR;AAGA,SAAO,EACN,QAAQ,WAAW,SAAS,KAC5B,QAAQ,WAAW,SAAS,KAC5B,QAAQ,WAAW,cAAc,KACjC,QAAQ,WAAW,QAAQ,KAC3B,QAAQ,WAAW,gBAAgB,KACnC,QAAQ,WAAW,KAAK,KACxB,QAAQ,SAAS,MAAM,KACvB,QAAQ,WAAW,SAAS,KAC5B,QAAQ,WAAW,iBAAiB,KACpC,QAAQ,WAAW,MAAM,KACzB,QAAQ,SAAS,WAAW,KAC3B,QAAQ,WAAW,MAAM,KAAK,QAAQ,SAAS,UAAU;AAE5D;","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var polling_exports = {};
|
|
20
|
+
__export(polling_exports, {
|
|
21
|
+
pollUntilAvailable: () => pollUntilAvailable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(polling_exports);
|
|
24
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
25
|
+
async function pollUntilAvailable(ctx, request, check, timeoutSeconds, intervalSeconds = 5) {
|
|
26
|
+
const abortSignal = ctx.getExecutionCancelSignal();
|
|
27
|
+
let response;
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
while (!response || !check(response)) {
|
|
30
|
+
const elapsedTime = Date.now() - startTime;
|
|
31
|
+
if (elapsedTime >= timeoutSeconds * 1e3) {
|
|
32
|
+
throw new import_n8n_workflow.NodeApiError(ctx.getNode(), {
|
|
33
|
+
message: "Timeout reached",
|
|
34
|
+
code: 500
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (abortSignal?.aborted) {
|
|
38
|
+
throw new import_n8n_workflow.NodeApiError(ctx.getNode(), {
|
|
39
|
+
message: "Execution was cancelled",
|
|
40
|
+
code: 500
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
response = await request();
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, intervalSeconds * 1e3));
|
|
45
|
+
}
|
|
46
|
+
return response;
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
pollUntilAvailable
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=polling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/polling.ts"],"sourcesContent":["import type { IExecuteFunctions } from 'n8n-workflow';\nimport { NodeApiError } from 'n8n-workflow';\n\nexport async function pollUntilAvailable<TResponse>(\n\tctx: IExecuteFunctions,\n\trequest: () => Promise<TResponse>,\n\tcheck: (response: TResponse) => boolean,\n\ttimeoutSeconds: number,\n\tintervalSeconds = 5,\n): Promise<TResponse> {\n\tconst abortSignal = ctx.getExecutionCancelSignal();\n\tlet response: TResponse | undefined;\n\tconst startTime = Date.now();\n\n\twhile (!response || !check(response)) {\n\t\tconst elapsedTime = Date.now() - startTime;\n\t\tif (elapsedTime >= timeoutSeconds * 1000) {\n\t\t\tthrow new NodeApiError(ctx.getNode(), {\n\t\t\t\tmessage: 'Timeout reached',\n\t\t\t\tcode: 500,\n\t\t\t});\n\t\t}\n\n\t\tif (abortSignal?.aborted) {\n\t\t\tthrow new NodeApiError(ctx.getNode(), {\n\t\t\t\tmessage: 'Execution was cancelled',\n\t\t\t\tcode: 500,\n\t\t\t});\n\t\t}\n\n\t\tresponse = await request();\n\n\t\t// Wait before the next polling attempt\n\t\tawait new Promise((resolve) => setTimeout(resolve, intervalSeconds * 1000));\n\t}\n\n\treturn response;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAA6B;AAE7B,eAAsB,mBACrB,KACA,SACA,OACA,gBACA,kBAAkB,GACG;AACrB,QAAM,cAAc,IAAI,yBAAyB;AACjD,MAAI;AACJ,QAAM,YAAY,KAAK,IAAI;AAE3B,SAAO,CAAC,YAAY,CAAC,MAAM,QAAQ,GAAG;AACrC,UAAM,cAAc,KAAK,IAAI,IAAI;AACjC,QAAI,eAAe,iBAAiB,KAAM;AACzC,YAAM,IAAI,iCAAa,IAAI,QAAQ,GAAG;AAAA,QACrC,SAAS;AAAA,QACT,MAAM;AAAA,MACP,CAAC;AAAA,IACF;AAEA,QAAI,aAAa,SAAS;AACzB,YAAM,IAAI,iCAAa,IAAI,QAAQ,GAAG;AAAA,QACrC,SAAS;AAAA,QACT,MAAM;AAAA,MACP,CAAC;AAAA,IACF;AAEA,eAAW,MAAM,QAAQ;AAGzB,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,kBAAkB,GAAI,CAAC;AAAA,EAC3E;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -20,6 +20,7 @@ var utils_exports = {};
|
|
|
20
20
|
__export(utils_exports, {
|
|
21
21
|
formatToOpenAIAssistantTool: () => formatToOpenAIAssistantTool,
|
|
22
22
|
formatToOpenAIFunction: () => formatToOpenAIFunction,
|
|
23
|
+
formatToOpenAIResponsesTool: () => formatToOpenAIResponsesTool,
|
|
23
24
|
formatToOpenAITool: () => formatToOpenAITool,
|
|
24
25
|
getChatMessages: () => getChatMessages
|
|
25
26
|
});
|
|
@@ -53,6 +54,31 @@ function formatToOpenAIAssistantTool(tool) {
|
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
}
|
|
57
|
+
const requireStrict = (schema) => {
|
|
58
|
+
if (!schema.required) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (schema.properties) {
|
|
62
|
+
const propertyNames = Object.keys(schema.properties);
|
|
63
|
+
const somePropertyMissingFromRequired = propertyNames.some(
|
|
64
|
+
(propertyName) => !schema.required.includes(propertyName)
|
|
65
|
+
);
|
|
66
|
+
const requireStrict2 = !somePropertyMissingFromRequired;
|
|
67
|
+
return requireStrict2;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
};
|
|
71
|
+
function formatToOpenAIResponsesTool(tool) {
|
|
72
|
+
const schema = (0, import_zod_to_json_schema.zodToJsonSchema)(tool.schema);
|
|
73
|
+
const strict = requireStrict(schema);
|
|
74
|
+
return {
|
|
75
|
+
type: "function",
|
|
76
|
+
name: tool.name,
|
|
77
|
+
parameters: schema,
|
|
78
|
+
strict,
|
|
79
|
+
description: tool.description
|
|
80
|
+
};
|
|
81
|
+
}
|
|
56
82
|
async function getChatMessages(memory) {
|
|
57
83
|
return (await memory.loadMemoryVariables({}))[memory.memoryKey];
|
|
58
84
|
}
|
|
@@ -60,6 +86,7 @@ async function getChatMessages(memory) {
|
|
|
60
86
|
0 && (module.exports = {
|
|
61
87
|
formatToOpenAIAssistantTool,
|
|
62
88
|
formatToOpenAIFunction,
|
|
89
|
+
formatToOpenAIResponsesTool,
|
|
63
90
|
formatToOpenAITool,
|
|
64
91
|
getChatMessages
|
|
65
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/utils.ts"],"sourcesContent":["import type { BaseMessage } from '@langchain/core/messages';\nimport type { Tool } from '@langchain/core/tools';\nimport type { OpenAIClient } from '@langchain/openai';\nimport type { BufferWindowMemory } from 'langchain/memory';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\n\n// Copied from langchain(`langchain/src/tools/convert_to_openai.ts`)\n// since these functions are not exported\n\n/**\n * Formats a `Tool` instance into a format that is compatible\n * with OpenAI's ChatCompletionFunctions. It uses the `zodToJsonSchema`\n * function to convert the schema of the tool into a JSON\n * schema, which is then used as the parameters for the OpenAI function.\n */\nexport function formatToOpenAIFunction(\n\ttool: Tool,\n): OpenAIClient.Chat.ChatCompletionCreateParams.Function {\n\treturn {\n\t\tname: tool.name,\n\t\tdescription: tool.description,\n\t\tparameters: zodToJsonSchema(tool.schema),\n\t};\n}\n\nexport function formatToOpenAITool(tool: Tool): OpenAIClient.Chat.ChatCompletionTool {\n\tconst schema = zodToJsonSchema(tool.schema);\n\treturn {\n\t\ttype: 'function',\n\t\tfunction: {\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: schema,\n\t\t},\n\t};\n}\n\nexport function formatToOpenAIAssistantTool(tool: Tool): OpenAIClient.Beta.AssistantTool {\n\treturn {\n\t\ttype: 'function',\n\t\tfunction: {\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: zodToJsonSchema(tool.schema),\n\t\t},\n\t};\n}\n\nexport async function getChatMessages(memory: BufferWindowMemory): Promise<BaseMessage[]> {\n\treturn (await memory.loadMemoryVariables({}))[memory.memoryKey] as BaseMessage[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,gCAAgC;AAWzB,SAAS,uBACf,MACwD;AACxD,SAAO;AAAA,IACN,MAAM,KAAK;AAAA,IACX,aAAa,KAAK;AAAA,IAClB,gBAAY,2CAAgB,KAAK,MAAM;AAAA,EACxC;AACD;AAEO,SAAS,mBAAmB,MAAkD;AACpF,QAAM,aAAS,2CAAgB,KAAK,MAAM;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,MACT,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,YAAY;AAAA,IACb;AAAA,EACD;AACD;AAEO,SAAS,4BAA4B,MAA6C;AACxF,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,MACT,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,gBAAY,2CAAgB,KAAK,MAAM;AAAA,IACxC;AAAA,EACD;AACD;AAEA,eAAsB,gBAAgB,QAAoD;AACzF,UAAQ,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,OAAO,SAAS;AAC/D;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/helpers/utils.ts"],"sourcesContent":["import type { BaseMessage } from '@langchain/core/messages';\nimport type { Tool } from '@langchain/core/tools';\nimport type { OpenAIClient } from '@langchain/openai';\nimport type { BufferWindowMemory } from 'langchain/memory';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\n\n// Copied from langchain(`langchain/src/tools/convert_to_openai.ts`)\n// since these functions are not exported\n\n/**\n * Formats a `Tool` instance into a format that is compatible\n * with OpenAI's ChatCompletionFunctions. It uses the `zodToJsonSchema`\n * function to convert the schema of the tool into a JSON\n * schema, which is then used as the parameters for the OpenAI function.\n */\nexport function formatToOpenAIFunction(\n\ttool: Tool,\n): OpenAIClient.Chat.ChatCompletionCreateParams.Function {\n\treturn {\n\t\tname: tool.name,\n\t\tdescription: tool.description,\n\t\tparameters: zodToJsonSchema(tool.schema),\n\t};\n}\n\nexport function formatToOpenAITool(tool: Tool): OpenAIClient.Chat.ChatCompletionTool {\n\tconst schema = zodToJsonSchema(tool.schema);\n\treturn {\n\t\ttype: 'function',\n\t\tfunction: {\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: schema,\n\t\t},\n\t};\n}\n\nexport function formatToOpenAIAssistantTool(tool: Tool): OpenAIClient.Beta.AssistantTool {\n\treturn {\n\t\ttype: 'function',\n\t\tfunction: {\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: zodToJsonSchema(tool.schema),\n\t\t},\n\t};\n}\n\nconst requireStrict = (schema: any) => {\n\tif (!schema.required) {\n\t\treturn false;\n\t}\n\t// when strict:true, Responses API requires `required` to be present and all properties to be included\n\tif (schema.properties) {\n\t\tconst propertyNames = Object.keys(schema.properties);\n\t\tconst somePropertyMissingFromRequired = propertyNames.some(\n\t\t\t(propertyName) => !schema.required.includes(propertyName),\n\t\t);\n\t\tconst requireStrict = !somePropertyMissingFromRequired;\n\t\treturn requireStrict;\n\t}\n\treturn false;\n};\n\nexport function formatToOpenAIResponsesTool(tool: Tool): OpenAIClient.Responses.FunctionTool {\n\tconst schema = zodToJsonSchema(tool.schema) as any;\n\tconst strict = requireStrict(schema);\n\treturn {\n\t\ttype: 'function',\n\t\tname: tool.name,\n\t\tparameters: schema,\n\t\tstrict,\n\t\tdescription: tool.description,\n\t};\n}\n\nexport async function getChatMessages(memory: BufferWindowMemory): Promise<BaseMessage[]> {\n\treturn (await memory.loadMemoryVariables({}))[memory.memoryKey] as BaseMessage[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,gCAAgC;AAWzB,SAAS,uBACf,MACwD;AACxD,SAAO;AAAA,IACN,MAAM,KAAK;AAAA,IACX,aAAa,KAAK;AAAA,IAClB,gBAAY,2CAAgB,KAAK,MAAM;AAAA,EACxC;AACD;AAEO,SAAS,mBAAmB,MAAkD;AACpF,QAAM,aAAS,2CAAgB,KAAK,MAAM;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,MACT,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,YAAY;AAAA,IACb;AAAA,EACD;AACD;AAEO,SAAS,4BAA4B,MAA6C;AACxF,SAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,MACT,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,gBAAY,2CAAgB,KAAK,MAAM;AAAA,IACxC;AAAA,EACD;AACD;AAEA,MAAM,gBAAgB,CAAC,WAAgB;AACtC,MAAI,CAAC,OAAO,UAAU;AACrB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,YAAY;AACtB,UAAM,gBAAgB,OAAO,KAAK,OAAO,UAAU;AACnD,UAAM,kCAAkC,cAAc;AAAA,MACrD,CAAC,iBAAiB,CAAC,OAAO,SAAS,SAAS,YAAY;AAAA,IACzD;AACA,UAAMA,iBAAgB,CAAC;AACvB,WAAOA;AAAA,EACR;AACA,SAAO;AACR;AAEO,SAAS,4BAA4B,MAAiD;AAC5F,QAAM,aAAS,2CAAgB,KAAK,MAAM;AAC1C,QAAM,SAAS,cAAc,MAAM;AACnC,SAAO;AAAA,IACN,MAAM;AAAA,IACN,MAAM,KAAK;AAAA,IACX,YAAY;AAAA,IACZ;AAAA,IACA,aAAa,KAAK;AAAA,EACnB;AACD;AAEA,eAAsB,gBAAgB,QAAoD;AACzF,UAAQ,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,OAAO,SAAS;AAC/D;","names":["requireStrict"]}
|
|
@@ -21,9 +21,11 @@ __export(listSearch_exports, {
|
|
|
21
21
|
assistantSearch: () => assistantSearch,
|
|
22
22
|
fileSearch: () => fileSearch,
|
|
23
23
|
imageModelSearch: () => imageModelSearch,
|
|
24
|
-
modelSearch: () => modelSearch
|
|
24
|
+
modelSearch: () => modelSearch,
|
|
25
|
+
videoModelSearch: () => videoModelSearch
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(listSearch_exports);
|
|
28
|
+
var import_modelFiltering = require("../helpers/modelFiltering");
|
|
27
29
|
var import_transport = require("../transport");
|
|
28
30
|
async function fileSearch(filter) {
|
|
29
31
|
const { data } = await import_transport.apiRequest.call(this, "GET", "/files");
|
|
@@ -76,10 +78,11 @@ const getModelSearch = (filterCondition) => async (ctx, filter) => {
|
|
|
76
78
|
async function modelSearch(filter) {
|
|
77
79
|
const credentials = await this.getCredentials("openAiApi");
|
|
78
80
|
const url = credentials.url && new URL(credentials.url);
|
|
79
|
-
const isCustomAPI = url && !["api.openai.com", "ai-assistant.n8n.io"].includes(url.hostname);
|
|
80
|
-
return await getModelSearch(
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
const isCustomAPI = !!(url && !["api.openai.com", "ai-assistant.n8n.io"].includes(url.hostname));
|
|
82
|
+
return await getModelSearch((model) => (0, import_modelFiltering.shouldIncludeModel)(model.id, isCustomAPI))(this, filter);
|
|
83
|
+
}
|
|
84
|
+
async function videoModelSearch(filter) {
|
|
85
|
+
return await getModelSearch((model) => model.id.includes("sora"))(this, filter);
|
|
83
86
|
}
|
|
84
87
|
async function imageModelSearch(filter) {
|
|
85
88
|
return await getModelSearch(
|
|
@@ -129,6 +132,7 @@ async function assistantSearch(filter, paginationToken) {
|
|
|
129
132
|
assistantSearch,
|
|
130
133
|
fileSearch,
|
|
131
134
|
imageModelSearch,
|
|
132
|
-
modelSearch
|
|
135
|
+
modelSearch,
|
|
136
|
+
videoModelSearch
|
|
133
137
|
});
|
|
134
138
|
//# sourceMappingURL=listSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/methods/listSearch.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tILoadOptionsFunctions,\n\tINodeListSearchItems,\n\tINodeListSearchResult,\n} from 'n8n-workflow';\nimport type { Assistant } from 'openai/resources/beta/assistants';\nimport type { Model } from 'openai/resources/models';\n\nimport { apiRequest } from '../transport';\n\nexport async function fileSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst { data } = await apiRequest.call(this, 'GET', '/files');\n\n\tif (filter) {\n\t\tconst results: INodeListSearchItems[] = [];\n\n\t\tfor (const file of data || []) {\n\t\t\tif ((file.filename as string)?.toLowerCase().includes(filter.toLowerCase())) {\n\t\t\t\tresults.push({\n\t\t\t\t\tname: file.filename as string,\n\t\t\t\t\tvalue: file.id as string,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tresults,\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\tresults: (data || []).map((file: IDataObject) => ({\n\t\t\t\tname: file.filename as string,\n\t\t\t\tvalue: file.id as string,\n\t\t\t})),\n\t\t};\n\t}\n}\n\nconst getModelSearch =\n\t(filterCondition: (model: Model) => boolean) =>\n\tasync (ctx: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult> => {\n\t\tlet { data } = (await apiRequest.call(ctx, 'GET', '/models')) as { data: Model[] };\n\n\t\tdata = data?.filter((model) => filterCondition(model));\n\n\t\tlet results: INodeListSearchItems[] = [];\n\n\t\tif (filter) {\n\t\t\tfor (const model of data || []) {\n\t\t\t\tif (model.id?.toLowerCase().includes(filter.toLowerCase())) {\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tname: model.id.toUpperCase(),\n\t\t\t\t\t\tvalue: model.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tresults = (data || []).map((model) => ({\n\t\t\t\tname: model.id.toUpperCase(),\n\t\t\t\tvalue: model.id,\n\t\t\t}));\n\t\t}\n\n\t\tresults = results.sort((a, b) => a.name.localeCompare(b.name));\n\t\treturn {\n\t\t\tresults,\n\t\t};\n\t};\n\nexport async function modelSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst credentials = await this.getCredentials<{ url: string }>('openAiApi');\n\tconst url = credentials.url && new URL(credentials.url);\n\tconst isCustomAPI = url && !['api.openai.com', 'ai-assistant.n8n.io'].includes(url.hostname);\n\treturn await getModelSearch(
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/methods/listSearch.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tILoadOptionsFunctions,\n\tINodeListSearchItems,\n\tINodeListSearchResult,\n} from 'n8n-workflow';\nimport type { Assistant } from 'openai/resources/beta/assistants';\nimport type { Model } from 'openai/resources/models';\n\nimport { shouldIncludeModel } from '../helpers/modelFiltering';\nimport { apiRequest } from '../transport';\n\nexport async function fileSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst { data } = await apiRequest.call(this, 'GET', '/files');\n\n\tif (filter) {\n\t\tconst results: INodeListSearchItems[] = [];\n\n\t\tfor (const file of data || []) {\n\t\t\tif ((file.filename as string)?.toLowerCase().includes(filter.toLowerCase())) {\n\t\t\t\tresults.push({\n\t\t\t\t\tname: file.filename as string,\n\t\t\t\t\tvalue: file.id as string,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tresults,\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\tresults: (data || []).map((file: IDataObject) => ({\n\t\t\t\tname: file.filename as string,\n\t\t\t\tvalue: file.id as string,\n\t\t\t})),\n\t\t};\n\t}\n}\n\nconst getModelSearch =\n\t(filterCondition: (model: Model) => boolean) =>\n\tasync (ctx: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult> => {\n\t\tlet { data } = (await apiRequest.call(ctx, 'GET', '/models')) as { data: Model[] };\n\n\t\tdata = data?.filter((model) => filterCondition(model));\n\n\t\tlet results: INodeListSearchItems[] = [];\n\n\t\tif (filter) {\n\t\t\tfor (const model of data || []) {\n\t\t\t\tif (model.id?.toLowerCase().includes(filter.toLowerCase())) {\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tname: model.id.toUpperCase(),\n\t\t\t\t\t\tvalue: model.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tresults = (data || []).map((model) => ({\n\t\t\t\tname: model.id.toUpperCase(),\n\t\t\t\tvalue: model.id,\n\t\t\t}));\n\t\t}\n\n\t\tresults = results.sort((a, b) => a.name.localeCompare(b.name));\n\t\treturn {\n\t\t\tresults,\n\t\t};\n\t};\n\nexport async function modelSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\tconst credentials = await this.getCredentials<{ url: string }>('openAiApi');\n\tconst url = credentials.url && new URL(credentials.url);\n\tconst isCustomAPI = !!(url && !['api.openai.com', 'ai-assistant.n8n.io'].includes(url.hostname));\n\treturn await getModelSearch((model) => shouldIncludeModel(model.id, isCustomAPI))(this, filter);\n}\n\nexport async function videoModelSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\treturn await getModelSearch((model) => model.id.includes('sora'))(this, filter);\n}\n\nexport async function imageModelSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n): Promise<INodeListSearchResult> {\n\treturn await getModelSearch(\n\t\t(model) => model.id.includes('vision') || model.id.includes('gpt-4o'),\n\t)(this, filter);\n}\n\nexport async function assistantSearch(\n\tthis: ILoadOptionsFunctions,\n\tfilter?: string,\n\tpaginationToken?: string,\n): Promise<INodeListSearchResult> {\n\tconst { data, has_more, last_id } = (await apiRequest.call(this, 'GET', '/assistants', {\n\t\theaders: {\n\t\t\t'OpenAI-Beta': 'assistants=v2',\n\t\t},\n\t\tqs: {\n\t\t\tlimit: 100,\n\t\t\tafter: paginationToken,\n\t\t},\n\t})) as {\n\t\tdata: Assistant[];\n\t\thas_more: boolean;\n\t\tlast_id: string;\n\t\tfirst_id: string;\n\t};\n\n\tif (has_more) {\n\t\tpaginationToken = last_id;\n\t} else {\n\t\tpaginationToken = undefined;\n\t}\n\n\tif (filter) {\n\t\tconst results: INodeListSearchItems[] = [];\n\n\t\tfor (const assistant of data || []) {\n\t\t\tif (assistant.name?.toLowerCase().includes(filter.toLowerCase())) {\n\t\t\t\tresults.push({\n\t\t\t\t\tname: assistant.name,\n\t\t\t\t\tvalue: assistant.id,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tresults,\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\tresults: (data || []).map((assistant) => ({\n\t\t\t\tname: assistant.name ?? assistant.id,\n\t\t\t\tvalue: assistant.id,\n\t\t\t})),\n\t\t\tpaginationToken,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,4BAAmC;AACnC,uBAA2B;AAE3B,eAAsB,WAErB,QACiC;AACjC,QAAM,EAAE,KAAK,IAAI,MAAM,4BAAW,KAAK,MAAM,OAAO,QAAQ;AAE5D,MAAI,QAAQ;AACX,UAAM,UAAkC,CAAC;AAEzC,eAAW,QAAQ,QAAQ,CAAC,GAAG;AAC9B,UAAK,KAAK,UAAqB,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC,GAAG;AAC5E,gBAAQ,KAAK;AAAA,UACZ,MAAM,KAAK;AAAA,UACX,OAAO,KAAK;AAAA,QACb,CAAC;AAAA,MACF;AAAA,IACD;AAEA,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD,OAAO;AACN,WAAO;AAAA,MACN,UAAU,QAAQ,CAAC,GAAG,IAAI,CAAC,UAAuB;AAAA,QACjD,MAAM,KAAK;AAAA,QACX,OAAO,KAAK;AAAA,MACb,EAAE;AAAA,IACH;AAAA,EACD;AACD;AAEA,MAAM,iBACL,CAAC,oBACD,OAAO,KAA4B,WAAoD;AACtF,MAAI,EAAE,KAAK,IAAK,MAAM,4BAAW,KAAK,KAAK,OAAO,SAAS;AAE3D,SAAO,MAAM,OAAO,CAAC,UAAU,gBAAgB,KAAK,CAAC;AAErD,MAAI,UAAkC,CAAC;AAEvC,MAAI,QAAQ;AACX,eAAW,SAAS,QAAQ,CAAC,GAAG;AAC/B,UAAI,MAAM,IAAI,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC,GAAG;AAC3D,gBAAQ,KAAK;AAAA,UACZ,MAAM,MAAM,GAAG,YAAY;AAAA,UAC3B,OAAO,MAAM;AAAA,QACd,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD,OAAO;AACN,eAAW,QAAQ,CAAC,GAAG,IAAI,CAAC,WAAW;AAAA,MACtC,MAAM,MAAM,GAAG,YAAY;AAAA,MAC3B,OAAO,MAAM;AAAA,IACd,EAAE;AAAA,EACH;AAEA,YAAU,QAAQ,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAC7D,SAAO;AAAA,IACN;AAAA,EACD;AACD;AAED,eAAsB,YAErB,QACiC;AACjC,QAAM,cAAc,MAAM,KAAK,eAAgC,WAAW;AAC1E,QAAM,MAAM,YAAY,OAAO,IAAI,IAAI,YAAY,GAAG;AACtD,QAAM,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,kBAAkB,qBAAqB,EAAE,SAAS,IAAI,QAAQ;AAC9F,SAAO,MAAM,eAAe,CAAC,cAAU,0CAAmB,MAAM,IAAI,WAAW,CAAC,EAAE,MAAM,MAAM;AAC/F;AAEA,eAAsB,iBAErB,QACiC;AACjC,SAAO,MAAM,eAAe,CAAC,UAAU,MAAM,GAAG,SAAS,MAAM,CAAC,EAAE,MAAM,MAAM;AAC/E;AAEA,eAAsB,iBAErB,QACiC;AACjC,SAAO,MAAM;AAAA,IACZ,CAAC,UAAU,MAAM,GAAG,SAAS,QAAQ,KAAK,MAAM,GAAG,SAAS,QAAQ;AAAA,EACrE,EAAE,MAAM,MAAM;AACf;AAEA,eAAsB,gBAErB,QACA,iBACiC;AACjC,QAAM,EAAE,MAAM,UAAU,QAAQ,IAAK,MAAM,4BAAW,KAAK,MAAM,OAAO,eAAe;AAAA,IACtF,SAAS;AAAA,MACR,eAAe;AAAA,IAChB;AAAA,IACA,IAAI;AAAA,MACH,OAAO;AAAA,MACP,OAAO;AAAA,IACR;AAAA,EACD,CAAC;AAOD,MAAI,UAAU;AACb,sBAAkB;AAAA,EACnB,OAAO;AACN,sBAAkB;AAAA,EACnB;AAEA,MAAI,QAAQ;AACX,UAAM,UAAkC,CAAC;AAEzC,eAAW,aAAa,QAAQ,CAAC,GAAG;AACnC,UAAI,UAAU,MAAM,YAAY,EAAE,SAAS,OAAO,YAAY,CAAC,GAAG;AACjE,gBAAQ,KAAK;AAAA,UACZ,MAAM,UAAU;AAAA,UAChB,OAAO,UAAU;AAAA,QAClB,CAAC;AAAA,MACF;AAAA,IACD;AAEA,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD,OAAO;AACN,WAAO;AAAA,MACN,UAAU,QAAQ,CAAC,GAAG,IAAI,CAAC,eAAe;AAAA,QACzC,MAAM,UAAU,QAAQ,UAAU;AAAA,QAClC,OAAO,UAAU;AAAA,MAClB,EAAE;AAAA,MACF;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var OpenAiV1_node_exports = {};
|
|
30
|
+
__export(OpenAiV1_node_exports, {
|
|
31
|
+
OpenAiV1: () => OpenAiV1
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(OpenAiV1_node_exports);
|
|
34
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
35
|
+
var import_methods = require("../methods");
|
|
36
|
+
var import_router = require("./actions/router");
|
|
37
|
+
var import_description = require("../helpers/description");
|
|
38
|
+
var assistant = __toESM(require("./actions/assistant"));
|
|
39
|
+
var audio = __toESM(require("./actions/audio"));
|
|
40
|
+
var file = __toESM(require("./actions/file"));
|
|
41
|
+
var image = __toESM(require("./actions/image"));
|
|
42
|
+
var text = __toESM(require("./actions/text"));
|
|
43
|
+
class OpenAiV1 {
|
|
44
|
+
constructor(baseDescription) {
|
|
45
|
+
this.methods = {
|
|
46
|
+
listSearch: import_methods.listSearch,
|
|
47
|
+
loadOptions: import_methods.loadOptions
|
|
48
|
+
};
|
|
49
|
+
this.description = {
|
|
50
|
+
...baseDescription,
|
|
51
|
+
version: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8],
|
|
52
|
+
defaults: {
|
|
53
|
+
name: "OpenAI"
|
|
54
|
+
},
|
|
55
|
+
inputs: `={{(${import_description.configureNodeInputs})($parameter.resource, $parameter.operation, $parameter.hideTools, $parameter.memory ?? undefined)}}`,
|
|
56
|
+
outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
57
|
+
credentials: [
|
|
58
|
+
{
|
|
59
|
+
name: "openAiApi",
|
|
60
|
+
required: true
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
properties: [
|
|
64
|
+
{
|
|
65
|
+
displayName: "Resource",
|
|
66
|
+
name: "resource",
|
|
67
|
+
type: "options",
|
|
68
|
+
noDataExpression: true,
|
|
69
|
+
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
|
70
|
+
options: [
|
|
71
|
+
{
|
|
72
|
+
name: "Assistant",
|
|
73
|
+
value: "assistant"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "Text",
|
|
77
|
+
value: "text"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "Image",
|
|
81
|
+
value: "image"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "Audio",
|
|
85
|
+
value: "audio"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "File",
|
|
89
|
+
value: "file"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
default: "text"
|
|
93
|
+
},
|
|
94
|
+
...assistant.description,
|
|
95
|
+
...audio.description,
|
|
96
|
+
...file.description,
|
|
97
|
+
...image.description,
|
|
98
|
+
...text.description
|
|
99
|
+
]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async execute() {
|
|
103
|
+
return await import_router.router.call(this);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
OpenAiV1
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=OpenAiV1.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../nodes/vendors/OpenAi/v1/OpenAiV1.node.ts"],"sourcesContent":["import {\n\tNodeConnectionTypes,\n\ttype IExecuteFunctions,\n\ttype INodeType,\n\ttype INodeTypeBaseDescription,\n\ttype INodeTypeDescription,\n} from 'n8n-workflow';\n\nimport { listSearch, loadOptions } from '../methods';\nimport { router } from './actions/router';\nimport { configureNodeInputs } from '../helpers/description';\n\nimport * as assistant from './actions/assistant';\nimport * as audio from './actions/audio';\nimport * as file from './actions/file';\nimport * as image from './actions/image';\nimport * as text from './actions/text';\n\nexport class OpenAiV1 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\tversion: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8],\n\t\t\tdefaults: {\n\t\t\t\tname: 'OpenAI',\n\t\t\t},\n\t\t\tinputs: `={{(${configureNodeInputs})($parameter.resource, $parameter.operation, $parameter.hideTools, $parameter.memory ?? undefined)}}`,\n\t\t\toutputs: [NodeConnectionTypes.Main],\n\t\t\tcredentials: [\n\t\t\t\t{\n\t\t\t\t\tname: 'openAiApi',\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t],\n\t\t\tproperties: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Resource',\n\t\t\t\t\tname: 'resource',\n\t\t\t\t\ttype: 'options',\n\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Assistant',\n\t\t\t\t\t\t\tvalue: 'assistant',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Text',\n\t\t\t\t\t\t\tvalue: 'text',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Image',\n\t\t\t\t\t\t\tvalue: 'image',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'Audio',\n\t\t\t\t\t\t\tvalue: 'audio',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'File',\n\t\t\t\t\t\t\tvalue: 'file',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdefault: 'text',\n\t\t\t\t},\n\t\t\t\t...assistant.description,\n\t\t\t\t...audio.description,\n\t\t\t\t...file.description,\n\t\t\t\t...image.description,\n\t\t\t\t...text.description,\n\t\t\t],\n\t\t};\n\t}\n\n\tmethods = {\n\t\tlistSearch,\n\t\tloadOptions,\n\t};\n\n\tasync execute(this: IExecuteFunctions) {\n\t\treturn await router.call(this);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AAEP,qBAAwC;AACxC,oBAAuB;AACvB,yBAAoC;AAEpC,gBAA2B;AAC3B,YAAuB;AACvB,WAAsB;AACtB,YAAuB;AACvB,WAAsB;AAEf,MAAM,SAA8B;AAAA,EAG1C,YAAY,iBAA2C;AAuDvD,mBAAU;AAAA,MACT;AAAA,MACA;AAAA,IACD;AAzDC,SAAK,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,SAAS,CAAC,GAAG,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,MACnD,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,QAAQ,OAAO,sCAAmB;AAAA,MAClC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA;AAAA,UAElB,SAAS;AAAA,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,QACA,GAAG,UAAU;AAAA,QACb,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,MACT;AAAA,IACD;AAAA,EACD;AAAA,EAOA,MAAM,UAAiC;AACtC,WAAO,MAAM,qBAAO,KAAK,IAAI;AAAA,EAC9B;AACD;","names":[]}
|
|
@@ -23,7 +23,7 @@ __export(create_operation_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(create_operation_exports);
|
|
25
25
|
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
-
var import_transport = require("
|
|
26
|
+
var import_transport = require("../../../transport");
|
|
27
27
|
var import_descriptions = require("../descriptions");
|
|
28
28
|
const properties = [
|
|
29
29
|
(0, import_descriptions.modelRLC)("modelSearch"),
|