
Unlocking Creativity with Azure OpenAI
By :

In this chapter, we installed the necessary tools on our local machine, including Python, the Azure Developer CLI, Node.js, Git, and PowerShell. We also ensured we had an Azure account and subscription with access to the Azure OpenAI service. Additionally, we made sure to have a basic understanding of Azure services and Python.
Next, we focused on building the solution using Azure Cognitive Search and Azure OpenAI Service. We worked within a Jupyter notebook to develop the code. We started by importing the required packages, such as openai
, os
, and dotenv.load_dotenv
. Then, we loaded the .env
file and extracted the necessary variables, such as OPENAI_API_KEY
, OPENAI_DEPLOYMENT_ENDPOINT
, and others. We initialized Azure OpenAI with these variables.
After setting up the environment, we generated a function to add names to a database based on a provided prompt. Following that, we created a SQL query to retrieve all records from the database we had just created. Finally,...