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
  • 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
  • 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 ModelsCompatEventLlmsProfileStreamStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesUuidVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/corevectorstoresVectorStoreInterface
Interface●Since v0.3

VectorStoreInterface

Copy
interface VectorStoreInterface

Bases

Serializable

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

property
embeddings: EmbeddingsInterface
property
FilterType: string | object
property
lc_kwargs: SerializedFields
property
lc_namespace: string[]
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

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.

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.

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.

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.