Spanner is a highly scalable database that combines unlimited scalability with relational semantics, such as secondary indexes, strong consistency, schemas, and SQL providing 99.999% availability in one easy solution.This notebook goes over how to use
Spanner
for Vector Search with SpannerVectorStore
class.
Learn more about the package on GitHub.
langchain-google-spanner
package, so we need to install it.
gcloud config list
.gcloud projects list
.langchain-google-spanner
package requires that you enable the Spanner API in your Google Cloud Project.
SpannerVectorStore
class instance requires a database table with id, content and embeddings columns.
The helper method init_vector_store_table()
that can be used to create a table with the proper schema for you.
VertexAIEmbeddings
. We recommend setting the embedding modelβs version for production, learn more about the Text embeddings models.
SpannerVectorStore
class you need to provide 4 required arguments and other arguments are optional and only need to pass if itβs different from default ones
instance_id
- The name of the Spanner instancedatabase_id
- The name of the Spanner databasetable_name
- The name of the table within the database to store the documents & their embeddings.embedding_service
- The Embeddings implementation which is used to generate the embeddings.