@n8n/n8n-nodes-langchain 3.0.1 → 3.1.0
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/CustomModelEndpointApi.credentials.d.ts +9 -0
- package/dist/credentials/CustomModelEndpointApi.credentials.js +133 -0
- package/dist/credentials/CustomModelEndpointApi.credentials.js.map +1 -0
- package/dist/credentials/McpOAuth2Api.credentials.js +2 -1
- package/dist/credentials/McpOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/icons/customModelEndpoint.dark.svg +1 -0
- package/dist/credentials/icons/customModelEndpoint.svg +1 -0
- package/dist/known/credentials.json +4 -0
- package/dist/node-definitions/.nodes-hash +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/api-key.js +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/api-key.js.map +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/oauth2.js +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/oauth2.js.map +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/requireFoundryEndpoint.js +1 -1
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/requireFoundryEndpoint.js.map +1 -1
- package/dist/nodes/mcp/shared/utils.js +2 -0
- package/dist/nodes/mcp/shared/utils.js.map +1 -1
- package/dist/nodes/vendors/Microsoft/microsoft-utils.d.ts +1 -1
- package/dist/nodes/vendors/Microsoft/microsoft-utils.js +60 -39
- package/dist/nodes/vendors/Microsoft/microsoft-utils.js.map +1 -1
- package/dist/typecheck.tsbuildinfo +1 -1
- package/dist/types/credentials.json +2 -1
- package/dist/utils/custom-model-endpoint/auth-fetch.d.ts +9 -0
- package/dist/utils/custom-model-endpoint/auth-fetch.js +43 -0
- package/dist/utils/custom-model-endpoint/auth-fetch.js.map +1 -0
- package/dist/utils/custom-model-endpoint/credential-data.d.ts +17 -0
- package/dist/utils/custom-model-endpoint/credential-data.js +37 -0
- package/dist/utils/custom-model-endpoint/credential-data.js.map +1 -0
- package/dist/utils/custom-model-endpoint/headers.d.ts +7 -0
- package/dist/utils/custom-model-endpoint/headers.js +42 -0
- package/dist/utils/custom-model-endpoint/headers.js.map +1 -0
- package/dist/utils/custom-model-endpoint/types.d.ts +20 -0
- package/dist/utils/custom-model-endpoint/types.js +3 -0
- package/dist/utils/custom-model-endpoint/types.js.map +1 -0
- package/dist/utils/normalizeEndpoint.js.map +1 -0
- package/package.json +17 -16
- package/dist/nodes/llms/LmChatAzureOpenAi/credentials/normalizeEndpoint.js.map +0 -1
- /package/dist/{nodes/llms/LmChatAzureOpenAi/credentials → utils}/normalizeEndpoint.d.ts +0 -0
- /package/dist/{nodes/llms/LmChatAzureOpenAi/credentials → utils}/normalizeEndpoint.js +0 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
{"name":"chromaSelfHostedApi","displayName":"ChromaDB Self-Hosted","documentationUrl":"chroma","properties":[{"displayName":"Base URL","name":"baseUrl","type":"string","default":"http://localhost:8000","placeholder":"http://localhost:8000","description":"The URL of your ChromaDB instance. Note that path prefixes are not supported, so the URL must point directly to the instance root."},{"displayName":"Authentication","name":"authentication","type":"options","options":[{"name":"None","value":"none"},{"name":"API Key","value":"apiKey"},{"name":"Token","value":"token"}],"default":"none"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"default":"","displayOptions":{"show":{"authentication":["apiKey"]}}},{"displayName":"Token","name":"token","type":"string","typeOptions":{"password":true},"default":"","displayOptions":{"show":{"authentication":["token"]}}}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"={{$credentials.authentication === \"apiKey\" && $credentials.apiKey ? \"Bearer \" + $credentials.apiKey : \"\"}}","X-Chroma-Token":"={{$credentials.authentication === \"token\" && $credentials.token ? $credentials.token : \"\"}}"}}},"test":{"request":{"baseURL":"={{$credentials.baseUrl}}","url":"/api/v2/heartbeat","method":"GET"}},"supportedNodes":["vectorStoreChromaDB"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg"}},
|
|
9
9
|
{"name":"chromaCloudApi","displayName":"ChromaDB Cloud","documentationUrl":"chroma","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"default":"","required":true,"description":"Your Chroma Cloud API key"},{"displayName":"Tenant ID","name":"tenant","type":"string","default":"","description":"Optional: Tenant ID (auto-resolved if API key is scoped to single DB)"},{"displayName":"Database Name","name":"database","type":"string","default":"","description":"Optional: Database name (auto-resolved if API key is scoped to single DB)"},{"displayName":"Base URL","name":"baseUrl","type":"string","default":"https://api.trychroma.com","required":true}],"authenticate":{"type":"generic","properties":{"headers":{"x-chroma-token":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials.baseUrl}}","url":"/api/v2","method":"GET"}},"supportedNodes":["vectorStoreChromaDB"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg"}},
|
|
10
10
|
{"name":"cohereApi","displayName":"Cohere API","documentationUrl":"cohere","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.cohere.ai"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/v1/models?page_size=1"}},"supportedNodes":["embeddingsCohere","lmChatCohere","lmCohere","rerankerCohere"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.dark.svg"}},
|
|
11
|
+
{"name":"customModelEndpointApi","displayName":"Custom Model Endpoint","documentationUrl":"custommodelendpoint","properties":[{"displayName":"Base URL","name":"url","type":"string","required":true,"default":"","placeholder":"https://my-gateway.example.com/v1","description":"The root URL of the OpenAI-compatible API. n8n adds the paths, such as /chat/completions, to it."},{"displayName":"Authentication","name":"authentication","type":"options","options":[{"name":"Bearer Token","value":"bearer","description":"Send the key as \"Authorization: Bearer <key>\""},{"name":"API Key in Header","value":"header","description":"Send the key in a header with a name that you choose"},{"name":"Basic Auth","value":"basic","description":"Send a user name and a password"},{"name":"None","value":"none","description":"Send no login"}],"default":"bearer"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":"","displayOptions":{"show":{"authentication":["bearer","header"]}}},{"displayName":"Header Name","name":"authHeaderName","type":"string","required":true,"default":"","placeholder":"Ocp-Apim-Subscription-Key","description":"The name of the header that carries the key","displayOptions":{"show":{"authentication":["header"]}}},{"displayName":"Header Value Prefix","name":"authHeaderPrefix","type":"string","default":"","placeholder":"e.g. Token","description":"Text that n8n puts before the key, followed by one space. Leave it empty to send the key alone.","displayOptions":{"show":{"authentication":["header"]}}},{"displayName":"User Name","name":"username","type":"string","required":true,"default":"","displayOptions":{"show":{"authentication":["basic"]}}},{"displayName":"Password","name":"password","type":"string","typeOptions":{"password":true},"default":"","displayOptions":{"show":{"authentication":["basic"]}}},{"displayName":"Gateway Headers","name":"gatewayHeaders","type":"fixedCollection","typeOptions":{"multipleValues":true},"placeholder":"Add Header","default":{},"description":"Headers that n8n sends on every request to this endpoint, including the model list. The values are secret and fixed.","options":[{"displayName":"Header","name":"headers","values":[{"displayName":"Name","name":"name","type":"string","default":""},{"displayName":"Value","name":"value","type":"string","typeOptions":{"password":true},"default":""}]}]}],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/credentials/icons/customModelEndpoint.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/credentials/icons/customModelEndpoint.dark.svg"},"supportedNodes":[],"authenticate":{}},
|
|
11
12
|
{"name":"daytonaApi","displayName":"Daytona","documentationUrl":"daytona","properties":[{"displayName":"API URL","name":"apiUrl","type":"string","required":true,"default":""},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"supportedNodes":[]},
|
|
12
13
|
{"name":"deepSeekApi","displayName":"DeepSeek","documentationUrl":"deepseek","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.deepseek.com"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/models"}},"supportedNodes":["lmChatDeepSeek"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatDeepSeek/deepseek.svg"},
|
|
13
14
|
{"name":"googlePalmApi","displayName":"Google Gemini(PaLM) Api","documentationUrl":"google","properties":[{"displayName":"Host","name":"host","required":true,"type":"string","default":"https://generativelanguage.googleapis.com"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"qs":{"key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials.host}}/v1beta/models"}},"supportedNodes":["googleGemini","embeddingsGoogleGemini","lmChatGoogleGemini"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/GoogleGemini/gemini.svg"},
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
{"name":"groqApi","displayName":"Groq","documentationUrl":"groq","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"https://api.groq.com/openai/v1","url":"/models"}},"supportedNodes":["lmChatGroq"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatGroq/groq.svg"},
|
|
16
17
|
{"name":"huggingFaceApi","displayName":"Hugging Face API","documentationUrl":"huggingface","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"https://huggingface.co","url":"/api/whoami-v2"}},"supportedNodes":["embeddingsHuggingFaceInference","lmOpenHuggingFaceInference"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/huggingface.svg"},
|
|
17
18
|
{"name":"microsoftAgent365Api","displayName":"Microsoft 365 Agent API","documentationUrl":"microsoftagent365","properties":[{"displayName":"Tenant ID","name":"tenantId","type":"string","required":true,"default":""},{"displayName":"Client ID","name":"clientId","type":"string","required":true,"default":""},{"displayName":"Client Secret","name":"clientSecret","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"supportedNodes":["microsoftAgent365Trigger"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/Microsoft/Agent365.svg"},
|
|
18
|
-
{"name":"mcpOAuth2Api","extends":["oAuth2Api"],"displayName":"MCP OAuth2 API","documentationUrl":"mcp","properties":[{"displayName":"
|
|
19
|
+
{"name":"mcpOAuth2Api","extends":["oAuth2Api"],"displayName":"MCP OAuth2 API","documentationUrl":"mcp","properties":[{"displayName":"Register Client Automatically","name":"useDynamicClientRegistration","type":"boolean","default":true,"description":"When on, n8n identifies itself automatically: it uses a Client ID Metadata Document (CIMD) when the server supports CIMD, S256 PKCE, and public clients, and your instance has CIMD enabled; otherwise it uses Dynamic Client Registration (DCR). CIMD does not send a registration request. Turn it off if the provider gives you a fixed client ID and secret, requires you to register a redirect URL, or doesn't support automatic registration."},{"displayName":"Resource URL","name":"resourceUrl","type":"string","typeOptions":{"url":true},"default":"","description":"Optional. The exact protected resource URL required by the MCP server. Leave empty to use the server's default, discovered automatically."}],"supportedNodes":["mcpClient","mcpClientTool","mcpRegistryClientTool"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/mcp/mcp.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/mcp/mcp.dark.svg"}},
|
|
19
20
|
{"name":"milvusApi","displayName":"Milvus","documentationUrl":"milvus","properties":[{"displayName":"Base URL","name":"baseUrl","required":true,"type":"string","default":"http://localhost:19530"},{"displayName":"Username","name":"username","type":"string","default":""},{"displayName":"Password","name":"password","type":"string","typeOptions":{"password":true},"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.username}}:{{$credentials.password}}"}}},"test":{"request":{"baseURL":"={{ $credentials.baseUrl }}","url":"/v1/vector/collections","method":"GET"}},"supportedNodes":["vectorStoreMilvus"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-black.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreMilvus/milvus-icon-white.svg"}},
|
|
20
21
|
{"name":"mistralCloudApi","displayName":"Mistral Cloud API","documentationUrl":"mistral","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"https://api.mistral.ai/v1","url":"/models","method":"GET"}},"supportedNodes":["embeddingsMistralCloud","lmChatMistralCloud"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsMistralCloud/mistral.svg"},
|
|
21
22
|
{"name":"minimaxApi","displayName":"MiniMax","documentationUrl":"minimax","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Region","name":"region","type":"options","options":[{"name":"International","value":"international","description":"platform.minimax.io - international endpoint"},{"name":"China","value":"china","description":"platform.minimaxi.com - mainland China endpoint"}],"default":"international"},{"displayName":"Base URL","name":"url","type":"hidden","default":"={{ $self.region === \"china\" ? \"https://api.minimaxi.com/v1\" : \"https://api.minimax.io/v1\" }}"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/files/list","qs":{"purpose":"voice_clone"}},"rules":[{"type":"responseSuccessBody","properties":{"key":"base_resp.status_code","value":1004,"message":"Authentication failed. Please check your API key."}},{"type":"responseSuccessBody","properties":{"key":"base_resp.status_code","value":2049,"message":"Invalid API key. Please verify your key matches the selected region."}}]},"supportedNodes":["minimax","lmChatMinimax"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/MiniMax/minimax.svg"},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ICredentialDataDecryptedObject, type IExecuteFunctions, type ILoadOptionsFunctions, type ISupplyDataFunctions, type NodeEgressFilter } from 'n8n-workflow';
|
|
2
|
+
import type { EndpointCredential } from './types';
|
|
3
|
+
export type CustomModelEndpointFetchContext = IExecuteFunctions | ISupplyDataFunctions | ILoadOptionsFunctions;
|
|
4
|
+
export declare function createCustomModelEndpointAuthFetch(ctx: CustomModelEndpointFetchContext, credential: ICredentialDataDecryptedObject, options: {
|
|
5
|
+
endpoint: EndpointCredential;
|
|
6
|
+
egressFilter: NodeEgressFilter;
|
|
7
|
+
baseFetch: typeof fetch;
|
|
8
|
+
requestHeaders?: Record<string, string>;
|
|
9
|
+
}): typeof fetch;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCustomModelEndpointAuthFetch = createCustomModelEndpointAuthFetch;
|
|
4
|
+
const ai_utilities_1 = require("@n8n/ai-utilities");
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const headers_1 = require("./headers");
|
|
7
|
+
function withoutInheritedAuthorization(input, init) {
|
|
8
|
+
const source = init?.headers ?? (input instanceof Request ? input.headers : undefined);
|
|
9
|
+
if (source === undefined)
|
|
10
|
+
return { input, init };
|
|
11
|
+
const headers = new Headers(source);
|
|
12
|
+
if (!headers.has('authorization'))
|
|
13
|
+
return { input, init };
|
|
14
|
+
headers.delete('authorization');
|
|
15
|
+
return { input, init: { ...init, headers } };
|
|
16
|
+
}
|
|
17
|
+
function createCustomModelEndpointAuthFetch(ctx, credential, options) {
|
|
18
|
+
const { endpoint, egressFilter, baseFetch, requestHeaders } = options;
|
|
19
|
+
const node = ctx.getNode();
|
|
20
|
+
const allowedDomains = (0, n8n_workflow_1.getCredentialAllowedDomains)({
|
|
21
|
+
node,
|
|
22
|
+
credentialData: credential,
|
|
23
|
+
credentialOwnedSurface: true,
|
|
24
|
+
nodeEndpointUrl: endpoint.baseUrl,
|
|
25
|
+
});
|
|
26
|
+
const authFetch = (0, ai_utilities_1.createRefreshingAuthFetch)({
|
|
27
|
+
baseFetch,
|
|
28
|
+
resolveHeaders: async () => (0, headers_1.buildRequestHeaders)({ endpoint, requestHeaders }),
|
|
29
|
+
assertAllowedUrl: async (hopUrl) => {
|
|
30
|
+
(0, n8n_workflow_1.assertUrlAllowed)({ url: hopUrl, allowedDomains, node });
|
|
31
|
+
if (!egressFilter)
|
|
32
|
+
return;
|
|
33
|
+
const result = await egressFilter.validateUrl(hopUrl);
|
|
34
|
+
if (!result.ok)
|
|
35
|
+
throw result.error;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return async (input, init) => {
|
|
39
|
+
const stripped = withoutInheritedAuthorization(input, init);
|
|
40
|
+
return await authFetch(stripped.input, stripped.init);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=auth-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-fetch.js","sourceRoot":"","sources":["../../../utils/custom-model-endpoint/auth-fetch.ts"],"names":[],"mappings":";;;AAAA,oDAA8D;AAC9D,+CAQsB;AAEtB,uCAAgD;AAShD,SAAS,6BAA6B,CACrC,KAAwB,EACxB,IAA6B;IAE7B,MAAM,MAAM,GAAG,IAAI,EAAE,OAAO,IAAI,CAAC,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACvF,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAE1D,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,4CACC,GAAoC,EACpC,UAA0C,EAC1C,OAKC;IAED,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACtE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3B,MAAM,cAAc,GAAG,IAAA,0CAA2B,EAAC;QAClD,IAAI;QACJ,cAAc,EAAE,UAAU;QAC1B,sBAAsB,EAAE,IAAI;QAC5B,eAAe,EAAE,QAAQ,CAAC,OAAO;KACjC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAA,wCAAyB,EAAC;QAC3C,SAAS;QACT,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,6BAAmB,EAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;QAC7E,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAClC,IAAA,+BAAgB,EAAC,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;YACxD,IAAI,CAAC,YAAY;gBAAE,OAAO;YAC1B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,MAAM,MAAM,CAAC,KAAK,CAAC;QACpC,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC5B,MAAM,QAAQ,GAAG,6BAA6B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,MAAM,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EndpointCredential } from './types';
|
|
2
|
+
export type CustomModelEndpointCredentialData = {
|
|
3
|
+
url?: string;
|
|
4
|
+
authentication?: 'bearer' | 'header' | 'basic' | 'none';
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
authHeaderName?: string;
|
|
7
|
+
authHeaderPrefix?: string;
|
|
8
|
+
username?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
gatewayHeaders?: {
|
|
11
|
+
headers?: Array<{
|
|
12
|
+
name?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function readCustomModelEndpointCredential(data: CustomModelEndpointCredentialData): EndpointCredential;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readCustomModelEndpointCredential = readCustomModelEndpointCredential;
|
|
4
|
+
const normalizeEndpoint_1 = require("../normalizeEndpoint");
|
|
5
|
+
function readLoginMethod(data) {
|
|
6
|
+
switch (data.authentication) {
|
|
7
|
+
case 'header':
|
|
8
|
+
return {
|
|
9
|
+
type: 'header',
|
|
10
|
+
name: data.authHeaderName?.trim() ?? '',
|
|
11
|
+
prefix: data.authHeaderPrefix?.trim() ?? '',
|
|
12
|
+
key: data.apiKey?.trim() ?? '',
|
|
13
|
+
};
|
|
14
|
+
case 'basic':
|
|
15
|
+
return {
|
|
16
|
+
type: 'basic',
|
|
17
|
+
username: data.username?.trim() ?? '',
|
|
18
|
+
password: data.password ?? '',
|
|
19
|
+
};
|
|
20
|
+
case 'none':
|
|
21
|
+
return { type: 'none' };
|
|
22
|
+
default:
|
|
23
|
+
return { type: 'bearer', token: data.apiKey?.trim() ?? '' };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function readCustomModelEndpointCredential(data) {
|
|
27
|
+
const gatewayHeaders = (data.gatewayHeaders?.headers ?? []).flatMap(({ name, value }) => {
|
|
28
|
+
const headerName = name?.trim();
|
|
29
|
+
return headerName ? [[headerName, value ?? '']] : [];
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
baseUrl: (0, normalizeEndpoint_1.normalizeEndpoint)(data.url) ?? '',
|
|
33
|
+
login: readLoginMethod(data),
|
|
34
|
+
gatewayHeaders: Object.fromEntries(gatewayHeaders),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=credential-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-data.js","sourceRoot":"","sources":["../../../utils/custom-model-endpoint/credential-data.ts"],"names":[],"mappings":";;;AACA,4DAAyD;AAazD,SAAS,eAAe,CAAC,IAAuC;IAC/D,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7B,KAAK,QAAQ;YACZ,OAAO;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;gBACvC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE;gBAC3C,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;aAC9B,CAAC;QACH,KAAK,OAAO;YACX,OAAO;gBACN,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;gBAErC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;aAC7B,CAAC;QACH,KAAK,MAAM;YACV,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzB;YACC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;IAC9D,CAAC;AACF,CAAC;AAED,2CACC,IAAuC;IAEvC,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAClE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACnB,MAAM,UAAU,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtD,CAAC,CACD,CAAC;IAEF,OAAO;QACN,OAAO,EAAE,IAAA,qCAAiB,EAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;QAC1C,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC;KAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
import type { EndpointCredential } from './types';
|
|
3
|
+
export declare function toHeaderRecord(headers: IDataObject | undefined): Record<string, string>;
|
|
4
|
+
export declare function buildRequestHeaders(options: {
|
|
5
|
+
endpoint: Pick<EndpointCredential, 'login' | 'gatewayHeaders'>;
|
|
6
|
+
requestHeaders?: Record<string, string>;
|
|
7
|
+
}): Record<string, string>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toHeaderRecord = toHeaderRecord;
|
|
4
|
+
exports.buildRequestHeaders = buildRequestHeaders;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
function getLoginHeader(login) {
|
|
7
|
+
switch (login.type) {
|
|
8
|
+
case 'bearer':
|
|
9
|
+
return { Authorization: `Bearer ${login.token}` };
|
|
10
|
+
case 'header':
|
|
11
|
+
return { [login.name]: login.prefix ? `${login.prefix} ${login.key}` : login.key };
|
|
12
|
+
case 'basic':
|
|
13
|
+
return {
|
|
14
|
+
Authorization: `Basic ${Buffer.from(`${login.username}:${login.password}`).toString('base64')}`,
|
|
15
|
+
};
|
|
16
|
+
case 'none':
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function toHeaderRecord(headers) {
|
|
21
|
+
return Object.fromEntries(Object.entries(headers ?? {})
|
|
22
|
+
.filter(([, value]) => ['string', 'number', 'boolean'].includes(typeof value))
|
|
23
|
+
.map(([name, value]) => [name, String(value)]));
|
|
24
|
+
}
|
|
25
|
+
function buildRequestHeaders(options) {
|
|
26
|
+
const { endpoint, requestHeaders = {} } = options;
|
|
27
|
+
const headers = new Headers();
|
|
28
|
+
[endpoint.gatewayHeaders, requestHeaders, getLoginHeader(endpoint.login)]
|
|
29
|
+
.flatMap((layer) => Object.entries(layer))
|
|
30
|
+
.forEach(([name, value]) => {
|
|
31
|
+
try {
|
|
32
|
+
headers.set(name, value);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new n8n_workflow_1.UserError(`The header "${name}" is not valid`, {
|
|
36
|
+
description: 'Check the name and the value of the header.',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return Object.fromEntries(headers);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../utils/custom-model-endpoint/headers.ts"],"names":[],"mappings":";;;;AACA,+CAAyC;AAIzC,SAAS,cAAc,CAAC,KAAkB;IACzC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACZ,OAAO,EAAE,aAAa,EAAE,UAAU,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QACnD,KAAK,QAAQ;YACZ,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACpF,KAAK,OAAO;YACX,OAAO;gBACN,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;aAC/F,CAAC;QACH,KAAK,MAAM;YACV,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC;AAED,wBAA+B,OAAgC;IAC9D,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;SAC7E,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/C,CAAC;AACH,CAAC;AAGD,6BAAoC,OAGnC;IACA,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAElD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACvE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SACzC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QAC1B,IAAI,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YAER,MAAM,IAAI,wBAAS,CAAC,eAAe,IAAI,gBAAgB,EAAE;gBACxD,WAAW,EAAE,6CAA6C;aAC1D,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;IAEJ,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type LoginMethod = {
|
|
2
|
+
type: 'none';
|
|
3
|
+
} | {
|
|
4
|
+
type: 'bearer';
|
|
5
|
+
token: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'header';
|
|
8
|
+
name: string;
|
|
9
|
+
prefix: string;
|
|
10
|
+
key: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'basic';
|
|
13
|
+
username: string;
|
|
14
|
+
password: string;
|
|
15
|
+
};
|
|
16
|
+
export interface EndpointCredential {
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
login: LoginMethod;
|
|
19
|
+
gatewayHeaders: Record<string, string>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../utils/custom-model-endpoint/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeEndpoint.js","sourceRoot":"","sources":["../../utils/normalizeEndpoint.ts"],"names":[],"mappings":";;;AAKA,2BAAkC,QAA4B;IAC7D,OAAO,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/n8n-nodes-langchain",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"dist/credentials/ChromaSelfHostedApi.credentials.js",
|
|
41
41
|
"dist/credentials/ChromaCloudApi.credentials.js",
|
|
42
42
|
"dist/credentials/CohereApi.credentials.js",
|
|
43
|
+
"dist/credentials/CustomModelEndpointApi.credentials.js",
|
|
43
44
|
"dist/credentials/DaytonaApi.credentials.js",
|
|
44
45
|
"dist/credentials/DeepSeekApi.credentials.js",
|
|
45
46
|
"dist/credentials/GooglePalmApi.credentials.js",
|
|
@@ -178,8 +179,8 @@
|
|
|
178
179
|
]
|
|
179
180
|
},
|
|
180
181
|
"devDependencies": {
|
|
181
|
-
"@n8n/eslint-plugin-community-nodes": "1.0
|
|
182
|
-
"@n8n/vitest-config": "2.0
|
|
182
|
+
"@n8n/eslint-plugin-community-nodes": "1.1.0",
|
|
183
|
+
"@n8n/vitest-config": "2.1.0",
|
|
183
184
|
"@typescript-eslint/typescript-estree": "8.70.0",
|
|
184
185
|
"@types/basic-auth": "^1.1.3",
|
|
185
186
|
"@types/express": "^5.0.1",
|
|
@@ -205,7 +206,7 @@
|
|
|
205
206
|
"@aws-sdk/credential-providers": "3.808.0",
|
|
206
207
|
"@azure/identity": "4.13.0",
|
|
207
208
|
"@azure/search-documents": "12.1.0",
|
|
208
|
-
"@google-cloud/resource-manager": "
|
|
209
|
+
"@google-cloud/resource-manager": "6.0.1",
|
|
209
210
|
"@google/genai": "1.19.0",
|
|
210
211
|
"@google/generative-ai": "0.24.0",
|
|
211
212
|
"@huggingface/inference": "4.0.5",
|
|
@@ -230,21 +231,21 @@
|
|
|
230
231
|
"@langchain/redis": "1.1.1",
|
|
231
232
|
"@langchain/textsplitters": "1.0.1",
|
|
232
233
|
"@langchain/weaviate": "1.0.1",
|
|
233
|
-
"@microsoft/agents-a365-observability": "1.0.0",
|
|
234
234
|
"@microsoft/agents-a365-runtime": "1.0.0",
|
|
235
235
|
"@microsoft/agents-a365-tooling": "1.0.0",
|
|
236
236
|
"@microsoft/agents-activity": "1.6.1",
|
|
237
237
|
"@microsoft/agents-hosting": "1.6.1",
|
|
238
|
+
"@microsoft/opentelemetry": "1.5.0",
|
|
238
239
|
"@mistralai/mistralai": "^2.2.1",
|
|
239
|
-
"@modelcontextprotocol/sdk": "1.
|
|
240
|
+
"@modelcontextprotocol/sdk": "1.32.0",
|
|
240
241
|
"@mozilla/readability": "^0.6.0",
|
|
241
|
-
"@n8n/ai-utilities": "1.0
|
|
242
|
-
"@n8n/client-oauth2": "2.0
|
|
243
|
-
"@n8n/config": "3.0
|
|
244
|
-
"@n8n/di": "1.0
|
|
245
|
-
"@n8n/json-schema-to-zod": "2.0
|
|
246
|
-
"@n8n/typescript-config": "2.0
|
|
247
|
-
"@n8n/utils": "2.0
|
|
242
|
+
"@n8n/ai-utilities": "1.1.0",
|
|
243
|
+
"@n8n/client-oauth2": "2.1.0",
|
|
244
|
+
"@n8n/config": "3.1.0",
|
|
245
|
+
"@n8n/di": "1.1.0",
|
|
246
|
+
"@n8n/json-schema-to-zod": "2.1.0",
|
|
247
|
+
"@n8n/typescript-config": "2.1.0",
|
|
248
|
+
"@n8n/utils": "2.1.0",
|
|
248
249
|
"@oracle/langchain-oracledb": "0.2.0",
|
|
249
250
|
"@pinecone-database/pinecone": "^5.0.2",
|
|
250
251
|
"@qdrant/js-client-rest": "^1.19.0",
|
|
@@ -271,9 +272,9 @@
|
|
|
271
272
|
"mime-types": "3.0.2",
|
|
272
273
|
"mongodb": "^6.17.0",
|
|
273
274
|
"mysql2": "3.23.1",
|
|
274
|
-
"n8n-core": "3.0
|
|
275
|
-
"n8n-nodes-base": "3.0
|
|
276
|
-
"n8n-workflow": "3.0
|
|
275
|
+
"n8n-core": "3.1.0",
|
|
276
|
+
"n8n-nodes-base": "3.1.0",
|
|
277
|
+
"n8n-workflow": "3.1.0",
|
|
277
278
|
"openai": "6.46.0",
|
|
278
279
|
"oracledb": "6.10.0",
|
|
279
280
|
"pg": "8.21.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeEndpoint.js","sourceRoot":"","sources":["../../../../../nodes/llms/LmChatAzureOpenAi/credentials/normalizeEndpoint.ts"],"names":[],"mappings":";;;AAKA,2BAAkC,QAA4B;IAC7D,OAAO,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
File without changes
|
|
File without changes
|