A cache that uses the local filesystem as the backing store. This is useful for local development and testing. But it is not recommended for production use.

Hierarchy

  • BaseCache
    • LocalFileCache

Methods

  • Retrieves data from the cache. It constructs a cache key from the given prompt and llmKey, and retrieves the corresponding value from the cache files.

    Parameters

    • prompt: string

      The prompt used to construct the cache key.

    • llmKey: string

      The LLM key used to construct the cache key.

    Returns Promise<any>

    An array of Generations if found, null otherwise.

  • Updates the cache with new data. It constructs a cache key from the given prompt and llmKey, and stores the value in a specific file in the cache directory.

    Parameters

    • prompt: string

      The prompt used to construct the cache key.

    • llmKey: string

      The LLM key used to construct the cache key.

    • generations: Generation[]

      The value to be stored in the cache.

    Returns Promise<void>