Class for interacting with the Vectara API. Extends the VectorStore class.

Hierarchy

Constructors

Properties

FilterType: VectaraFilter
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(): {
        [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 {
        [key: string]: string;
    }

    • [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(): {
        [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 {
        [key: string]: string;
    }

    • [key: string]: string

Methods

  • Vectara provides a way to add documents directly via their API. This API handles pre-processing and chunking internally in an optimal manner. This method is a wrapper to utilize that API within LangChain.

    Parameters

    • files: VectaraFile[]

      An array of VectaraFile objects representing the files and their respective file names to be uploaded to Vectara.

    • metadatas: undefined | Record<string, unknown> = undefined

    Returns Promise<number>

    A Promise that resolves to the number of successfully uploaded files.

  • Throws an error, as this method is not implemented. Use addDocuments instead.

    Parameters

    • _vectors: number[][]

      Not used.

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

      Not used.

    Returns Promise<void>

    Does not return a value.

  • Returns a header for Vectara API calls.

    Returns Promise<VectaraCallHeader>

    A Promise that resolves to a VectaraCallHeader object.

  • Performs a similarity search and returns documents.

    Parameters

    • query: string

      The query string for the similarity search.

    • k: number = 10

      Optional. The number of results to return. Default is 10.

    • filter: undefined | VectaraFilter = undefined

      Optional. A VectaraFilter object to refine the search results.

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

    A Promise that resolves to an array of Document objects.

  • Performs a similarity search and returns documents along with their scores.

    Parameters

    • query: string

      The query string for the similarity search.

    • k: number = 10

      Optional. The number of results to return. Default is 10.

    • filter: undefined | VectaraFilter = undefined

      Optional. A VectaraFilter object to refine the search results.

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

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

  • Creates a VectaraStore instance from texts.

    Parameters

    • texts: string[]

      An array of text strings.

    • metadatas: object | object[]

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

    • _embeddings: Embeddings

      Not used.

    • args: VectaraLibArgs

      A VectaraLibArgs object for initializing the VectaraStore instance.

    Returns Promise<VectaraStore>

    A Promise that resolves to a VectaraStore 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