pulse-ai-utils
Version:
Utility functions and helpers for AI-powered applications
42 lines (41 loc) • 1.19 kB
TypeScript
import { CacheParams } from '../helpers/query-cache';
export declare class SupabaseQueryCache {
private openai;
constructor();
/**
* Get cached result using vector similarity search
*/
getCachedResult(prompt: string, location: CacheParams): Promise<any | null>;
/**
* Set cached result with vector embedding
*/
setCachedResult(prompt: string, location: CacheParams, result: any): Promise<void>;
/**
* Batch insert multiple cache entries for better performance
*/
batchSetCachedResults(entries: Array<{
prompt: string;
location: CacheParams;
result: any;
}>): Promise<void>;
/**
* Search cache by location filters without prompt similarity
*/
searchByLocation(location: CacheParams, limit?: number): Promise<any[]>;
/**
* Clean up expired cache entries
*/
cleanupExpired(): Promise<number>;
/**
* Get cache statistics
*/
getStats(): Promise<{
totalEntries: number;
expiredEntries: number;
byArea: Record<string, number>;
}>;
/**
* Hash function for generating consistent IDs
*/
private hashString;
}