UNPKG

@yogesh0333/yogiway-prompt

Version:

Free & Open Source Prompt Optimization Library - Save 30-50% on AI API costs. Multi-language, multi-platform support.

65 lines (64 loc) 2.23 kB
/** * YOGIWAY Prompt - Main class for easy usage */ import type { TokenCountResult } from './tokenizer'; import type { CostEstimate } from './cost-calculator'; import type { Chunk, ChunkOptions } from './chunker'; import type { FormatOptions } from './formatter'; import { PromptOptimizationOptions, ContextWindowOptions, LLMProvider, OptimizationResult } from './types'; /** * Main YOGIWAY Prompt class */ export declare class YogiwayPrompt { /** * Optimize a prompt */ static optimize(prompt: string, options?: PromptOptimizationOptions): OptimizationResult; /** * Count tokens */ static countTokens(text: string, provider?: LLMProvider): number; /** * Get detailed token count */ static getTokenCount(text: string, provider?: LLMProvider): TokenCountResult; /** * Manage context window */ static manageContext(prompt: string, options: ContextWindowOptions): import("./types").ChunkResult; /** * Calculate cost */ static calculateCost(prompt: string, provider?: LLMProvider, model?: string, estimatedOutputTokens?: number): CostEstimate; /** * Compare costs across providers */ static compareCosts(prompt: string, models: Array<{ provider: LLMProvider; model: string; }>): CostEstimate[]; /** * Calculate savings */ static calculateSavings(originalPrompt: string, optimizedPrompt: string, provider?: LLMProvider, model?: string, requestsPerDay?: number): { perRequest: number; perDay: number; perMonth: number; perYear: number; percentage: number; }; /** * Chunk text */ static chunk(text: string, options: ChunkOptions): Chunk[]; /** * Format prompt for provider */ static format(options: FormatOptions): string | object; } export declare const optimize: typeof YogiwayPrompt.optimize; export declare const count: typeof YogiwayPrompt.countTokens; export declare const getCost: typeof YogiwayPrompt.calculateCost; export declare const getSavings: typeof YogiwayPrompt.calculateSavings; export declare const chunk: typeof YogiwayPrompt.chunk; export declare const format: typeof YogiwayPrompt.format;