> Markdown version of [/videos/828-develop-ai-powered-applications-with-openai-embeddings-and-azure-search?t=215](https://www.wearedevelopers.com/videos/828-develop-ai-powered-applications-with-openai-embeddings-and-azure-search?t=215). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Develop AI-powered Applications with OpenAI Embeddings and Azure Search Stop splitting text by arbitrary character counts. Master the RAG pattern using OpenAI embeddings and Azure Search. Build fast, context-aware AI applications that cite their own sources. - **Speakers:** [Rainer Stropek](https://www.wearedevelopers.com/@rainer-stropek) - **Event:** WeAreDevelopers LIVE - **Published:** November 17, 2023 - **Duration:** 57:52 - **URL:** https://www.wearedevelopers.com/videos/828-develop-ai-powered-applications-with-openai-embeddings-and-azure-search ## Summary Building robust AI-powered applications requires moving beyond generic chat interfaces to solving domain-specific challenges with private data. This presentation outlines the concept of vector embeddings, which map non-trivial topics and text meanings into multidimensional arrays of floating point numbers. By understanding how to calculate cosine similarity via dot products, developers can leverage tools like OpenAI and Azure Cognitive Search to perform semantic searches that understand context rather than just exact string matching. This approach even bridges language barriers seamlessly, allowing applications to query a German database and output accurate English summaries.\n\nThe core narrative revolves around implementing the Retrieval-Augmented Generation (RAG) pattern, demonstrated through a custom .NET 8 console application that indexes a school's DocuWiki. The pipeline starts by building a crawler to extract HTML, clean it, and convert it into markdown while carefully managing API token restrictions. The speaker emphasizes that automated text chunking strategies require deep domain knowledge, as naive splitting by arbitrary character counts often destroys context compared to intelligent splitting by chapter or paragraph. Once processed, these chunks are passed through the text-embedding-ada-002 model and stored in an Azure vector database.\n\nDuring runtime execution, when a user queries the application, the system embeds the query to find the nearest semantic neighbors in the vector space and injects that context directly into the GPT-4 system prompt. This method not only generates fast, context-aware responses via OpenAI streaming APIs but also effectively mitigates model hallucinations. Because the application tracks exactly which source documents were injected into the prompt, developers can design interfaces that explicitly cite their reference material, bringing necessary verifiability and trust into enterprise AI architectures. **Keywords:** openai text embeddings, azure cognitive search, retrieval-augmented generation, RAG pattern architecture, vector database integration, cosine similarity calculation, text chunking methodologies, LLM hallucination mitigation, semantic text retrieval, .NET 8 AI development, openai streaming API, docuwiki text extraction, cross-language semantic search, GPT-4 system prompting ## Chapters 1. **Understanding embedding vectors and multi-dimensional spaces** (01:12) — Analogies of personality traits illustrate how text is converted into multi-dimensional numerical values representing meaning. 1. **Generating embeddings using the OpenAI API** (03:35) — Calling the embeddings endpoint via Microsoft Azure facilitates adherence to European GDPR requirements while processing data. 1. **Comparing vectors with cosine similarity and dot products** (05:41) — Calculating the dot product of normalized vectors determines the semantic similarity between different texts. 1. **Overview of the OpenAI API and state management** (10:33) — Building targeted frontend applications requires passing complete chat histories or utilizing newer thread APIs for state management. 1. **Understanding the core retrieval augmented generation pattern** (15:24) — Injecting current private facts into model prompts enables accurate answers without retraining the underlying language model. 1. **Defining the use case for a custom search assistant** (18:06) — Searching a complex institutional wiki requires a customized extraction and ingestion pipeline built with cross-platform frameworks. 1. **Extracting and preprocessing HTML data into markdown files** (21:57) — Custom crawlers navigate institutional databases to strip formatting elements and parse raw internet pages into clean markdown files. 1. **Splitting large texts into token-limited chunks for embeddings** (27:19) — Breaking documents into smaller pieces ensures text inputs remain below API limits during the embedding generation process. 1. **Storing calculated embeddings in Azure Cognitive Search** (29:47) — Writing pre-calculated embedding vectors into specialized databases optimizes retrieval speed during live semantic searches. 1. **Implementing query flows with vector searches and completions** (35:36) — Triggering nearest neighbor searches provides relevant document fragments which are streamed back directly as engineered prompts. 1. **Demonstrating the working console application and localized responses** (40:06) — Running the complete system via command-line effectively retrieves knowledge source materials and answers nuanced regional protocol questions. 1. **Addressing embedding calculations and model hallucination risks** (44:43) — Retaining source links in graphical interfaces helps users verify AI-generated answers and mitigate factual discrepancies. 1. **Navigating ethical development and selecting integration frameworks** (47:27) — Implementing content filters and tracking framework updates helps developers manage inevitable behavioral biases in rapid deployment cycles. ## Related Moments - [Understanding basic retrieval-augmented generation architectures in chatbots](https://www.wearedevelopers.com/videos/1130-chatbots-are-going-to-destroy-infrastructures-and-your-cloud-bills) (from "Chatbots are going to destroy infrastructures and your cloud bills") - [Implementing text chunking and retrieval augmented generation](https://www.wearedevelopers.com/videos/1513-best-practices-building-enterprise-applications-that-leverage-genai) (from "Best practices: Building Enterprise Applications that leverage GenAI") - [Expanding AI capabilities using retrieval-augmented generation](https://www.wearedevelopers.com/videos/950-supercharge-your-cloud-native-applications-with-generative-ai) (from "Supercharge your cloud-native applications with Generative AI") - [Reviewing the basic retrieval-augmented generation pipeline](https://www.wearedevelopers.com/videos/1235-carl-lapierre-exploring-advanced-patterns-in-retrieval-augmented-generation) (from "Carl Lapierre - Exploring Advanced Patterns in Retrieval-Augmented Generation") - [Exploring common use cases for modern generative AI](https://www.wearedevelopers.com/videos/1141-building-ai-driven-spring-applications-with-spring-ai) (from "Building AI-Driven Spring Applications With Spring AI") - [Demonstrating semantic latency reductions using Spring AI configurations](https://www.wearedevelopers.com/videos/1714-reducing-llm-calls-with-vector-search-patterns-raphael-de-lio-redis) (from "Reducing LLM Calls with Vector Search Patterns - Raphael De Lio (Redis)") ## Related Articles - [WWC24 Talk - Scott Hanselman - AI: Superhero or Supervillain?](https://www.wearedevelopers.com/magazine/469-wwc24-talk-scott-hanselman-ai-superhero-or-supervillain) - [MLOps And AI Driven Development](https://www.wearedevelopers.com/magazine/82-mlops-and-ai-driven-development) - [SEO in an AI world - Google vs. ChatGPT and survival tips for content creators](https://www.wearedevelopers.com/magazine/534-seo-in-an-ai-world-google-vs-chatgpt-and-survival-tips-for-content-creators) - [Dev Digest 132 - Binging WADFlix?](https://www.wearedevelopers.com/magazine/473-dev-digest-132-binging-wadflix) ## Related Jobs - [AI Software Engineer (Germany)](https://www.wearedevelopers.com/jobs/48317-ai-software-engineer-germany) at **Sunhat** - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/319507-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/381484-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/353953-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [AI & Machine Learning Engineer (all genders)](https://www.wearedevelopers.com/jobs/48217-ai-machine-learning-engineer-all-genders) at **msg** - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub**