feat: Add AI tool building capabilities (#7336)

Github issue / Community forum post (link here to close automatically):
https://community.n8n.io/t/langchain-memory-chat/23733

---------

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Val <68596159+valya@users.noreply.github.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Deborah <deborah@starfallprojects.co.uk>
Co-authored-by: Jesper Bylund <mail@jesperbylund.com>
Co-authored-by: Jon <jonathan.bennetts@gmail.com>
Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: Giulio Andreini <andreini@netseven.it>
Co-authored-by: Mason Geloso <Mason.geloso@gmail.com>
Co-authored-by: Mason Geloso <hone@Masons-Mac-mini.local>
Co-authored-by: Mutasem Aldmour <mutasem@n8n.io>
This commit is contained in:
Jan Oberhauser
2023-11-29 12:13:55 +01:00
committed by GitHub
parent dbfd617ace
commit 87def60979
243 changed files with 21526 additions and 321 deletions

View File

@@ -0,0 +1,50 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class AnthropicApi implements ICredentialType {
name = 'anthropicApi';
displayName = 'Anthropic';
documentationUrl = 'anthropic';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'x-api-key': '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.anthropic.com',
url: '/v1/complete',
method: 'POST',
headers: {
'anthropic-version': '2023-06-01',
},
body: {
model: 'claude-2',
prompt: '\n\nHuman: Hello, world!\n\nAssistant:',
max_tokens_to_sample: 256,
},
},
};
}

View File

@@ -0,0 +1,45 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class CohereApi implements ICredentialType {
name = 'cohereApi';
displayName = 'CohereApi';
documentationUrl = 'cohere';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.cohere.ai',
url: '/v1/detect-language',
method: 'POST',
body: {
texts: ['hello'],
},
},
};
}

View File

@@ -0,0 +1,47 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class GooglePalmApi implements ICredentialType {
name = 'googlePalmApi';
displayName = 'GooglePaLMApi';
documentationUrl = 'googlePalm';
properties: INodeProperties[] = [
{
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: IAuthenticateGeneric = {
type: 'generic',
properties: {
qs: {
key: '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.host}}/v1beta3/models',
},
};
}

View File

@@ -0,0 +1,41 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class HuggingFaceApi implements ICredentialType {
name = 'huggingFaceApi';
displayName = 'HuggingFaceApi';
documentationUrl = 'huggingface';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api-inference.huggingface.co',
url: '/models/gpt2',
},
};
}

View File

@@ -0,0 +1,54 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class MotorheadApi implements ICredentialType {
name = 'motorheadApi';
displayName = 'MotorheadApi';
documentationUrl = 'motorhead';
properties: INodeProperties[] = [
{
displayName: 'Host',
name: 'host',
required: true,
type: 'string',
default: 'https://api.getmetal.io/v1',
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
{
displayName: 'Client ID',
name: 'clientId',
type: 'string',
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'x-metal-client-id': '={{$credentials.clientId}}',
'x-metal-api-key': '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.host}}/keys/current',
},
};
}

View File

@@ -0,0 +1,34 @@
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
export class OllamaApi implements ICredentialType {
name = 'ollamaApi';
displayName = 'Ollama';
documentationUrl = 'ollama';
properties: INodeProperties[] = [
{
displayName: 'Base URL',
name: 'baseUrl',
required: true,
type: 'string',
default: 'http://localhost:11434',
},
];
test: ICredentialTestRequest = {
request: {
baseURL: '={{ $credentials.baseUrl }}',
url: '/api/generate',
method: 'POST',
headers: {
'anthropic-version': '2023-06-01',
},
body: {
model: 'llama2',
prompt: 'Hello',
},
},
};
}

View File

@@ -0,0 +1,50 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class PineconeApi implements ICredentialType {
name = 'pineconeApi';
displayName = 'PineconeApi';
documentationUrl = 'pinecone';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
{
displayName: 'Environment',
name: 'environment',
type: 'string',
required: true,
default: 'us-central1-gcp',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'Api-Key': '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '=https://controller.{{$credentials.environment}}.pinecone.io/databases',
headers: {
accept: 'application/json; charset=utf-8',
},
},
};
}

View File

@@ -0,0 +1,41 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class SerpApi implements ICredentialType {
name = 'serpApi';
displayName = 'SerpAPI';
documentationUrl = 'serpapi';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
qs: {
api_key: '={{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://serpapi.com',
url: '/account.json ',
},
};
}

View File

@@ -0,0 +1,45 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class WolframAlphaApi implements ICredentialType {
name = 'wolframAlphaApi';
displayName = 'WolframAlphaApi';
documentationUrl = 'wolframalpha';
properties: INodeProperties[] = [
{
displayName: 'App ID',
name: 'appId',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
qs: {
api_key: '={{$credentials.appId}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.wolframalpha.com/v1',
url: '=/simple',
qs: {
i: 'How much is 1 1',
appid: '={{$credentials.appId}}',
},
},
};
}

View File

@@ -0,0 +1,55 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class XataApi implements ICredentialType {
name = 'xataApi';
displayName = 'Xata Api';
documentationUrl = 'xata';
properties: INodeProperties[] = [
{
displayName: 'Database Endpoint',
name: 'databaseEndpoint',
required: true,
type: 'string',
default: '',
placeholder: 'https://{workspace}.{region}.xata.sh/db/{database}',
},
{
displayName: 'Branch',
name: 'branch',
required: true,
type: 'string',
default: 'main',
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.databaseEndpoint}}:{{$credentials.branch}}',
},
};
}

View File

@@ -0,0 +1,48 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class ZepApi implements ICredentialType {
name = 'zepApi';
displayName = 'Zep Api';
documentationUrl = 'zep';
properties: INodeProperties[] = [
{
displayName: 'API URL',
name: 'apiUrl',
required: true,
type: 'string',
default: 'http://localhost:8000',
},
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: false,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '={{$credentials.apiKey ? "Bearer " + $credentials.apiKey : undefined }}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.apiUrl}}',
url: '/api/v1/collection',
},
};
}