Hierarchy (view full)

Constructors

Properties

FilterType: Filter

Methods

  • Adds an array of documents to the table. The documents are first converted to vectors using the embedDocuments method of the embeddings instance.

    Parameters

    • documents: Document[]

      Array of Document instances to be added to the table.

    Returns Promise<void>

    Promise that resolves when the documents are added.

  • Adds an array of vectors and corresponding documents to the database. The vectors and documents are batch inserted into the database.

    Parameters

    • vectors: number[][]

      Array of vectors to be added to the table.

    • documents: Document[]

      Array of Document instances corresponding to the vectors.

    Returns Promise<void>

    Promise that resolves when the vectors and documents are added.

  • Checks if the specified column exists in the table and validates its data type and length.

    Parameters

    • tableName: string

      The name of the table.

    • columnName: string

      The name of the column to check.

    • columnType: string | string[]

      The expected data type(s) of the column.

    • Optional columnLength: number

      The expected length of the column. Optional.

    Returns Promise<void>

  • Deletes entries from the table based on the provided filter.

    Parameters

    • options: {
          filter?: Filter;
          ids?: string[];
      }
      • Optional filter?: Filter
      • Optional ids?: string[]

    Returns Promise<void>

    Throws

    Error if 'ids' parameter is provided, as deletion by ids is not supported.

    Throws

    Error if 'filter' parameter is not provided, as it is required for deletion. to do: adjust the call signature

  • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

    Parameters

    • query: string

      Text to look up documents similar to.

    • options: MaxMarginalRelevanceSearchOptions<this["FilterType"]>

    Returns Promise<Document[]>

    List of documents selected by maximal marginal relevance.

  • Return docs most similar to query.

    Parameters

    • query: string

      Query text for the similarity search.

    • k: number

      Number of Documents to return. Defaults to 4.

    • Optional filter: Filter

      A dictionary of metadata fields and values to filter by. Defaults to None.

    Returns Promise<Document[]>

    Promise that resolves to a list of documents and their corresponding similarity scores.

  • Return docs most similar to the given embedding.

    Parameters

    • queryEmbedding: number[]
    • k: number

      Number of Documents to return. Defaults to 4.

    • Optional filter: Filter

      A dictionary of metadata fields and values to filter by. Defaults to None.

    Returns Promise<[Document, number][]>

    Promise that resolves to a list of documents and their corresponding similarity scores.

  • Return documents and score values most similar to query.

    Parameters

    • query: string

      Query text for the similarity search.

    • k: number

      Number of Documents to return. Defaults to 4.

    • Optional filter: Filter

      A dictionary of metadata fields and values to filter by. Defaults to None.

    Returns Promise<[Document, number][]>

    Promise that resolves to a list of documents and their corresponding similarity scores.

  • Performs a similarity search based on vector comparison and returns documents along with their similarity scores and vectors.

    Parameters

    • embedding: number[]

      The vector representation of the query for similarity comparison.

    • k: number

      The number of top similar documents to return.

    • Optional filter: Filter

      Optional filter criteria to apply to the search query.

    Returns Promise<[Document, number, number[]][]>

    A promise that resolves to an array of tuples, each containing a Document, its similarity score, and its vector.

  • Creates an instance of HanaDB from an array of Document instances. The documents are added to the database.

    Parameters

    • docs: Document[]

      List of documents to be converted to vectors.

    • embeddings: EmbeddingsInterface

      Embeddings instance used to convert the documents to vectors.

    • dbConfig: HanaDBArgs

      Configuration for the HanaDB.

    Returns Promise<HanaDB>

    Promise that resolves to an instance of HanaDB.

  • Static method to create a HanaDB instance from raw texts. This method embeds the documents, creates a table if it does not exist, and adds the documents to the table.

    Parameters

    • texts: string[]

      Array of text documents to add.

    • metadatas: object | object[]

      metadata for each text document.

    • embeddings: EmbeddingsInterface
    • dbConfig: HanaDBArgs

      Configuration for the HanaDB.

    Returns Promise<HanaDB>

    A Promise that resolves to an instance of HanaDB.

  • Parses a string representation of a float array and returns an array of numbers.

    Parameters

    • arrayAsString: string

      The string representation of the array.

    Returns number[]

    An array of floats parsed from the string.

  • Sanitizes a list to ensure all elements are floats (numbers in TypeScript). Throws an error if any element is not a number.

    Parameters

    • embedding: number[]

      The array of numbers (floats) to be sanitized.

    Returns number[]

    The sanitized array of numbers (floats).

    Throws

    Throws an error if any element is not a number.

Generated using TypeDoc