LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Browser
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
  • Tools
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Compat
  • Event
  • Llms
  • Openai Completions Stream
  • Profile
  • Stream
  • Structured Output
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Testing
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Gateway
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Standard Schema
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Uuid
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
BrowserUniversalHubNodeLoadSerializableEncoder BackedFile SystemIn MemoryTools
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsCompatEventLlmsOpenai Completions StreamProfileStreamStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingGatewayHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesUuidVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/corevectorstoresVectorStoreInterface
Interfaceā—Since v0.3

VectorStoreInterface

Interface defining the structure and operations of a vector store, which facilitates the storage, retrieval, and similarity search of document vectors.

VectorStoreInterface provides methods for adding, deleting, and searching documents based on vector embeddings, including support for similarity search with optional filtering and relevance-based retrieval.

Copy
interface VectorStoreInterface

Bases

Serializable

Properties

property
embeddings: EmbeddingsInterface

Instance of EmbeddingsInterface used to generate vector embeddings for documents, enabling vector-based search operations.

property
FilterType: string | object

Defines the filter type used in search and delete operations. Can be an object for structured conditions or a string for simpler filtering.

property
lc_kwargs: SerializedFields
property
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.

property
lc_serializable: boolean
property
lc_aliases: __type | undefined
property
lc_attributes: SerializedFields | undefined
property
lc_id: string[]
property
lc_secrets: __type | undefined
property
lc_serializable_keys: string[] | undefined

Methods

method
_vectorstoreType→ string

Returns a string identifying the type of vector store implementation, useful for distinguishing between different vector storage backends.

method
addDocuments→ Promise<void | string[]>

Adds an array of documents to the vector store.

method
addVectors→ Promise<void | string[]>

Adds precomputed vectors and their corresponding documents to the vector store.

method
asRetriever→ VectorStoreRetriever<VectorStoreInterface>

Converts the vector store into a retriever, making it suitable for use in retrieval-based workflows and allowing additional configuration.

method
delete→ Promise<void>

Deletes documents from the vector store based on the specified parameters.

method
maxMarginalRelevanceSearch→ Promise<DocumentInterface<Record<string, any>>[]>

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

method
similaritySearch→ Promise<DocumentInterface<Record<string, any>>[]>

Searches for documents similar to a text query, embedding the query and retrieving documents based on vector similarity.

method
similaritySearchVectorWithScore→ Promise<[DocumentInterface<Record<string, any>>, number][]>

Searches for documents similar to a given vector query and returns them with similarity scores.

method
similaritySearchWithScore→ Promise<[DocumentInterface<Record<string, any>>, number][]>

Searches for documents similar to a text query and includes similarity scores in the result.

method
toJSON→ Serialized
method
toJSONNotImplemented→ SerializedNotImplemented

Inherited fromSerializable

Properties

Plc_kwargs: SerializedFieldsPlc_namespace: string[]
—

A path to the module that contains the class, eg. ["langchain", "llms"]

Plc_serializable: booleanPlc_aliases: __type | undefinedPlc_attributes: SerializedFields | undefinedPlc_id: string[]Plc_secrets: __type | undefinedPlc_serializable_keys: string[] | undefined

Methods

MtoJSON→ SerializedMtoJSONNotImplemented→ SerializedNotImplementedMlc_name→ string
—

The name of the serializable. Override to provide an alias or

View source on GitHub