Data for AI
Domain 2 · 30–35% of the AI-200 exam
Store app data and embeddings where your AI app can find them fast: Azure Cosmos DB for NoSQL (SDK queries, RUs, indexing, consistency, vector search, change feed), Azure Database for PostgreSQL with pgvector for RAG, and Azure Managed Redis for caching and vector search.
Lessons in this module
- 1 Embeddings and Vector Search for Developers Learn what embeddings are, how to create them with text-embedding-3-small, and how vector search finds similar items in Cosmos DB, PostgreSQL and Redis.
- 2 Cosmos DB for NoSQL: Connect with the SDK and Query Connect to Azure Cosmos DB for NoSQL from Python with DefaultAzureCredential, then upsert items, run point reads and parameterised queries, and read RU charges.
- 3 Cosmos DB: RUs, Indexing Policies and Consistency Levels Cut Cosmos DB RU costs with indexing policies that skip paths and add composite indexes, then pick the right consistency level, from Strong to Eventual.
- 4 Vector Search in Cosmos DB for NoSQL Store embeddings in Cosmos DB for NoSQL with a vector embedding policy, pick flat, quantizedFlat or diskANN indexes, and run VectorDistance queries in Python.
- 5 Cosmos DB Change Feed Processor React to new and updated Cosmos DB items with the change feed processor, a lease container and a delegate, or a Functions trigger, to keep embeddings fresh.
- 6 Connect to and Query Azure Database for PostgreSQL Connect a Python app to Azure Database for PostgreSQL flexible server with psycopg 3, a Microsoft Entra token, sslmode=require and safe parameterised queries.
- 7 PostgreSQL Schemas, Data Types and Indexes Design PostgreSQL tables for AI apps, pick vector, jsonb and timestamptz types, enable pgvector and choose B-tree, GIN and HNSW indexes with EXPLAIN ANALYZE.
- 8 pgvector Similarity Search and RAG with Metadata Filters Store embeddings in PostgreSQL with pgvector, run cosine similarity search, add tenant and language filters, and build a grounded RAG answer in Python.
- 9 Size and Tune PostgreSQL for Vector Workloads Pick compute tier, memory and Premium SSD v2 storage for pgvector, tune HNSW and IVFFlat builds, and cut latency with psycopg_pool and built-in PgBouncer.
- 10 Azure Managed Redis: Caching, Expiration and Invalidation Use Azure Managed Redis from Python with Entra ID on port 10000 to cache-aside AI results, set TTLs, invalidate on write and pick an eviction policy.
- 11 Vector Search with Azure Managed Redis Create a RediSearch vector index in Azure Managed Redis with FT.CREATE, run KNN queries with FT.SEARCH and DIALECT 2, and build a semantic cache in Python.
Hands-On Labs
Every section of this domain has guided labs in the practice portal and Cloud Shell. No Azure account, nothing to pay, and your progress stays in this browser.