in

Get started with Firestore vector similarity search


Creating innovative AI-powered solutions for use cases such as product recommendations and chatbots often requires vector similarity search, or vector search for short. At Google Cloud Next ‘24, we announced the Firestore vector search in preview, using exact K-nearest neighbor (KNN) search. Developers can now perform vector search on transactional Firestore data without the hassle of copying data to another vector search solution, maintaining operational simplicity and efficiency.

Developers can now utilize Firestore vector search with popular orchestration frameworks such as LangChain and LlamaIndex through native integrations. We’ve also launched a new Firestore extension to make it easier for you to automatically compute vector embeddings on your data, and  create web services that make it easier for you to perform vector searches from a web or mobile application. 

In this blog, we’ll discuss how developers can get started with Firestore’s new vector search capabilities.

How to use KNN vector search in Firestore

The first step in utilizing vector search is to generate vector embeddings. Embeddings are representations of different kinds of data like text, images, video, etc in a continuous vector space, and capture semantic or syntactic similarities between the entities they represent.  Embeddings can be calculated using a service, such as the Vertex AI text-embeddings API

Once the embeddings are generated you can store them in Firestore using one of the supported SDKs. For example, let’s say you’ve generated an embedding using your favorite embedding model for the data in the field “description” in the collection “beans”. You can now add that generated embedding as a vector value to the field “embedding_field”. Simply run the following command using the NodeJS SDK:


No One Actually Knows How AI Will Affect Jobs

No One Actually Knows How AI Will Affect Jobs

https://storage.googleapis.com/gweb-cloudblog-publish/images/Next24_Blog_blank_2-02.max-2500x2500.jpg

Gemini helps migrate Oracle to PostgreSQL on Google Cloud