Skip to main content
Sample code: Vector search on Azure Cosmos DB for PostgreSQL with Azure AI Vision and pgvector
ACTIVITY_BANNER_ALT_TEXT
Sample code: Vector search on Azure Cosmos DB for PostgreSQL with Azure AI Vision and pgvector
Activity Type: Open Source/Project/Sample code/Tools
Sun, Dec 31, 2023, 10:00 PM
Primary Technology Area: Azure AI ServicesAdditional Technology Areas: Azure Cosmos DB, Azure Database for PostgreSQL
Target Audience: Developer
This project demonstrates the creation of an image similarity search application using Azure Cosmos DB for PostgreSQL (or Azure Database for PostgreSQL) as a vector database and Azure AI Vision for generating embeddings. The application utilizes the SemArt Dataset, which contains approximately 21k paintings gathered from the Web Gallery of Art. Each painting comes with various attributes, like a title, description, and the name of the artist. The sample explores the process of cleaning up the dataset, generating embeddings for images using Azure AI Vision, uploading image files to an Azure Blob Storage container, creating a table in Azure Cosmos DB for PostgreSQL, populating it with data, creating an IVFFlat or an HNSW index for approximate search, and querying the embeddings through both exact and approximate nearest neighbor search methods. The project also provides examples of text-to-image and image-to-image search, along with metadata filtering.