Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

153 lines
3.0 KiB
TypeScript

import type {
GenerateContentConfig,
GenerationConfig,
GenerateContentParameters,
} from '@google/genai';
import type { IDataObject } from 'n8n-workflow';
export { Modality } from '@google/genai';
/* type created based on: https://ai.google.dev/api/generate-content#generationconfig */
export type GenerateContentGenerationConfig = Pick<
GenerationConfig,
| 'stopSequences'
| 'responseMimeType'
| 'responseSchema'
| 'responseJsonSchema'
| 'responseModalities'
| 'candidateCount'
| 'maxOutputTokens'
| 'temperature'
| 'topP'
| 'topK'
| 'seed'
| 'presencePenalty'
| 'frequencyPenalty'
| 'responseLogprobs'
| 'logprobs'
| 'speechConfig'
| 'thinkingConfig'
| 'mediaResolution'
>;
/* Type created based on: https://ai.google.dev/api/generate-content#method:-models.streamgeneratecontent */
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 type Part =
| { text: string }
| {
inlineData: {
mimeType: string;
data: string;
};
}
| {
functionCall: {
id?: string;
name: string;
args?: IDataObject;
};
}
| {
functionResponse: {
id?: string;
name: string;
response: IDataObject;
};
}
| {
fileData?: {
mimeType?: string;
fileUri?: string;
};
};
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;
};
}>;
};
};
}
/**
* File Search operation interface for long-running upload operations
* Based on: https://ai.google.dev/api/file-search/file-search-stores#method:-media.uploadtofilesearchstore
*/
export interface FileSearchOperation {
name: string;
done: boolean;
error?: { message: string };
response?: IDataObject;
}
/**
* User configuration for built-in tools in the node parameters
*/
export interface BuiltInTools {
googleSearch?: boolean;
googleMaps?: {
latitude?: number | string;
longitude?: number | string;
};
urlContext?: boolean;
fileSearch?: {
fileSearchStoreNames?: string;
metadataFilter?: string;
};
codeExecution?: boolean;
}
/**
* Tool structure for the Google Gemini API request
*/
export interface Tool {
functionDeclarations?: Array<{
name: string;
description: string;
parameters: IDataObject;
}>;
googleSearch?: object;
googleMaps?: object;
urlContext?: object;
fileSearch?: {
fileSearchStoreNames?: string[];
metadataFilter?: string;
};
codeExecution?: object;
}