@n8n/n8n-nodes-langchain
Version:

56 lines (51 loc) • 2.02 kB
text/typescript
/**
* Code Tool Node - Version 1.3
* Write a tool in JS or Python
*/
export interface LcToolCodeV13Params {
description?: string | Expression<string> | PlaceholderValue;
language?: 'javaScript' | 'python';
/**
* E.g. Converts any text to uppercase
* @hint You can access the input the tool receives via the input property "query". The returned value should be a single string.
* @displayOptions.show { language: ["javaScript"] }
*/
jsCode?: string;
/**
* E.g. Converts any text to uppercase
* @hint You can access the input the tool receives via the input property "_query". The returned value should be a single string.
* @displayOptions.show { language: ["python"] }
*/
pythonCode?: string;
/**
* Whether to specify the schema for the function. This would require the LLM to provide the input in the correct format and would validate it against the schema.
* @default false
*/
specifyInputSchema?: boolean;
/**
* How to specify the schema for the function
* @displayOptions.show { specifyInputSchema: [true] }
* @default fromJson
*/
schemaType?: 'fromJson' | 'manual';
/**
* Example JSON object to use to generate the schema
* @displayOptions.show { specifyInputSchema: [true], schemaType: ["fromJson"] }
*/
jsonSchemaExample?: IDataObject | string;
/**
* Schema to use for the function
* @hint Use <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format (<a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">examples</a>). $refs syntax is currently not supported.
* @displayOptions.show { specifyInputSchema: [true], schemaType: ["manual"] }
*/
inputSchema?: IDataObject | string | Expression<string>;
}
interface LcToolCodeV13NodeBase {
type: '@n8n/n8n-nodes-langchain.toolCode';
version: 1.3;
isTrigger: true;
}
export type LcToolCodeV13ParamsNode = LcToolCodeV13NodeBase & {
config: NodeConfig<LcToolCodeV13Params>;
};
export type LcToolCodeV13Node = LcToolCodeV13ParamsNode;