@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 1.9 kB
Source Map (JSON)
{"version":3,"file":"vercel_kv.d.cts","names":["VercelKV","Generation","BaseCache","VercelKVCacheProps","VercelKVCache","Promise"],"sources":["../../src/caches/vercel_kv.d.ts"],"sourcesContent":["import { type VercelKV } from \"@vercel/kv\";\nimport { Generation } from \"@langchain/core/outputs\";\nimport { BaseCache } from \"@langchain/core/caches\";\nexport type VercelKVCacheProps = {\n /**\n * An existing Vercel KV client\n */\n client?: VercelKV;\n /**\n * Time-to-live (TTL) for cached items in seconds\n */\n ttl?: number;\n};\n/**\n * A cache that uses Vercel KV as the backing store.\n * @example\n * ```typescript\n * const cache = new VercelKVCache({\n * ttl: 3600, // Optional: Cache entries will expire after 1 hour\n * });\n *\n * // Initialize the OpenAI model with Vercel KV cache for caching responses\n * const model = new ChatOpenAI({\n * model: \"gpt-4o-mini\",\n * cache,\n * });\n * await model.invoke(\"How are you today?\");\n * const cachedValues = await cache.lookup(\"How are you today?\", \"llmKey\");\n * ```\n */\nexport declare class VercelKVCache extends BaseCache {\n private client;\n private ttl?;\n constructor(props: VercelKVCacheProps);\n /**\n * Lookup LLM generations in cache by prompt and associated LLM key.\n */\n lookup(prompt: string, llmKey: string): Promise<Generation[] | null>;\n /**\n * Update the cache with the given generations.\n *\n * Note this overwrites any existing generations for the given prompt and LLM key.\n */\n update(prompt: string, llmKey: string, value: Generation[]): Promise<void>;\n}\n//# sourceMappingURL=vercel_kv.d.ts.map"],"mappings":";;;;;KAGYG,kBAAAA;;AAAZ;AA2BA;EAGuBA,MAAAA,CAAAA,EA1BVH,QA0BUG;EAI6BF;;;EAMaI,GAAAA,CAAAA,EAAAA,MAAAA;CAbtBH;AAAS;;;;;;;;;;;;;;;;;cAA/BE,aAAAA,SAAsBF,SAAAA;;;qBAGpBC;;;;0CAIqBE,QAAQJ;;;;;;gDAMFA,eAAeI"}