@n8n/n8n-nodes-langchain
Version:

83 lines (82 loc) • 2.63 kB
TypeScript
import type { AIMessage } from '@langchain/core/messages';
import type { IDataObject, GenericValue } from 'n8n-workflow';
import type { ZodType } from 'zod';
export type ToolCallRequest = {
tool: string;
toolInput: Record<string, unknown>;
toolCallId: string;
type?: string;
log?: string;
messageLog?: unknown[];
additionalKwargs?: Record<string, unknown>;
};
export type ToolCallData = {
action: {
tool: string;
toolInput: Record<string, unknown>;
log: string | number | true | object;
messageLog?: AIMessage[];
toolCallId: IDataObject | GenericValue | GenericValue[] | IDataObject[];
type: string | number | true | object;
};
observation: string;
};
export type AgentResult = {
output: string;
toolCalls?: ToolCallRequest[];
intermediateSteps?: ToolCallData[];
};
export type ThinkingContentBlock = {
type: 'thinking';
thinking: string;
signature: string;
};
export type RedactedThinkingContentBlock = {
type: 'redacted_thinking';
data: string;
};
export type ToolUseContentBlock = {
type: 'tool_use';
id: string;
name: string;
input: Record<string, unknown>;
};
export type GeminiThoughtSignatureBlock = {
thoughtSignature: string;
};
export type ContentBlock = ThinkingContentBlock | RedactedThinkingContentBlock | ToolUseContentBlock | GeminiThoughtSignatureBlock;
export type GoogleThinkingMetadata = {
thoughtSignature?: string;
};
export type AnthropicThinkingMetadata = {
thinkingContent?: string;
thinkingType?: 'thinking' | 'redacted_thinking';
thinkingSignature?: string;
};
export type HitlMetadata = {
gatedToolNodeName: string;
toolName: string;
originalInput: IDataObject;
};
export type ThinkingMetadata = {
google?: GoogleThinkingMetadata;
anthropic?: AnthropicThinkingMetadata;
};
export type RequestResponseMetadata = {
itemIndex?: number;
parentNodeName?: string;
previousRequests?: ToolCallData[];
iterationCount?: number;
google?: GoogleThinkingMetadata;
anthropic?: AnthropicThinkingMetadata;
hitl?: HitlMetadata;
};
export interface ToolMetadata extends Record<string, unknown> {
sourceNodeName?: string;
gatedToolNodeName?: string;
originalSchema?: ZodType;
isFromToolkit?: boolean;
}
export declare function isThinkingBlock(block: unknown): block is ThinkingContentBlock;
export declare function isRedactedThinkingBlock(block: unknown): block is RedactedThinkingContentBlock;
export declare function isGeminiThoughtSignatureBlock(block: unknown): block is GeminiThoughtSignatureBlock;