Hierarchy

  • BaseModule
    • Caches

Constructors

Methods

Constructors

  • Parameters

    • apiClient: ApiClient

    Returns Caches

Methods

  • Creates a cached contents resource.

    Parameters

    Returns Promise<CachedContent>

    The created cached content.

    const contents = ...; // Initialize the content to cache.
    const response = await ai.caches.create({
    model: 'gemini-2.0-flash',
    config: {
    'contents': contents,
    'displayName': 'test cache',
    'systemInstruction': 'What is the sum of the two pdfs?',
    'ttl': '86400s',
    }
    });
  • Lists cached content configurations.

    Parameters

    Returns Promise<Pager<CachedContent>>

    The paginated results of the list of cached contents.

    const cachedContents = await ai.caches.list({config: {'pageSize': 2}});
    for (const cachedContent of cachedContents) {
    console.log(cachedContent);
    }
MMNEPVFCICPMFPCPTTAAATR