1 minute

26. Use a Vector Database to store C4 diagrams informations

Date: 2025-03-22

Status

Accepted

Context

We want to use a vector database to store C4 diagrams informations and retrieve these inforamtion base on a distance function. A vector database stores data as high-dimensional vectors, capturing semantic relationships between items. This allows for efficient similarity searches, finding items with similar meanings or characteristics, rather than just exact matches. Advantages include improved search relevance and enhanced recommendation systems.

Decision

For vector database usage within an Azure-based solution, Cosmos DB becomes pertinent due to its recent introduction of native vector search capabilities, alongside its existing strengths. This allows us to combine traditional database operations with efficient similarity searches, directly within a scalable and globally distributed Azure service. It simplifies architecture by eliminating the need for separate vector search services, and reduces latency by keeping vector data and application data close.

Consequences

We will use a dedicated class to integrate data into Cosmos DB, encompassing both standard data ingestion and vector embedding generation. This class will handle calls to embedding models (like Gemini’s), store the resulting vectors alongside the original C4 diagram information within Cosmos DB, and manage the vector indexing policy.