UNPKG

crewai-ts

Version:

TypeScript port of crewAI for agent-based workflows

126 lines 2.77 kB
/** * Vision Tool Implementation * Provides image understanding capabilities for agents * with memory-efficient processing and performance optimizations */ type OpenAIClient = any; /** * Options for configuring the VisionTool */ export interface VisionToolOptions { /** * API key for OpenAI */ apiKey?: string; /** * Base URL for OpenAI API requests * @default 'https://api.openai.com/v1' */ baseUrl?: string; /** * Organization ID for OpenAI API requests */ organization?: string; /** * Custom OpenAI client instance */ client?: OpenAIClient; /** * Whether to cache results to reduce duplicate requests * @default true */ cacheResults?: boolean; /** * Maximum size of the result cache * @default 50 */ maxCacheSize?: number; /** * Cache TTL in milliseconds * @default 1800000 (30 minutes) */ cacheTtl?: number; /** * Retry configuration for API calls */ retry?: { maxRetries?: number; initialDelayMs?: number; maxDelayMs?: number; }; } /** * Vision analysis result */ export interface VisionResult { /** * Model used for analysis */ model: string; /** * The analysis text from the vision model */ analysis: string; /** * Structured analysis result if requested */ structuredAnalysis?: Record<string, any>; /** * The input prompt used for analysis */ prompt: string; /** * Error information if any */ error?: string; /** * Performance metrics */ metrics?: { /** * Processing time in milliseconds */ processingTimeMs: number; /** * Total tokens used */ totalTokens?: number; /** * Whether result was from cache */ fromCache: boolean; }; } /** * Creates an optimized Vision Tool for image analysis with memory efficiency */ export declare function createVisionTool(options?: VisionToolOptions): import("../StructuredTool.js").StructuredTool<{ temperature?: number; maxTokens?: number; model?: string; prompt?: string; image?: { type?: "url"; data?: { url?: string; }; } | { type?: "base64"; data?: { base64?: string; mimeType?: string; }; } | { type?: "path"; data?: { path?: string; }; }; detailLevel?: "low" | "high" | "auto"; responseFormat?: { type?: "text" | "json_object"; schema?: Record<string, any>; }; }, VisionResult>; export {}; //# sourceMappingURL=VisionTool.d.ts.map