Hierarchy

  • BaseModule
    • FileSearchStores

Constructors

Properties

documents: Documents = ...

Methods

  • Downloads media using a Media ID or URI. This method is only supported in the Gemini Developer client.

    Parameters

    • uri: string

      The URI or Media ID of the blob.

    • Optionalconfig: DownloadMediaConfig

      Optional configuration for the download.

    Returns Promise<Uint8Array>

    A promise that resolves to the blob data as a Uint8Array.

  • Uploads a file asynchronously to a given File Search Store. This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI). Supported upload sources:

    • Node.js: File path (string) or Blob object.
    • Browser: Blob object (e.g., File).

    Parameters

    Returns Promise<UploadToFileSearchStoreOperation>

    A promise that resolves to a long running operation.

    The mimeType can be specified in the config parameter. If omitted:

    • For file path (string) inputs, the mimeType will be inferred from the file extension.
    • For Blob object inputs, the mimeType will be set to the Blob's type property.

    This section can contain multiple paragraphs and code examples.

    types.UploadToFileSearchStoreParameters#config for the optional config in the parameters.

    An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.

    An error if the mimeType is not provided and can not be inferred, the mimeType can be provided in the params.config parameter.

    An error occurs if a suitable upload location cannot be established.

    The following code uploads a file to a given file search store.

    const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
    mimeType: 'text/plain',
    }});
    console.log(operation.name);