Class that extends the VectorStore base class. It provides methods to interact with a Weaviate index, including adding vectors and documents, deleting data, and performing similarity searches.

Hierarchy

Constructors

Properties

FilterType: WeaviateFilter
embeddings: Embeddings
lc_kwargs: SerializedFields
lc_namespace: string[] = ...

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

lc_serializable: boolean = false

Accessors

  • get lc_aliases(): undefined | {
        [key: string]: string;
    }
  • A map of aliases for constructor args. Keys are the attribute names, e.g. "foo". Values are the alias that will replace the key in serialization. This is used to eg. make argument names match Python.

    Returns undefined | {
        [key: string]: string;
    }

  • get lc_attributes(): undefined | SerializedFields
  • A map of additional attributes to merge with constructor args. Keys are the attribute names, e.g. "foo". Values are the attribute values, which will be serialized. These attributes need to be accepted by the constructor as arguments.

    Returns undefined | SerializedFields

  • get lc_secrets(): undefined | {
        [key: string]: string;
    }
  • A map of secrets, which will be omitted from serialization. Keys are paths to the secret in constructor args, e.g. "foo.bar.baz". Values are the secret ids, which will be used when deserializing.

    Returns undefined | {
        [key: string]: string;
    }

Methods

  • Method to add documents to the Weaviate index. It first generates vectors for the documents using the embeddings, then adds the vectors and documents to the index.

    Parameters

    • documents: Document<Record<string, any>>[]

      Array of documents to be added.

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

      Optional parameter that can include specific IDs for the documents.

      • Optional ids?: string[]

    Returns Promise<string[]>

    An array of document IDs.

  • Method to add vectors and corresponding documents to the Weaviate index.

    Parameters

    • vectors: number[][]

      Array of vectors to be added.

    • documents: Document<Record<string, any>>[]

      Array of documents corresponding to the vectors.

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

      Optional parameter that can include specific IDs for the documents.

      • Optional ids?: string[]

    Returns Promise<string[]>

    An array of document IDs.

  • Method to delete data from the Weaviate index. It can delete data based on specific IDs or a filter.

    Parameters

    • params: {
          filter?: WeaviateFilter;
          ids?: string[];
      }

      Object that includes either an array of IDs or a filter for the data to be deleted.

    Returns Promise<void>

    Promise that resolves when the deletion is complete.

  • Method to perform a similarity search on the stored vectors in the Weaviate index. It returns the top k most similar documents and their similarity scores.

    Parameters

    • query: number[]

      The query vector.

    • k: number

      The number of most similar documents to return.

    • Optional filter: WeaviateFilter

      Optional filter to apply to the search.

    Returns Promise<[Document<Record<string, any>>, number][]>

    An array of tuples, where each tuple contains a document and its similarity score.

  • Static method to create a new WeaviateStore instance from a list of texts. It first creates documents from the texts and metadata, then adds the documents to the Weaviate index.

    Parameters

    • texts: string[]

      Array of texts.

    • metadatas: object | object[]

      Metadata for the texts. Can be a single object or an array of objects.

    • embeddings: Embeddings

      Embeddings to be used for the texts.

    • args: WeaviateLibArgs

      Arguments required to create a new WeaviateStore instance.

    Returns Promise<WeaviateStore>

    A new WeaviateStore instance.

  • The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.

    Implemented as a static method to support loading logic.

    Returns string

Generated using TypeDoc