Step-By-Step Tutorial To Integrate OpenAI With Azure Cognitive Search (Vector Search)

Shweta Lodha
13 min readOct 4, 2023

In this article, I’ll explain how you can use Azure Cognitive Search with OpenAI, but before that let’s understand the role of each of these major components.

Azure Cognitive Search

This is an offering from Azure where we can store our data as high-dimensional vectors where each vector has a certain number of dimensions. This search service has a capability to perform both text and vector search, but in this article, I will be focusing only on the vector search capability.

OpenAI

OpenAI provides APIs which can be used to create interactive chatbots and virtual assistants that can carry out conversation in a natural manner. It works with prompts of various sizes based on the selected AI model.

As OpenAI is a prompt-based system, the user is charged based on the number of tokens, which means we have to be careful while sending data to the OpenAI API. We cannot pass huge text file in a single shot, just to get the answer to one question. Rather, it is suggested to pass only the relevant content to the API and to get that relevant content, we are using Azure Cognitive Search.

With this much of background, let’s jump on to the key steps and understand how both of these systems can talk to each other.

Create An Instance Of Cognitive Search

--

--