# Firestore for Image Embeddings

DevFeed: [Firestore for Image Embeddings](<https://devfeed.tech/articles/firestore-for-image-embeddings-23888.md>)

Original publisher: [Read original article](<https://medium.com/firebase-developers/firestore-for-image-embeddings-f3fa2a5a5058?source=rss----8e8b7dc6774d---4>)

Author: Mete Atamel

Published: 2024-10-29T19:13:03Z

Content type: tutorial

Language: en

Sources: [Firebase Developers - Medium](<https://devfeed.tech/sources/firebase-developers-medium.md>)

Topics: [Firestore](<https://devfeed.tech/topics/firestore.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [LangChain](<https://devfeed.tech/topics/langchain.md>), [multimodal](<https://devfeed.tech/topics/multimodal.md>), [Cloud](<https://devfeed.tech/topics/cloud.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [cloud-storage](<https://devfeed.tech/tags/cloud-storage.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [firestore](<https://devfeed.tech/tags/firestore.md>), [generative-ai-tools](<https://devfeed.tech/tags/generative-ai-tools.md>), [langchain](<https://devfeed.tech/tags/langchain.md>), [llms](<https://devfeed.tech/tags/llms.md>), [multimodal](<https://devfeed.tech/tags/multimodal.md>), [retrieval](<https://devfeed.tech/tags/retrieval.md>), [search](<https://devfeed.tech/tags/search.md>), [software-development](<https://devfeed.tech/tags/software-development.md>), [web](<https://devfeed.tech/tags/web.md>)

## AI overview

A tutorial showing how to use FirestoreVectorStore and LangChain to generate, store, and retrieve image embeddings for similarity search. It covers multimodal embedding models, images from local storage, Google Cloud Storage, and the web, plus text- and image-based queries.

## Source excerpt

Powering LLMs with Firestore In my previous post about Firestore for Text Embedding and Similarity Search, I talked about how Firestore and LangChain can help you to store text embeddings and do similarity searches against them. With multimodal embedding models, you can generate embeddings not only for text but for images and video as well. In this post, I will show you how to store image embeddings in Firestore and later use them for similarity search. Image embeddings support in FirestoreVectorStore As a recap from the previous post, the Firestore for LangChain project provides a FirestoreVectorStore which simplifies storage and retrieval of embeddings. Initially, FirestoreVectorStore only supported text embeddings, but we recently added a new add_images method to store image embeddings. Likewise, we added the similarity_search_image method to run similarity searches with image embeddings. Let's take a closer look at how you can use FirestoreVectorStore in LangChain to work with image embeddings. First, you need to create a multimodal embedding model that can embed images: from langchain_google_vertexai import VertexAIEmbeddings embedding = VertexAIEmbeddings( model_name="multimodalembedding", project=PROJECT_ID, location="us-central1" ) Then, you create a Firestore-backed vector store with the embedding model: from langchain_google_firestore import FirestoreVectorStore vector_store = FirestoreVectorStore( collection=COLLECTION_NAME, embedding_service=embedding, ) Now, you can add images stored locally, in Google Cloud Storage, or any image on the web as follows: ids = ["landmark1.png", "landmark2.png", "landmark3.png"] image_paths = [ "gs://your-storage-bucket/landmark1.png", "./images/landmark2.png", "https://your-website/images/landmark3.png", ] vector_store.add_images(image_paths, ids=ids) This creates embeddings for each image and saves them to Firestore. Afterwards, you can perform a similarity search with a text query: vector_store.similarity_search("stadiu