In this post, we will show how to build AI applications using Azure AI Foundry and the benefits of using the SDK for Foundry.

Introduction

The world of Artificial Intelligence (AI) is expanding rapidly, and businesses are increasingly seeking ways to leverage this technology to gain a competitive edge. One powerful tool in this space is Azure Foundry AI. Designed to simplify the integration of AI into various business processes, Azure Foundry AI is a game-changer for companies looking to innovate and streamline their operations.

What is Azure AI Foundry

Azure AI Foundry is a comprehensive platform on Microsoft Azure designed to streamline AI solution development by providing centralized project organization, resource management, and advanced development tools.

It offers a web-based interface (Azure AI Foundry portal) for managing AI projects efficiently, along with an Azure AI Foundry SDK for programmatic solution development. The platform is structured around hubs and projects:

  • Hubs: Top-level containers managing shared resources, data, and security configurations.
  • Projects: Subsections within hubs, facilitating collaborative AI solution development.
  • Role Inheritance: Ensures seamless collaboration by inheriting permissions and resources from hubs to projects.

This hierarchical organization helps maintain efficient resource utilization while promoting secure collaboration.

Within Azure AI Foundry, hubs include essential Azure AI resources, such as Azure AI services, Key Vaults, and storage accounts. Projects under these hubs benefit from powerful tools, including:

  • Model Catalog: Machine learning models from Azure OpenAI, Hugging Face, and other sources.
  • Interactive Playgrounds: Experiment with generative AI models in a hands-on environment.
  • Model Fine-Tuning: Customize AI models with specific datasets.
  • Prompt Flow: Orchestrate AI interactions efficiently.
  • Development Environments: Integrated Visual Studio Code containers for coding and testing.
  • AI Assessments: Tools for tracing, evaluation, and content safety management.

This cohesive ecosystem allows developers to build, test, and deploy AI solutions effectively within a unified framework.

Getting Started with the Azure Foundry AI SDK

The Azure Foundry AI Software Development Kit (SDK) is a powerful tool that allows developers to build and deploy AI models quickly and efficiently.

Below, is a step-by-step guide to help you get started with the SDK for .NET using a C# console application

Step 1: Setting Up Your Environment

Before you can start using the Azure Foundry AI SDK, you need to set up your development environment. This involves creating a C# Console application and installing the necessary software and configuring your Azure account.

  • Set Up Your Azure Account: If you don’t already have an Azure account, you will need to create one. You can sign up for a free account, which provides access to a range of Azure services at no cost for the first 12 months.
  • Create a Hub, project and Azure OpenAI service (https://ai.azure.com)
  • Install the SDK: You can install the Azure Foundry AI SDK and related packages using the following:

Copy Connection String

The initial step in most Azure AI Foundry SDK code involves connecting to an Azure AI Foundry project. Each project possesses a unique connection string, which is available on the project’s Overview page in the Azure AI Foundry portal.

Code

Once you have installed the necessary packages and copied the connection string, you can proceed by adding the following code snippet to your application. This code snippet demonstrates how to set up the connection to your Azure AI Foundry project and initialize the necessary services.

 Make sure to replace the placeholder in line 3 with your actual connection string. Additionally, in line 29, insert the name of your GPT model, which can be found under the Model + endpoints section in the Azure AI Foundry portal.

Run Program

After handling exceptions, you can run the C# console application to test the integration and functionality of your AI-powered solutions.

The program’s output is displayed below.

Conclusion

Azure Foundry AI offers a powerful and flexible platform for integrating AI into your business processes.

By leveraging the capabilities of the Azure Foundry AI SDK, managers can drive innovation and efficiency within their organizations. Whether you are new to AI or an experienced developer, the tools and resources provided by Azure Foundry AI make it easier than ever to harness the power of Artificial Intelligence.

Follow this guide to start using Azure Foundry AI and transform your business with advanced AI technology.


Discover more from CPI Consulting Pty Ltd Experts in Cloud, AI and Cybersecurity

Subscribe to get the latest posts sent to your email.