Typesense vector store.

Hierarchy

  • VectorStore
    • Typesense

Constructors

Properties

FilterType: Partial<MultiSearchRequestSchema>
embeddings: EmbeddingsInterface

Methods

  • Add documents to the vector store. Will be updated if in the metadata there is a document with the same id if is using the default import function. Metadata will be added in the columns of the schema based on metadataColumnNames.

    Parameters

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

      Documents to add.

    Returns Promise<void>

  • Adds vectors to the vector store.

    Parameters

    • vectors: number[][]

      Vectors to add.

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

      Documents associated with the vectors.

    Returns Promise<void>

  • Parameters

    • OptionalkOrFields: number | Partial<VectorStoreRetrieverInput<Typesense>>
    • Optionalfilter: Partial<MultiSearchRequestSchema>
    • Optionalcallbacks: Callbacks
    • Optionaltags: string[]
    • Optionalmetadata: Record<string, unknown>
    • Optionalverbose: boolean

    Returns VectorStoreRetriever<Typesense>

  • Parameters

    • Optional_params: Record<string, any>

    Returns Promise<void>

  • 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<Partial<MultiSearchRequestSchema>>
    • _callbacks: undefined | Callbacks

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

    • List of documents selected by maximal marginal relevance.
  • Parameters

    • query: string
    • Optionalk: number
    • Optionalfilter: Partial<MultiSearchRequestSchema>
    • Optional_callbacks: Callbacks

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

  • Search for similar documents with their similarity score.

    Parameters

    • vectorPrompt: number[]

      vector to search for

    • Optionalk: number

      amount of results to return

    • filter: Partial<MultiSearchRequestSchema> = {}

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

    similar documents with their similarity score

  • Parameters

    • query: string
    • Optionalk: number
    • Optionalfilter: Partial<MultiSearchRequestSchema>
    • Optional_callbacks: Callbacks

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

  • Returns Serialized

  • Create a vector store from documents.

    Parameters

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

      documents

    • embeddings: EmbeddingsInterface

      embeddings

    • config: TypesenseConfig

      Typesense configuration

    Returns Promise<Typesense>

    Typesense vector store

    You can omit this method, and only use the constructor and addDocuments.