Create a Tool That Uses Azure AI to Build a Smarter Future

Author

Posted Oct 31, 2024

Reads 232

AI Multimodal Model
Credit: pexels.com, AI Multimodal Model

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.

Credit: youtube.com, How to use Microsoft Azure AI Studio and Azure OpenAI models

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.

Credit: youtube.com, How to use Microsoft Azure AI Studio and Azure OpenAI models

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.

Credit: youtube.com, AZ-900 Episode 16 | Azure Artificial Intelligence (AI) Services | Machine Learning Studio & Service

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.

Azure-Samples/Search-Demo

Credit: youtube.com, Demo - Azure Cognitive Search + Azure OpenAI service

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.

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

Credit: youtube.com, Resource Planning for Projects: A Guide - Project Management Training

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:

  1. Create an Azure OpenAI resource with the following settings:
  2. Azure OpenAI resources are constrained by regional quotas. The listed regions include default quota for the model type(s) used in this exercise.
  3. 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

Credit: youtube.com, 4. Creating a resource group and setting up access control | Azure Beginner Tutorials

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

Credit: youtube.com, Machine learning tools in Microsoft Azure | Machine Learning Essentials

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.

Credit: youtube.com, Be unstoppable: Introducing Azure AI Foundry

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.

Credit: youtube.com, Getting Started with Azure OpenAI and GPT Models in 6-ish Minutes

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.

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.

Credit: youtube.com, Azure AI Studio: Your Gateway to AI Innovation 🤖 #AzureBacktoSchool 2024

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

Credit: youtube.com, 🔴Troubleshooting deployments

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:

  1. Login to your Azure account: `azd auth login`
  2. Create a new azd environment: `azd env new`
  3. 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.

Credit: youtube.com, How to Start Troubleshooting Intune Policy Deployment Issues

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:

  1. 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.
  2. 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.
  3. You've exceeded a quota, most often number of resources per region. See this article on quotas and limits.
  4. 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.
  5. 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.
  6. 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.

Claire Beier

Senior Writer

Claire Beier is a seasoned writer with a passion for creating informative and engaging content. With a keen eye for detail and a talent for simplifying complex concepts, Claire has established herself as a go-to expert in the field of web development. Her articles on HTML elements have been widely praised for their clarity and accessibility.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.