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

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,67 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { PromptResponse } from '../../helpers/interfaces';
import { apiRequest } from '../../transport';
const properties: INodeProperties[] = [
{
displayName: 'Task',
name: 'task',
type: 'string',
description: "Description of the prompt's purpose",
placeholder: 'e.g. A chef for a meal prep planning service',
default: '',
typeOptions: {
rows: 2,
},
},
{
displayName: 'Simplify Output',
name: 'simplify',
type: 'boolean',
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
];
const displayOptions = {
show: {
operation: ['generate'],
resource: ['prompt'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const task = this.getNodeParameter('task', i, '') as string;
const simplify = this.getNodeParameter('simplify', i, true) as boolean;
const body = {
task,
};
const response = (await apiRequest.call(this, 'POST', '/v1/experimental/generate_prompt', {
body,
enableAnthropicBetas: { promptTools: true },
})) as PromptResponse;
if (simplify) {
return [
{
json: {
messages: response.messages,
system: response.system,
},
pairedItem: { item: i },
},
];
}
return [
{
json: { ...response },
pairedItem: { item: i },
},
];
}
@@ -0,0 +1,135 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { Message, PromptResponse } from '../../helpers/interfaces';
import { apiRequest } from '../../transport';
const properties: INodeProperties[] = [
{
displayName: 'Messages',
name: 'messages',
type: 'fixedCollection',
typeOptions: {
sortable: true,
multipleValues: true,
},
description: 'Messages that constitute the prompt to be improved',
placeholder: 'Add Message',
default: { values: [{ content: '', role: 'user' }] },
options: [
{
displayName: 'Values',
name: 'values',
values: [
{
displayName: 'Prompt',
name: 'content',
type: 'string',
description: 'The content of the message to be sent',
default: '',
placeholder: 'e.g. Concise instructions for a meal prep service',
typeOptions: {
rows: 2,
},
},
{
displayName: 'Role',
name: 'role',
type: 'options',
description:
"Role in shaping the model's response, it tells the model how it should behave and interact with the user",
options: [
{
name: 'User',
value: 'user',
description: 'Send a message as a user and get a response from the model',
},
{
name: 'Assistant',
value: 'assistant',
description: 'Tell the model to adopt a specific tone or personality',
},
],
default: 'user',
},
],
},
],
},
{
displayName: 'Simplify Output',
name: 'simplify',
type: 'boolean',
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Options',
name: 'options',
placeholder: 'Add Option',
type: 'collection',
default: {},
options: [
{
displayName: 'System Message',
name: 'system',
type: 'string',
description: 'The existing system prompt to incorporate, if any',
default: '',
placeholder: 'e.g. You are a professional meal prep chef',
},
{
displayName: 'Feedback',
name: 'feedback',
type: 'string',
description: 'Feedback for improving the prompt',
default: '',
placeholder: 'e.g. Make it more detailed and include cooking times',
},
],
},
];
const displayOptions = {
show: {
operation: ['improve'],
resource: ['prompt'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const messages = this.getNodeParameter('messages.values', i, []) as Message[];
const simplify = this.getNodeParameter('simplify', i, true) as boolean;
const options = this.getNodeParameter('options', i, {});
const body = {
messages,
system: options.system,
feedback: options.feedback,
};
const response = (await apiRequest.call(this, 'POST', '/v1/experimental/improve_prompt', {
body,
enableAnthropicBetas: { promptTools: true },
})) as PromptResponse;
if (simplify) {
return [
{
json: {
messages: response.messages,
system: response.system,
},
pairedItem: { item: i },
},
];
}
return [
{
json: { ...response },
pairedItem: { item: i },
},
];
}
@@ -0,0 +1,57 @@
import type { INodeProperties } from 'n8n-workflow';
import * as generate from './generate.operation';
import * as improve from './improve.operation';
import * as templatize from './templatize.operation';
export { generate, improve, templatize };
export const description: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Generate Prompt',
value: 'generate',
action: 'Generate a prompt',
description: 'Generate a prompt for a model',
},
{
name: 'Improve Prompt',
value: 'improve',
action: 'Improve a prompt',
description: 'Improve a prompt for a model',
},
{
name: 'Templatize Prompt',
value: 'templatize',
action: 'Templatize a prompt',
description: 'Templatize a prompt for a model',
},
],
default: 'generate',
displayOptions: {
show: {
resource: ['prompt'],
},
},
},
{
displayName:
'The <a href="https://docs.anthropic.com/en/api/prompt-tools-generate">prompt tools APIs</a> are in a closed research preview. Your organization must request access to use them.',
name: 'experimentalNotice',
type: 'notice',
default: '',
displayOptions: {
show: {
resource: ['prompt'],
},
},
},
...generate.description,
...improve.description,
...templatize.description,
];
@@ -0,0 +1,127 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { Message, TemplatizeResponse } from '../../helpers/interfaces';
import { apiRequest } from '../../transport';
const properties: INodeProperties[] = [
{
displayName: 'Messages',
name: 'messages',
type: 'fixedCollection',
typeOptions: {
sortable: true,
multipleValues: true,
},
description: 'Messages that constitute the prompt to be templatized',
placeholder: 'Add Message',
default: { values: [{ content: '', role: 'user' }] },
options: [
{
displayName: 'Values',
name: 'values',
values: [
{
displayName: 'Prompt',
name: 'content',
type: 'string',
description: 'The content of the message to be sent',
default: '',
placeholder: 'e.g. Translate hello to German',
typeOptions: {
rows: 2,
},
},
{
displayName: 'Role',
name: 'role',
type: 'options',
description:
"Role in shaping the model's response, it tells the model how it should behave and interact with the user",
options: [
{
name: 'User',
value: 'user',
description: 'Send a message as a user and get a response from the model',
},
{
name: 'Assistant',
value: 'assistant',
description: 'Tell the model to adopt a specific tone or personality',
},
],
default: 'user',
},
],
},
],
},
{
displayName: 'Simplify Output',
name: 'simplify',
type: 'boolean',
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Options',
name: 'options',
placeholder: 'Add Option',
type: 'collection',
default: {},
options: [
{
displayName: 'System Message',
name: 'system',
type: 'string',
description: 'The existing system prompt to templatize',
default: '',
placeholder: 'e.g. You are a professional English to German translator',
},
],
},
];
const displayOptions = {
show: {
operation: ['templatize'],
resource: ['prompt'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const messages = this.getNodeParameter('messages.values', i, []) as Message[];
const simplify = this.getNodeParameter('simplify', i, true) as boolean;
const options = this.getNodeParameter('options', i, {});
const body = {
messages,
system: options.system,
};
const response = (await apiRequest.call(this, 'POST', '/v1/experimental/templatize_prompt', {
body,
enableAnthropicBetas: { promptTools: true },
})) as TemplatizeResponse;
if (simplify) {
return [
{
json: {
messages: response.messages,
system: response.system,
variable_values: response.variable_values,
},
pairedItem: { item: i },
},
];
}
return [
{
json: { ...response },
pairedItem: { item: i },
},
];
}