@n8n/n8n-nodes-langchain
Version:

111 lines (110 loc) • 3.1 kB
TypeScript
import type { GenerateContentConfig, GenerationConfig, GenerateContentParameters } from '@google/genai';
import type { IDataObject } from 'n8n-workflow';
export { Modality } from '@google/genai';
export type GenerateContentGenerationConfig = Pick<GenerationConfig, 'stopSequences' | 'responseMimeType' | 'responseSchema' | 'responseJsonSchema' | 'responseModalities' | 'candidateCount' | 'maxOutputTokens' | 'temperature' | 'topP' | 'topK' | 'seed' | 'presencePenalty' | 'frequencyPenalty' | 'responseLogprobs' | 'logprobs' | 'speechConfig' | 'thinkingConfig' | 'mediaResolution'>;
export interface GenerateContentRequest extends IDataObject {
contents: GenerateContentParameters['contents'];
tools?: GenerateContentConfig['tools'];
toolConfig?: GenerateContentConfig['toolConfig'];
systemInstruction?: GenerateContentConfig['systemInstruction'];
safetySettings?: GenerateContentConfig['safetySettings'];
generationConfig?: GenerateContentGenerationConfig;
cachedContent?: string;
}
export interface GenerateContentResponse {
candidates: Array<{
content: Content;
}>;
}
export interface Content {
parts: Part[];
role: string;
}
export interface TextPart {
text: string;
}
export interface InlineDataPart {
inlineData: {
mimeType: string;
data: string;
};
}
export interface FunctionCallPart {
functionCall: {
id?: string;
name: string;
args?: IDataObject;
};
}
export interface FunctionResponsePart {
functionResponse: {
id?: string;
name: string;
response: IDataObject;
};
}
export interface FileDataPart {
fileData?: {
mimeType?: string;
fileUri?: string;
};
}
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
export interface ImagenResponse {
predictions: Array<{
bytesBase64Encoded: string;
mimeType: string;
}>;
}
export interface VeoResponse {
name: string;
done: boolean;
error?: {
message: string;
};
response: {
generateVideoResponse: {
generatedSamples: Array<{
video: {
uri: string;
};
}>;
};
};
}
export interface FileSearchOperation {
name: string;
done: boolean;
error?: {
message: string;
};
response?: IDataObject;
}
export interface BuiltInTools {
googleSearch?: boolean;
googleMaps?: {
latitude?: number | string;
longitude?: number | string;
};
urlContext?: boolean;
fileSearch?: {
fileSearchStoreNames?: string;
metadataFilter?: string;
};
codeExecution?: boolean;
}
export interface Tool {
functionDeclarations?: Array<{
name: string;
description: string;
parameters: IDataObject;
}>;
googleSearch?: object;
googleMaps?: object;
urlContext?: object;
fileSearch?: {
fileSearchStoreNames?: string[];
metadataFilter?: string;
};
codeExecution?: object;
}