UNPKG

@n8n/n8n-nodes-langchain

Version:
100 lines (94 loc) 4.42 kB
/** * OpenRouter Chat Model Node - Version 1 * For advanced usage with an AI chain */ export interface LcLmChatOpenRouterV1Params { /** * The model which will generate the completion. &lt;a href="https://openrouter.ai/docs/models"&gt;Learn more&lt;/a&gt;. * @builderHint Default to a current flagship (e.g. openai/gpt-5.4, anthropic/claude-sonnet-4.6, google/gemini-3.1-pro-preview). Avoid openai/gpt-4o, anthropic/claude-3.x, and other pre-2026 models. * @default openai/gpt-4.1-mini */ model?: string | Expression<string>; /** * 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 * @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>; /** Maximum amount of time a request is allowed to take in milliseconds * @default 360000 */ 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>; /** Configure which sub-providers handle your requests. &lt;a href="https://openrouter.ai/docs/provider-routing"&gt;Learn more&lt;/a&gt;. * @default {} */ providerRouting?: { /** Comma-separated list of provider slugs to try in order. &lt;a href="https://openrouter.ai/docs/provider-routing#provider-sorting"&gt;Learn more&lt;/a&gt;. */ order?: string | Expression<string>; /** Whether to allow backup providers when the primary is unavailable * @default true */ allowFallbacks?: boolean | Expression<boolean>; /** Whether to only use providers that support all parameters in your request * @default false */ requireParameters?: boolean | Expression<boolean>; /** Select 'Deny' to route requests only through providers that don't collect your data * @default allow */ dataCollection?: 'allow' | 'deny' | Expression<string>; /** Whether to restrict routing to only providers with Zero Data Retention endpoints * @default false */ zdr?: boolean | Expression<boolean>; /** Comma-separated list of provider slugs to allow for this request. Only these providers will be used. &lt;a href="https://openrouter.ai/docs/guides/routing/provider-selection#allowing-only-specific-providers"&gt;Learn more&lt;/a&gt;. */ only?: string | Expression<string>; /** Comma-separated list of provider slugs to skip for this request */ ignore?: string | Expression<string>; /** Sort providers by a specific attribute. Disables load balancing and tries providers in order. &lt;a href="https://openrouter.ai/docs/provider-routing#provider-sorting"&gt;Learn more&lt;/a&gt;. */ sort?: 'price' | 'throughput' | 'latency' | Expression<string>; }; }; } export interface LcLmChatOpenRouterV1Credentials { openRouterApi: CredentialReference; } interface LcLmChatOpenRouterV1NodeBase { type: '@n8n/n8n-nodes-langchain.lmChatOpenRouter'; version: 1; } export type LcLmChatOpenRouterV1ParamsNode = LcLmChatOpenRouterV1NodeBase & { config: NodeConfig<LcLmChatOpenRouterV1Params> & { credentials?: LcLmChatOpenRouterV1Credentials }; }; export type LcLmChatOpenRouterV1Node = LcLmChatOpenRouterV1ParamsNode;