crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
98 lines • 2.35 kB
TypeScript
/**
* DALL-E Image Generation Tool
* Provides optimized image generation capabilities for agents
* with memory-efficient response handling and performance optimizations
*/
type OpenAIClient = any;
/**
* DALL-E image generation response
*/
export interface DallEResult {
/**
* Array of generated images
*/
images: Array<{
url?: string;
b64_json?: string;
revised_prompt?: string;
filePath?: string;
}>;
/**
* Prompt that was used for generation
*/
prompt: string;
/**
* Model used for generation
*/
model: string;
/**
* Error message if generation failed
*/
error?: string;
}
/**
* Options for configuring the DallETool
*/
export interface DallEToolOptions {
/**
* 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 generations
* @default true
*/
cacheResults?: boolean;
/**
* Maximum size of the result cache
* @default 100
*/
maxCacheSize?: number;
/**
* Cache TTL in milliseconds
* @default 3600000 (1 hour)
*/
cacheTtl?: number;
/**
* Default save directory for images
* @default './generated-images'
*/
defaultSaveDirectory?: string;
/**
* Retry configuration for API calls
*/
retry?: {
maxRetries?: number;
initialDelayMs?: number;
maxDelayMs?: number;
};
}
/**
* Creates a DALL-E image generation tool with optimized memory usage and performance
*/
export declare function createDallETool(options?: DallEToolOptions): import("../StructuredTool.js").StructuredTool<{
size?: "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792";
model?: "dall-e-2" | "dall-e-3";
prompt?: string;
n?: number;
quality?: "standard" | "hd";
style?: "vivid" | "natural";
response_format?: "url" | "b64_json";
save?: boolean;
saveDirectory?: string;
}, DallEResult>;
export {};
//# sourceMappingURL=DallETool.d.ts.map