Google Cloud Vertex AI Vector Search vector database.
Google Vertex AI Vector Search, formerly known as Vertex AI Matching Engine, provides the industry’s leading high-scale low latency vector database. These vector databases are commonly referred to as vector similarity-matching or an approximate nearest neighbor (ANN) service.Note: LangChain API expects an endpoint and deployed index already created.Index creation time can take upto one hour.
To see how to create an index refer to the section Create Index and deploy it to an Endpoint If you already have an index deployed , skip to Create VectorStore from texts
Create Index and deploy it to an Endpoint
- This section demonstrates creating a new index and deploying it to an endpoint
Use VertexAIEmbeddings as the embeddings model
Create an empty Index
Note : While creating an index you should specify an “index_update_method” from either a “BATCH_UPDATE” or “STREAM_UPDATE”A batch index is for when you want to update your index in a batch, with data which has been stored over a set amount of time, like systems which are processed weekly or monthly. A streaming index is when you want index data to be updated as new data is added to your datastore, for instance, if you have a bookstore and want to show new inventory online as soon as possible. Which type you choose is important, since setup and requirements are different.Refer Official Documentation for more details on configuring indexes
Create an Endpoint
Deploy Index to the Endpoint
Create Vector Store from texts
NOTE : If you have existing Index and Endpoints, you can load them using below codeCreate simple vectorstore ( without filters)
OPTIONAL : You can also create vectore and store chunks in a Datastore
Create vectorstore with metadata filters
Use Vector Store as retriever
Use filters with retriever in Question Answering Chains
Read , Chunk , Vectorise and Index PDFs
Hybrid Search
Vector Search supports hybrid search, a popular architecture pattern in information retrieval (IR) that combines both semantic search and keyword search (also called token-based search). With hybrid search, developers can take advantage of the best of the two approaches, effectively providing higher search quality. Click here to learn more. In order to use hybrid search, we need to fit a sparse embedding vectorizer and handle the embeddings outside of the Vector Search integration. An example of sparse embedding vectorizer is sklearn TfidfVectorizer but other techniques can be used, for instance BM25.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.