@n8n/n8n-nodes-langchain
Version:
90 lines (84 loc) • 4.54 kB
text/typescript
/**
* Anthropic Chat Model Node - Version 1.2
* Language Model Anthropic
*/
export interface LcLmChatAnthropicV12Params {
/**
* The model which will generate the completion. <a href="https://docs.anthropic.com/claude/docs/models-overview">Learn more</a>.
* @builderHint This node version only offers superseded Claude models. Pick claude-3-5-sonnet-20241022 if the node has to stay on this version; otherwise rebuild it on the latest node version, where the current Claude generation is selectable.
* @default claude-3-5-sonnet-20240620
*/
model?: 'claude-3-5-sonnet-20241022' | 'claude-3-opus-20240229' | 'claude-3-5-sonnet-20240620' | 'claude-3-sonnet-20240229' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | Expression<string>;
/**
* Additional options to add
* @default {}
*/
options?: {
/** The maximum number of tokens to generate in the completion
* @default 4096
*/
maxTokensToSample?: number | Expression<number>;
/** Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive. Not supported on newer Anthropic models (Claude Opus 4.7+, Claude Sonnet 5+) — ignored there.
* @displayOptions.hide { thinking: [true], thinkingMode: ["adaptive", "manual"] }
* @default 0.7
*/
temperature?: number | Expression<number>;
/** Used to remove "long tail" low probability responses. Defaults to -1, which disables it. Not supported on newer Anthropic models (Claude Opus 4.7+, Claude Sonnet 5+) — ignored there.
* @displayOptions.hide { thinking: [true], thinkingMode: ["adaptive", "manual"] }
* @default -1
*/
topK?: 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. Not supported on newer Anthropic models (Claude Opus 4.7+, Claude Sonnet 5+) — ignored there.
* @displayOptions.hide { thinking: [true], thinkingMode: ["adaptive", "manual"] }
* @default 1
*/
topP?: number | Expression<number>;
/** Whether to enable thinking mode for the model
* @default false
*/
thinking?: boolean | Expression<boolean>;
/** The maximum number of tokens to use for thinking
* @displayOptions.show { thinking: [true] }
* @default 1024
*/
thinkingBudget?: number | Expression<number>;
/** How extended thinking is configured. Leave the option unset to use the model default.
* @default disabled
*/
thinkingMode?: 'disabled' | 'adaptive' | 'manual' | Expression<string>;
/** Effort level for adaptive thinking
* @displayOptions.show { thinkingMode: ["adaptive"], /model.value: [{"_cnd":{"includes":"opus"}}] }
* @default medium
*/
effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | Expression<string>;
/** Effort level for adaptive thinking
* @displayOptions.show { thinkingMode: ["adaptive"], /model.value: [{"_cnd":{"regex":"^(?!.*opus).*"}}] }
* @default medium
*/
effort?: 'low' | 'medium' | 'high' | Expression<string>;
/** Maximum tokens used for thinking. Manual mode is rejected by Opus 4.7+.
* @displayOptions.show { thinkingMode: ["manual"] }
* @default 1024
*/
thinkingBudget?: number | Expression<number>;
/** Whether the model should stream its response over Server-Sent Events instead of returning a single non-streamed payload. Final output shape is unchanged.
* @default false
*/
streaming?: boolean | Expression<boolean>;
/** Whether to cache the system prompt, tool definitions, and conversation history between requests using <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic prompt caching</a>. The value sets how long cached content stays valid before it has to be written again.
* @default disabled
*/
promptCaching?: 'disabled' | '5m' | '1h' | Expression<string>;
};
}
export interface LcLmChatAnthropicV12Credentials {
anthropicApi: CredentialReference;
}
interface LcLmChatAnthropicV12NodeBase {
type: '@n8n/n8n-nodes-langchain.lmChatAnthropic';
version: 1.2;
}
export type LcLmChatAnthropicV12ParamsNode = LcLmChatAnthropicV12NodeBase & {
config: NodeConfig<LcLmChatAnthropicV12Params> & { credentials?: LcLmChatAnthropicV12Credentials };
};
export type LcLmChatAnthropicV12Node = LcLmChatAnthropicV12ParamsNode;