Introduction
Data is everywhere. It is the fuel that powers our businesses, our research, our innovation, and our lives. But data is also complex, diverse, and often unstructured. Azure OpenAI Service emerges as a game-changer in this realm, offering a transformative approach to data interaction by enabling users to converse with their data in natural language.
With Azure OpenAI Service models, you can ask questions, explore scenarios, generate summaries, and more, using the power of OpenAI's natural language understanding and Large Language Models (LLMs). The same as the original ChatGPT from OpenAI, but you can retrieve insights from your data in a conversational manner, much like having a dialogue with a knowledgeable colleague, leveraging enterprise-grade security. If you are interested in the differences between Azure OpenAI and OpenAI, here is the documentation.
This article marks the third installment in our series, focusing on the synergy between search technology and artificial intelligence. While reading the previous two articles is not a mandatory prerequisite, I highly recommend doing so. This will provide you with valuable context and insights into how Azure OpenAI Service significantly amplifies the concepts and capabilities of Azure Cognitive Search we have explored in our earlier discussions. In this tutorial, I will demonstrate how to harness the capabilities of Azure OpenAI Service by utilizing an index from Azure Cognitive Search to create your own ChatGPT.
This tutorial covers the following topics:
- How to create and use Azure OpenAI Service.
- How to load your data and craft your own ChatGPT.
- How to converse and interact with the data in the Playground Chat.
Pre-requisites
- To follow along with this tutorial, you will need an Azure Subscription, you can get one here, or if you are a student, you can create one with Azure for students.
- As part of Microsoft's commitment to responsible AI, to use Azure OpenAI Service, you must first fill out this form. You can read more about the limited access here.
Step 1. How to create and use Azure OpenAI Service
While I could explain this from scratch, there is an existing article from Janarthanan Selvaraj explaining it, so you can simply follow it to deploy the gpt-35-turbo model and familiarize yourself with the Azure AI Studio UI. If you are already familiar with it and have successfully deployed the model, you are all set to proceed.
Step 2. How to load your data and craft your own ChatGPT
Before we delve into the exciting capabilities of Azure OpenAI Service, it is crucial to have an existing index set up in Azure Cognitive Search. If you have not created one yet, be sure to set up a basic index to follow along effectively. I recommend referring to the second article in this series. It offers a step-by-step guide spanning steps 1 to 3 to help you set up an index with sample data effectively.
Once you have completed the index setup, return to Azure OpenAI Studio. Here, you can proceed by clicking on Try it now from the Bring your own data card or by selecting Chat and then navigating to the Add your data (preview) tab.
Figure 1. Main screen
In the subsequent window, you will encounter options to choose your Data Source, including Azure Cognitive Search, Azure Blob Storage, or Upload Files. Select Azure Cognitive Search.
Figure 2. Data Source
From your subscription, select the appropriate index from your Azure Cognitive Search service.
Figure 3. Select your index from your service
In the Data field mapping step select Description as Content data, HotelId as File name, and HotelName as Title. While you can select multiple fields for Content data, for the simplicity of this tutorial, use only Description.
Figure 4. Data field mapping
Optionally, you can add existing semantic search configuration in the Data Management step.
Figure 5. Data management.
We discussed semantic search in the previous articles so if you are interested in, take a look at them. To be honest, since Azure OpenAI uses its own AI capabilities, I did not see any difference in adding the existing semantic search we created before so skip it.
Lastly, Review and Finish, click Save and close when done. You should see a new data source added to the Assistant setup. Observe that you have the option to limit responses to your data content, ensuring that responses are derived exclusively from a trusted source. If you opt to uncheck this option, the service may combine your data with the existing knowledge from the selected model.
Figure 6. Data loaded into the playground.
Step 3. How to converse and interact with the data in the Playground Chat
As a reminder, in the first article from the series. We used the Search Explorer from Azure Cognitive Search to interact with the data by using a query as shown in Figure 7. We also saw that Semantic Search enabled us to make more complex queries using natural language. However, the results from these queries typically yielded JSON documents, which is not necessarily bad, but it implies that you must put extra effort into creating an application in any programming language to present the information in a human-readable format, like creating some front-end or UI to facilitate understanding, filtering, and the concepts covered in the second article.
Figure 7. Search Explorer from Azure Cognitive Search
What if there was a way to let the AI digest all of the returned results and simply converse with the AI in a chat? Then, that is what this article covers.
To evaluate an expression in the playground, navigate to the Chat section in the left pane.
Figure 8. Chat Playground
You have the option to either retain the default System message or customize it to suit your specific needs. For instance, you can define the system message as “You are an AI assistant that helps people find hotels according to their needs”. In the Chat session card write something like “Hello! I’m looking for a hotel that offers gaming services. Can you assist me with some recommendations or provide information about available options?”. The Chat will leverage your Azure Cognitive Search index to retrieve data from your database, processing it through the gpt-35-turbo model. This process will result in the generation of a user-friendly sentence containing the requested information, meeting the user's needs as shown in Figure 9.
Figure 9. Chat session with an example of a user interacting with the data through the Chat Playground
Take a look at the output message from Figure 9 and compare it with the JSON document from Figure 7. Both systems suggested Travel Resort for a user looking for gaming activities.
Additionally, Azure OpenAI Service conveniently provides references to the source of the information. Refer back to Figure 4, you will notice, there is a field to easily add URLs to link content from your data and give the user the easiness to access the source of the information. Much like the way Bing Chat does it.
Looking ahead, future enhancements in performance can be achieved through fine-tuning the base model or by introducing additional AI capabilities to the index, such as semantic search or AI enrichments.
Summary
In this article, we explored the transformative capabilities of Azure OpenAI Service in the realm of data interaction, offering a transformative approach that empowers users to converse with data in natural language. This article, the third in our series on the synergy between search technology and AI, showcased how Azure OpenAI Service amplifies the capabilities of Azure Cognitive Search. The article guided you through the process of creating your own ChatGPT, loaded with your data. You learned how to converse with your data.
Conclusion
Azure OpenAI Service’s ability to facilitate conversational data interaction has the potential to transform everything. In the realm of customer support, teams can utilize Azure OpenAI Service for instant customer assistance, reducing response times and enhancing satisfaction. Healthcare professionals benefit from its capacity to analyze patient records, aiding in diagnosis and medical research. Legal professionals find it invaluable for efficient legal research, and e-commerce platforms can use it to provide personalized product recommendations and conversational shopping assistance. Content creators and educators can streamline their work by using Azure OpenAI Service for content generation, summarization, e-learning assistance, and automated assessment.
This service's secure and enterprise-ready nature, combined with its versatile use cases, positions it as a powerful tool for organizations and individuals looking to extract meaningful insights and drive data-driven decision-making.