@n8n/n8n-nodes-langchain
Version:
80 lines (74 loc) • 3.86 kB
text/typescript
/**
* OpenAI Chat Model Node - Version 1
* Run GPT models, with optional Responses API for web search, file search, and code execution
*/
export interface LcLmChatOpenAiV1Params {
/**
* The model which will generate the completion. <a href="https://developers.openai.com/api/docs/models">Learn more</a>.
* @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.
* @default gpt-5-mini
*/
model?: string | Expression<string>;
/**
* Additional options to add
* @default {}
*/
options?: {
/** Override the default base URL for the API
* @default https://api.openai.com/v1
*/
baseURL?: string | Expression<string>;
/** 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
* @default text
*/
responseFormat?: 'text' | 'json_object' | Expression<string>;
/** 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>;
};
}
export interface LcLmChatOpenAiV1Credentials {
openAiApi: CredentialReference;
}
interface LcLmChatOpenAiV1NodeBase {
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi';
version: 1;
}
export type LcLmChatOpenAiV1ParamsNode = LcLmChatOpenAiV1NodeBase & {
config: NodeConfig<LcLmChatOpenAiV1Params> & { credentials?: LcLmChatOpenAiV1Credentials };
};
export type LcLmChatOpenAiV1Node = LcLmChatOpenAiV1ParamsNode;