Azure AI is a powerful tool that can help you build a smarter future. With its advanced capabilities, you can create a tool that can learn from data and make predictions or decisions on its own.
By leveraging Azure's machine learning and natural language processing capabilities, you can build a tool that can understand and respond to user input in a more personalized way. For example, you can use Azure's language understanding to build a chatbot that can have a conversation with a user and provide them with relevant information.
Azure AI also offers a range of pre-built models and tools that you can use to get started with building your tool. These models and tools can help you with tasks such as image and speech recognition, and can even help you to build a tool that can generate text or images on its own.
Explore further: Azure Cognitive Search
Azure AI Services
Azure AI Services offer a range of capabilities to enhance your applications and experiences. You can develop bots with the Azure Bot Service, which enables Q&A bots and branded virtual assistants. Azure Cognitive Search allows you to search through data and content, while Form Recognizer extracts key information from forms and receipts.
Azure Cognitive Services can be categorized into four core areas: Computer Vision, Language, Speech, and Decision Making. Computer Vision can convert hand-written and printed documents to digital format, while Language capabilities enable applications to understand natural language and translate over 70 languages. Speech processing can translate text to speech, speech to text, or create a virtual assistant.
You can leverage Azure AI Services to create a ChatGPT-like frontend experience over your own documents using RAG (Retrieval Augmented Generation). This solution uses Azure OpenAI Service to access GPT models and Azure AI Search for data indexing and retrieval.
Curious to learn more? Check out: Azure Storage Services
Integrate OpenAI Service
You can use the Azure OpenAI SDK to consume your deployed model. To do this, you'll need to add the Azure OpenAI package to your code file, which involves replacing a comment with code specific to your language of choice.
In Python, this means adding the line `from openai import AzureOpenAI` to your code file, while in C#, you'll replace the comment with `using Azure.AI.OpenAI;`. This step is crucial for accessing the Azure OpenAI service in your application.
Once you've added the package, you'll need to initialize the Azure OpenAI client. This involves creating an instance of the client using your Azure OpenAI endpoint and API key. For example, in Python, you'll use the line `client = AzureOpenAI(azure_endpoint=azure_oai_endpoint, api_key=azure_oai_key, api_version="2024-02-15-preview")`, while in C#, you'll use `OpenAIClient client = new OpenAIClient(new Uri(oaiEndpoint), new AzureKeyCredential(oaiKey));`.
To send a request to the Azure OpenAI model, you'll need to build a completion options object. This object specifies the various parameters for your model, such as messages and temperature. For example, in Python, you might use the following code: `response = client.chat.completions.create(model=azure_oai_deployment, temperature=0.7, max_tokens=400, messages=[{"role": "system", "content": system_message}, {"role": "user", "content": input_text}])`.
Here's a summary of the steps to integrate the OpenAI service:
By following these steps, you'll be able to integrate the OpenAI service into your application and start using its powerful language capabilities.
Applied AI Services
Azure's Applied AI Services are a game-changer for businesses and organizations. They enable you to develop bots that can enhance your customer and employee experience with Q&A bots or create your own branded virtual assistant.
Azure Bot Service is a key component of these services, allowing you to create bots that can answer frequently asked questions and provide a personalized experience for customers and employees. GE Aviation uses Azure Computer Vision to convert hand-written and printed documents to digital format, modernizing their maintenance records system.
Azure Cognitive Search is another powerful tool that enables you to search through data and content, utilizing all the resources in your organization. It includes application programming interfaces (APIs) and tools to help your search experience. This feature is especially useful for large organizations with a vast amount of data.
Form Recognizer extracts key information from forms and receipts, saving time and automating data extraction from reports, forms, and other documents. This feature is a huge time-saver for businesses that deal with a lot of paperwork.
Metrics Advisor monitors the performance of your organization's growth engines, from sales revenue to manufacturing operations. It helps identify and fix problems through real-time monitoring, adapting models to your scenario, and offering detailed analysis with diagnostics and alerting. This feature is essential for businesses that want to stay ahead of the competition.
For your interest: Create Azure Data Lake Storage Gen2
Azure-Samples/Search-Demo
Azure-Samples/Search-Demo is a great example of how Azure AI Services can be used for search functionality.
This demo uses Azure Cognitive Search to build a custom search experience that can be integrated with various applications.
Azure Cognitive Search is a cloud-based search service that allows you to easily add search capabilities to your applications.
It provides a scalable and secure way to search and filter large volumes of data.
The Azure-Samples/Search-Demo showcases how to use Azure Cognitive Search with a .NET Core web application.
You can find the code for this demo on GitHub, making it easy to replicate and experiment with.
Related reading: What Is Azure Cognitive Search
Project Setup
To create a project in Azure AI Studio, you'll need to follow these steps: Go to Azure AI Studio, select + Create project, enter a name for the project, and if you have a hub, select it.
You can also create a project using the Azure CLI. To do this, you'll need to use the code from the Azure AI Studio documentation, which includes the following: `from azure.ai.ml.entities import Project`. This code will create a project from a hub you or your administrator created previously.
To create a project, you'll need to replace the example string values with your own values, including `my_project_name`, `my_display_name`, `hub_name`, `subscription_id`, and `resource_group`.
Consider reading: Dropbox Ai Search
Provision a Resource
To provision a resource for Project Setup, you'll need to sign into the Azure portal at https://portal.azure.com. This is the first step in setting up your Azure OpenAI resource.
Azure OpenAI resources are constrained by regional quotas, so it's a good idea to randomly choose a region to reduce the risk of hitting a quota limit. The listed regions include default quota for the model type(s) used in this exercise.
To create an Azure OpenAI resource, go to the Azure portal and follow these steps:
- Create an Azure OpenAI resource with the following settings:
- Azure OpenAI resources are constrained by regional quotas. The listed regions include default quota for the model type(s) used in this exercise.
- Wait for deployment to complete.
Project
To create a project in Azure AI Studio, you'll need to select + Create project. This will prompt you to enter a name for the project.
You can also create a project using the Azure CLI or Python SDK. The code to create a project from a hub you or your administrator created previously is quite straightforward: from azure.ai.ml.entities import Project.
To use this code, replace example string values with your own values, such as project name, display name, and hub name. The hub name should be the Azure resource manager ID of the hub.
Here are the tools you'll need to create a project:
- Azure AI Studio
- Python SDK
- Azure CLI
If you're creating a project for the first time, a default hub is created for you. You can customize the default values if you want.
Access Project Resources
When you create a project, you'll have access to a range of resources that are shared with your project on the hub. This includes connections, compute instances, and network access, making it easy to start developing right away.
Common configurations on the hub are shared with your project, including connections, compute instances, and network access.
You'll also have access to components such as datasets, flows, indexes, and deployed model API endpoints, which are only accessible by users in your project workspace.
Components include datasets, flows, indexes, deployed model API endpoints (open and serverless).
Connections created by you under 'project settings' are also accessible.
A number of resources are only accessible by users in your project workspace, including Azure Storage blob containers and a fileshare for data upload within your project.
Azure Storage blob containers, and a fileshare for data upload within your project. Access storage using the following connections:
Storage connections are not created directly with the project when your storage account has public network access set to disabled.
Machine Learning
Azure's Machine Learning platform allows you to quickly build, train, and deploy advanced or no-code machine learning models for all experience levels.
With a drag-and-drop experience, you can create models without knowing anything about coding. Experienced users can also use code to create machine learning models through Azure's Machine Learning platform.
This platform offers flexibility and accessibility, making it an ideal choice for organizations looking to leverage machine learning technology.
Here's an interesting read: How to Create Vm in Azure
A Smarter Future
Creating a tool that uses Azure AI can help businesses set themselves apart by providing immersive, frictionless, and personalized experiences for their consumers.
In a competitive market, it's crucial to stand out from the crowd, and Azure AI can help achieve that.
With Azure AI, businesses can create a smarter future for their customers by offering them experiences that are tailored to their needs and preferences.
By leveraging Azure AI, companies can reduce friction and make interactions more seamless, leading to increased customer satisfaction.
In the case of a sports team, providing fans with immersive experiences was a top priority, and Azure AI helped them achieve that goal.
18 minutes of reading time is a significant investment, but the payoff can be substantial, especially when it comes to creating a tool that uses Azure AI.
Azure AI can help businesses create a more personalized experience for their customers, which can lead to increased loyalty and retention.
Azure-Samples and Features
Azure provides a wide range of pre-built samples and features that make it easier to get started with AI development. You can find these samples on the Azure GitHub repository, which contains over 1000 open-source projects.
The Azure AI Gallery is another valuable resource, offering a collection of pre-trained models and datasets that can be used to build AI solutions. These models and datasets are suitable for various tasks, including image classification, object detection, and natural language processing.
One of the most popular Azure AI features is the Cognitive Services API, which provides access to a range of AI capabilities, such as text analysis, image recognition, and speech synthesis. This API is built on top of the Azure Machine Learning platform, which allows you to train and deploy your own AI models.
Azure also offers a range of AI-powered tools, including the Azure Machine Learning service, which provides a managed platform for building, training, and deploying machine learning models. The service includes a range of pre-built templates and wizards to help you get started with AI development.
Related reading: Azure Create New App Service
Deployment and Troubleshooting
To deploy a model using Azure AI Foundry portal, start by going to the Overview page for your Azure OpenAI resource and selecting the button to go to AI Foundry portal. You can then create a new deployment of the gpt-35-turbo-16k model with a rate limit of 5,000 tokens per minute.
If you encounter issues, Azure AI Foundry portal may display message boxes suggesting tasks for you to perform. You can close these and follow the steps in the exercise.
Common failure scenarios when deploying a model include subscription access issues, region incompatibility, quota exceeding, and resource conflicts. To resolve these issues, ensure your subscription ID matches the ID specified in the OpenAI access request process, check the model availability matrix, review quotas and limits, and purge resources from soft delete.
For another approach, see: Create an Ai Model in My Azure Tenant
Deploying
Deploying a model to Azure OpenAI requires some setup, but don't worry, it's straightforward. You'll start by logging into your Azure account, which you can do by running the command `azd auth login` in your terminal.
To create a new environment, run `azd env new` and enter a name for your resource group. This will create a new folder in the `.azure` folder and set it as the active environment for any calls to `azd` going forward.
A fresh viewpoint: Azure Devops Create New Area
You can customize the deployment by setting environment variables, but this step is optional. Simply run `azd up` to provision Azure resources and deploy your model to those resources.
It may take 5-10 minutes for the application to be fully deployed, so be patient and refresh the page if you see a "Python Developer" welcome screen or an error page.
Here are the steps to deploy a model in Azure OpenAI:
- Login to your Azure account: `azd auth login`
- Create a new azd environment: `azd env new`
- Run `azd up` to provision Azure resources and deploy your model
After deployment, you'll see a URL printed to the console. Click that URL to interact with the application in your browser.
Troubleshooting
Troubleshooting can be a real pain, but don't worry, I'm here to help. The first thing to check is that your subscription has access to the Azure OpenAI service. If it doesn't, make sure the AZURE_SUBSCRIPTION_ID matches the ID specified in the OpenAI access request process.
You might also be trying to create resources in regions that aren't enabled for Azure OpenAI. For example, if you're trying to use East US 2 instead of East US, you'll run into issues. Check the model availability matrix to see if the region you're using is supported.
Another common problem is exceeding a quota, which is usually the number of resources per region. If you're hitting this limit, check the article on quotas and limits to see how to increase your allowance.
If you're getting "same resource name not allowed" conflicts, it's probably because you've been running the sample multiple times and forgetting to purge the resources you've created. Azure keeps resources for 48 hours unless you purge from soft delete, so make sure to do that.
CERTIFICATE_VERIFY_FAILED errors can be tricky, but they're usually caused by incorrect SSL certificates setup on your machine. Try the suggestions in the StackOverflow answer to fix the issue.
If you're seeing a '404 Not Found' after running azd up and visiting the website, don't worry, it's probably just taking a bit longer to start up. Wait 10 minutes and try again, and if you still encounter errors, consult the guide on debugging App Service deployments.
Here are some common failure scenarios and their solutions:
- The subscription (AZURE_SUBSCRIPTION_ID) doesn't have access to the Azure OpenAI service. Please ensure AZURE_SUBSCRIPTION_ID matches the ID specified in the OpenAI access request process.
- You're attempting to create resources in regions not enabled for Azure OpenAI (e.g. East US 2 instead of East US), or where the model you're trying to use isn't enabled. See this matrix of model availability.
- You've exceeded a quota, most often number of resources per region. See this article on quotas and limits.
- You're getting "same resource name not allowed" conflicts. That's likely because you've run the sample multiple times and deleted the resources you've been creating each time, but are forgetting to purge them. Azure keeps resources for 48 hours unless you purge from soft delete. See this article on purging resources.
- You see CERTIFICATE_VERIFY_FAILED when the prepdocs.py script runs. That's typically due to incorrect SSL certificates setup on your machine. Try the suggestions in this StackOverflow answer.
- After running azd up and visiting the website, you see a '404 Not Found' in the browser. Wait 10 minutes and try again, as it might be still starting up. Then try running azd deploy and wait again. If you still encounter errors with the deployed app and are deploying to App Service, consult the guide on debugging App Service deployments. Please file an issue if the logs don't help you resolve the error.
Frequently Asked Questions
How do I make a chatbot with Microsoft Azure AI?
To create a chatbot with Microsoft Azure AI, navigate to the Azure portal and follow the steps to create a bot resource, starting with searching for "bot" in the search box. This will guide you through the setup process to create and configure your chatbot.
How to create generative AI in Azure?
To create generative AI in Azure, access the unified model catalog to leverage pretrained models from top providers, and then build or fine-tune models to suit your needs. This process enables you to operationalize workflows and unlock the full potential of generative AI.
Sources
- https://microsoftlearning.github.io/mslearn-openai/Instructions/Exercises/02-natural-language-azure-openai.html
- https://learn.microsoft.com/en-us/azure/ai-studio/how-to/create-projects
- https://www.proserveit.com/blog/microsoft-ai-artificial-intelligence-solutions
- https://github.com/Azure-Samples/azure-search-openai-demo
- https://dev.to/seenakhan/build-a-responsible-ai-career-counselor-copilot-with-azure-content-safety-service-2ik2
Featured Images: pexels.com