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
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • 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
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Standard Schema
  • Stream
  • Testing
  • Tiktoken
  • Types
  • 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 Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/corevectorstoresVectorStore
Class●Since v0.3

VectorStore

Copy
class VectorStore

Bases

Serializable

Constructors

Properties

Methods

Inherited fromSerializable

Properties

Plc_kwargs: SerializedFieldsPlc_namespace: ["langchain_core", "callbacks", string]
—

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

Plc_serializable: booleanPlc_aliases
View source on GitHub
: __type | undefined
Plc_attributes: __type | undefined
Plc_id: string[]
Plc_secrets: __type | undefined
Plc_serializable_keys: string[] | undefined

Methods

MtoJSON→ SerializedMtoJSONNotImplemented→ SerializedNotImplementedMlc_name→ string
—

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

constructor
constructor
property
embeddings: EmbeddingsInterface
property
FilterType: string | object
property
lc_kwargs: SerializedFields
property
lc_serializable: boolean
property
lc_aliases: __type | undefined
property
lc_attributes: __type | undefined
property
lc_id: string[]
property
lc_secrets: __type | undefined
property
lc_serializable_keys: string[] | undefined
method
_vectorstoreType→ string
method
addDocuments→ Promise<void>
method
addVectors→ Promise<void>
method
asRetriever→ VectorStoreRetriever<FakeVectorStore>
method
delete→ Promise<void>
method
maxMarginalRelevanceSearch→ Promise<DocumentInterface<Record<string, any>>[]>
method
similaritySearch→ Promise<DocumentInterface<Record<string, any>>[]>
method
similaritySearchVectorWithScore→ Promise<[Document<Record<string, any>>, number][]>
method
similaritySearchWithScore→ Promise<[DocumentInterface<Record<string, any>>, number][]>
method
toJSON→ Serialized
method
toJSONNotImplemented→ SerializedNotImplemented
method
fromDocuments→ Promise<FakeVectorStore>
method
fromTexts→ Promise<FakeVectorStore>
method
lc_name→ string

Abstract class representing a vector storage system for performing similarity searches on embedded documents.

VectorStore provides methods for adding precomputed vectors or documents, removing documents based on criteria, and performing similarity searches with optional scoring. Subclasses are responsible for implementing specific storage mechanisms and the exact behavior of certain abstract methods.

Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.

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

Returns a string representing the type of vector store, which subclasses must implement to identify their specific vector storage type.

Method to add documents to the memory vector store. It extracts the text from each document, generates embeddings for them, and adds the resulting vectors to the store.

Method to add vectors to the memory vector store. It creates MemoryVector instances for each vector and document pair and adds them to the store.

Creates a VectorStoreRetriever instance with flexible configuration options.

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

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

Searches for documents similar to a text query by embedding the query and performing a similarity search on the resulting vector.

Method to perform a similarity search in the memory vector store. It calculates the similarity between the query vector and each vector in the store, sorts the results by similarity, and returns the top k results along with their scores.

Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.

Static method to create a FakeVectorStore instance from an array of Document instances. It adds the documents to the store.

Static method to create a FakeVectorStore instance from an array of texts. It creates a Document for each text and metadata pair, and adds them to the store.

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.