@n8n/n8n-nodes-langchain
Version:
214 lines (208 loc) • 9.54 kB
text/typescript
/**
* OpenAI Chat Model Node - Version 1.3
* Run GPT models, with optional Responses API for web search, file search, and code execution
*/
export interface LcLmChatOpenAiV13Params {
/**
* The model. Choose from the list, or specify an ID.
* @builderHint Keep a working or explicitly requested model unless provider evidence shows it is unavailable or unsuitable. When choosing a new model, select a current stable model supported by this node version, the configured API, and the required operation. Use the declared model-list lookup with the connected credential when available. Gateway credits can restrict that list. For a new choice without credentials, use current provider catalog information. Choose a model that fits the task and budget. Copy the exact model ID. Do not rely on node defaults, invent model IDs, or treat an unfamiliar model as invalid.
* @searchListMethod searchModels
* @default {"mode":"list","value":"gpt-5-mini"}
*/
model?: { __rl: true; mode: 'list' | 'id'; value: string; cachedResultName?: string };
/**
* Whether to use the Responses API to generate the response. <a href="https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/#use-responses-api">Learn more</a>.
* @default true
*/
responsesApiEnabled?: boolean | Expression<boolean>;
/**
* Built-in Tools
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default {}
*/
builtInTools?: {
/** Web Search
* @default {"searchContextSize":"medium"}
*/
webSearch?: {
/** High level guidance for the amount of context window space to use for the search
* @default medium
*/
searchContextSize?: 'low' | 'medium' | 'high' | Expression<string>;
/** Comma-separated list of domains to search. Only domains in this list will be searched.
*/
allowedDomains?: string | Expression<string>;
/** Country
*/
country?: string | Expression<string>;
/** City
*/
city?: string | Expression<string>;
/** Region
*/
region?: string | Expression<string>;
};
/** File Search
* @default {"vectorStoreIds":"[]"}
*/
fileSearch?: {
/** The vector store IDs to use for the file search. Vector stores are managed via OpenAI Dashboard. <a href="https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/#built-in-tools">Learn more</a>.
* @default []
*/
vectorStoreIds?: IDataObject | string | Expression<string>;
/** Filters
* @default {}
*/
filters?: IDataObject | string | Expression<string>;
/** Max Results
* @default 1
*/
maxResults?: number | Expression<number>;
};
/** Whether to allow the model to execute code in a sandboxed environment
* @default true
*/
codeInterpreter?: boolean | Expression<boolean>;
};
/**
* Additional options to add
* @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
*/
frequencyPenalty?: 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 -1
*/
maxTokens?: number | Expression<number>;
/** Response Format
* @displayOptions.show { /responsesApiEnabled: [false] }
* @default text
*/
responseFormat?: 'text' | 'json_object' | Expression<string>;
/** Response Format
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default {"textOptions":[{"type":"text"}]}
*/
textFormat?: {
/** Text
*/
textOptions?: {
/** Type
*/
type?: 'text' | 'json_schema' | 'json_object' | Expression<string>;
/** Verbosity
* @default medium
*/
verbosity?: 'low' | 'medium' | 'high' | Expression<string>;
/** The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
* @displayOptions.show { type: ["json_schema"] }
* @default my_schema
*/
name?: string | Expression<string>;
/** The schema of the response format
* @displayOptions.show { type: ["json_schema"] }
*/
schema?: IDataObject | string | Expression<string>;
/** The description of the response format
* @displayOptions.show { type: ["json_schema"] }
*/
description?: string | Expression<string>;
/** Whether to require that the AI will always generate responses that match the provided JSON Schema
* @displayOptions.show { type: ["json_schema"] }
* @default false
*/
strict?: boolean | Expression<boolean>;
};
};
/** 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
*/
presencePenalty?: number | Expression<number>;
/** Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.
* @default 0.7
*/
temperature?: 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 { /model: [{"_cnd":{"regex":"(^o1([-\\d]+)?$)|(^o[3-9].*)|(^gpt-5.*)"}}] }
* @default medium
*/
reasoningEffort?: 'low' | 'medium' | 'high' | Expression<string>;
/** Maximum amount of time a request is allowed to take in milliseconds
* @default 60000
*/
timeout?: number | Expression<number>;
/** Maximum number of retries to attempt
* @default 2
*/
maxRetries?: number | Expression<number>;
/** 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>;
/** Optional additional JSON properties to include in the request body when making requests to OpenAI-compatible APIs
* @default {}
*/
extraBody?: IDataObject | string | Expression<string>;
/** The conversation that this response belongs to. Input items and output items from this response are automatically added to this conversation after this response completes.
* @displayOptions.show { /responsesApiEnabled: [true] }
*/
conversationId?: string | Expression<string>;
/** Used by OpenAI to cache responses for similar requests to optimize your cache hit rates
* @displayOptions.show { /responsesApiEnabled: [true] }
*/
promptCacheKey?: string | Expression<string>;
/** A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* @displayOptions.show { /responsesApiEnabled: [true] }
*/
safetyIdentifier?: string | Expression<string>;
/** The service tier to use for the request
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default auto
*/
serviceTier?: 'auto' | 'flex' | 'default' | 'priority' | Expression<string>;
/** Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default {}
*/
metadata?: IDataObject | string | Expression<string>;
/** An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default 0
*/
topLogprobs?: number | Expression<number>;
/** Configure the reusable prompt template configured via OpenAI Dashboard. <a href="https://platform.openai.com/docs/guides/prompt-engineering#reusable-prompts">Learn more</a>.
* @displayOptions.show { /responsesApiEnabled: [true] }
* @default {"promptOptions":[{"promptId":""}]}
*/
promptConfig?: {
/** Prompt
*/
promptOptions?: {
/** The unique identifier of the prompt template to use
*/
promptId?: string | Expression<string>;
/** Optional version of the prompt template
*/
version?: string | Expression<string>;
/** Variables to be substituted into the prompt template
* @default {}
*/
variables?: IDataObject | string | Expression<string>;
};
};
};
}
export interface LcLmChatOpenAiV13Credentials {
openAiApi: CredentialReference;
}
interface LcLmChatOpenAiV13NodeBase {
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi';
version: 1.3;
}
export type LcLmChatOpenAiV13ParamsNode = LcLmChatOpenAiV13NodeBase & {
config: NodeConfig<LcLmChatOpenAiV13Params> & { credentials?: LcLmChatOpenAiV13Credentials };
};
export type LcLmChatOpenAiV13Node = LcLmChatOpenAiV13ParamsNode;