@n8n/n8n-nodes-langchain
Version:

105 lines (100 loc) • 4.48 kB
text/typescript
/**
* OpenAI Node - Version 1.3
* Discriminator: resource=text, operation=message
*/
interface Credentials {
openAiApi: CredentialReference;
}
/** Send messages to an assistant */
export type LcOpenAiV13TextMessageParams = {
resource: 'text';
operation: 'message';
/**
* Model
* @searchListMethod modelSearch
* @default {"mode":"list","value":""}
*/
modelId?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
* Messages
* @default {"values":[{"content":""}]}
*/
messages?: {
/** Values
*/
values?: Array<{
/** The content of the message to be send
*/
content?: string | Expression<string> | PlaceholderValue;
/** Role in shaping the model's response, it tells the model how it should behave and interact with the user
* @default user
*/
role?: 'user' | 'assistant' | 'system' | Expression<string>;
}>;
};
/**
* Whether to return a simplified version of the response instead of the raw data
* @default true
*/
simplify?: boolean | Expression<boolean>;
/**
* Whether to attempt to return the response in JSON format. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106.
* @default false
*/
jsonOutput?: boolean | Expression<boolean>;
/**
* Hide Tools
* @displayOptions.show { modelId: ["gpt-3.5-turbo-16k-0613", "dall-e-3", "text-embedding-3-large", "dall-e-2", "whisper-1", "tts-1-hd-1106", "tts-1-hd", "gpt-4-0314", "text-embedding-3-small", "gpt-4-32k-0314", "gpt-3.5-turbo-0301", "gpt-4-vision-preview", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-instruct-0914", "tts-1", "davinci-002", "gpt-3.5-turbo-instruct", "babbage-002", "tts-1-1106", "text-embedding-ada-002"] }
* @default hide
*/
hideTools?: unknown;
/**
* Options
* @default {}
*/
options?: {
/** Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim
* @default 0
*/
frequency_penalty?: number | Expression<number>;
/** The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 32,768).
* @default 16
*/
maxTokens?: number | Expression<number>;
/** How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.
* @default 1
*/
n?: number | Expression<number>;
/** Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics
* @default 0
*/
presence_penalty?: number | Expression<number>;
/** Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive. We generally recommend altering this or temperature but not both.
* @default 1
*/
temperature?: number | Expression<number>;
/** An alternative to sampling with temperature, controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.
* @default 1
*/
topP?: number | Expression<number>;
/** Controls the amount of reasoning tokens to use. A value of "low" will favor speed and economical token usage, "high" will favor more complete reasoning at the cost of more tokens generated and slower responses.
* @displayOptions.show { /modelId: [{"_cnd":{"regex":"(^o1([-\\d]+)?$)|(^o[3-9].*)|(^gpt-5.*)"}}] }
* @default medium
*/
reasoning_effort?: 'low' | 'medium' | 'high' | Expression<string>;
/** The maximum number of tool iteration cycles the LLM will run before stopping. A single iteration can contain multiple tool calls. Set to 0 for no limit.
* @default 15
*/
maxToolsIterations?: number | Expression<number>;
};
};
export interface LcOpenAiV13TextMessageSubnodeConfig {
tools?: ToolInstance[];
memory?: MemoryInstance;
}
export type LcOpenAiV13TextMessageNode = {
type: '@n8n/n8n-nodes-langchain.openAi';
version: 1.3;
credentials?: Credentials;
config: NodeConfig<LcOpenAiV13TextMessageParams> & { subnodes?: LcOpenAiV13TextMessageSubnodeConfig };
};