(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

AI-901: Embeddings and semantic search with Foundry

João Barros 22 de July de 2026 4 min read

In this guide I will teach the skill of using embeddings to implement a semantic search with Microsoft Foundry and OneLake — a practical area frequently assessed in the implementation portion of AI solutions. Understanding embeddings and how to index/query them is useful for the exam and essential for building meaning-based searches over documents, FAQs and conversational applications.

What you need to know

Embeddings are numerical representations (vectors) of text, images or other content that capture semantics: semantically similar objects have nearby vectors. In semantic search systems, we convert documents and queries into vectors and use similarity (e.g., cosine similarity) to find the most relevant documents.

Simple example: the texts "Como mudar a palavra-passe" and "Alterar password" will have similar embeddings, even with different words — unlike an exact-term search.

In practice

Essential steps to implement a semantic search with Foundry and OneLake:

  1. Prepare data: collect and clean documents (files, pages, transcripts). Normalize text: remove unnecessary HTML, normalize whitespace and split into context units (paragraphs, segments).
  2. Generate embeddings: choose an embeddings model (provided by Azure OpenAI, or another integrated in Foundry) and transform each segment into a vector.
  3. Store vectors: record the vectors in a vector index supported by OneLake/Foundry (or in a compatible vector store service), including metadata (document id, location, summary).
  4. Index and optimize: use techniques like appropriate chunking (segment size), normalization and, when available, creation of approximate indexes (e.g., HNSW) for fast queries.
  5. Query: for each user query, generate the query embedding, compute similarities with the indexed vectors and return the nearest documents. Optional: rerank with a comprehension or summarization model before presenting to the user.

Here is a simplified Python example (pseudo-code) to generate and compare embeddings:

from azure.identity import DefaultAzureCredential
from azure.ai.openai import OpenAIClient
import numpy as np

# Autenticação e cliente (exemplo conceptual)
credential = DefaultAzureCredential()
client = OpenAIClient(endpoint, credential)

# 1. Gerar embedding para um documento
resp = client.get_embeddings(model='embedding-model', input='Texto do documento aqui')
doc_vector = np.array(resp.data[0].embedding)

# Armazenar doc_vector com id e metadados no índice vetorial (OneLake/Foundry)
# (Esta etapa depende do serviço de indexação do Foundry)

# 2. Gerar embedding para a query
q_resp = client.get_embeddings(model='embedding-model', input='Como alterar a password?')
query_vector = np.array(q_resp.data[0].embedding)

# 3. Calcular cosine similarity (exemplo para poucos vetores)
def cosine_similarity(a, b):
    return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))

score = cosine_similarity(query_vector, doc_vector)
# ordenar por score e retornar os top-K

Practical notes: in production, don’t load all vectors into memory — use a vector index that supports approximate and scalable searches (for example, HNSW). In Foundry, use the indexing/OneLake components that facilitate management of vectors and metadata.

Common pitfalls

  • Inadequate chunking: splitting documents into segments that are too large or too small. Very large segments dilute context; too small lose meaning. Test sizes and evaluate retrieval quality.
  • Comparing vectors without normalization: forgetting to normalize vectors or using inconsistent metrics can skew results. For cosine similarity, normalize or compute correctly.
  • Ignoring metadata: not storing useful metadata (date, title, location) makes filtering and explainability harder. Metadata allow combining semantic and structured filters.

How to practice

To practice this skill in a way aligned with the exam and official resources:

  • Take the official Microsoft Practice Assessment for AI-901 (free) — it is the right way to evaluate your readiness.
  • Follow the Microsoft study guide / learning path for AI-901 on Microsoft Learn (free). Look for modules on embeddings, Azure OpenAI and indexing/Vector Search services.
  • Implement a small project: take 50–200 documents, generate embeddings with a model available in your Azure/Foundry environment, index them and implement queries. Evaluate quality with real examples and adjust chunking and models.

In summary

  • Embeddings transform text into vectors; semantic search uses similarity to retrieve content by meaning.
  • Practical flow: prepare data → generate embeddings → store in a vector index → query with query embeddings.
  • Avoid inadequate chunking, normalization mistakes and lack of metadata; use approximate indexes for scalability.
  • Practice with the official Microsoft Practice Assessment and with modules on Microsoft Learn to consolidate knowledge.