Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Azure AI Foundry SDK is a comprehensive toolchain designed to simplify the development of AI applications on Azure. It enables developers to:
- Access popular models from various model providers through a single interface
- Easily combine together models, data, and AI services to build AI-powered applications
- Evaluate, debug, and improve application quality & safety across development, testing, and production environments
The Azure AI Foundry SDK is a set of client libraries and services designed to work together.
Note
This article applies to a Foundry project. The code shown here doesn't work for a hub based project. For more information, see Types of projects.
Prerequisites
An Azure subscription. If you don't have one, create a free account.
Create a Foundry project if you don't have one already.
Sign in with the Azure CLI using the same account that you use to access your project:
az login
Important
Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Unified Projects client library
The Azure AI Foundry Projects client library is a unified library that enables you to use multiple client libraries together by connecting to a single project endpoint.
Install the project client library
pip install azure-ai-projects azure-ai-identity
Create a project client in code. Copy the Azure AI Foundry project endpoint from the Overview page of the project and update the connections string value.
from azure.identity import DefaultAzureCredential from azure.ai.projects import AIProjectClient project = AIProjectClient.from_connection_string( endpoint="your_project_endpoint", # Replace with your endpoint credential=DefaultAzureCredential())
Add these packages to your installation (preview):
com.azure.ai.projects
com.azure.core
Create a project client in code. Copy the Azure AI Foundry project endpoint from the Overview page of the project and update the connections string value.
import com.azure.ai.projects.ProjectsClient; import com.azure.ai.projects.ProjectsClientBuilder; import com.azure.core.credential.AzureKeyCredential; String endpoint ="your_project_endpoint"; // Replace with your endpoint ProjectsClient projectClient = new ProjectsClientBuilder() .credential(new DefaultAzureCredential()) .endpoint(endpoint) .buildClient();
Install dependencies (preview):
npm install @azure/ai-projects @azure/identity
Create a project client in code. Copy the Azure AI Foundry project endpoint from the Overview page of the project and update the connections string value.
import { AIProjectClient } from '@azure/ai-projects'; import { DefaultAzureCredential } from '@azure/identity'; const endpoint = "your_project_endpoint"; // Replace with your actual endpoint const project = new AIProjectClient(endpoint, new DefaultAzureCredential());
Install packages:
dotnet add package Azure.Identity dotnet add package Azure.Core dotnet add package Azure.AI.Inference
Create a project client in code. Copy the Azure AI Foundry project endpoint from the Overview page of the project and update the connections string value.
using Azure; using Azure.Identity; using Azure.AI.Inference; using Azure.Core; using Azure.Core.Pipeline; var endpointUrl = "your_project_endpoint"; // Replace with your actual endpoint var credential = new DefaultAzureCredential(); AzureAIInferenceClientOptions clientOptions = new AzureAIInferenceClientOptions(); BearerTokenAuthenticationPolicy tokenPolicy = new BearerTokenAuthenticationPolicy( credential, new string[] { "https://cognitiveservices.azure.com/.default" } ); clientOptions.AddPolicy(tokenPolicy, HttpPipelinePosition.PerRetry); var projectClient = new ChatCompletionsClient( endpointUrl, credential, clientOptions );
- Using the project endpoint, you can:
- Use Foundry Model, including Azure OpenAI
- Use Foundry Agent Service
- Run evaluations in the cloud
- Enable tracing for your app
- Retrieve endpoints and keys for external resource connections
Azure AI Services client libraries
To use Azure AI services, you can use the following client libraries with the endpoints listed on the project homepage.
C# supported services
Java supported services
Service | Description | Reference documentation |
---|---|---|
Add speech to text, text to speech, translation, and speaker recognition capabilities to applications. | • Speech SDK for Java • Speech Maven package |
|
Detect harmful content in applications and services. | • Content Safety SDK for Java • Content Safety Maven package |
|
Analyze content in digital images and rich media assets. | • Vision SDK for Java • Vision Maven package |
|
Build applications with natural language understanding capabilities. | • Language SDK for Java (text analysis) • Language Maven package |
|
Use AI-powered translation technology to translate more than 100 in-use, at-risk, and endangered languages and dialects. | • Translator SDK for Java (text) • Translator Maven package (text) |
|
Turn documents into intelligent data-driven solutions. | • Document Intelligence SDK for Java • Document Intelligence Maven package |
|
Bring AI-powered cloud search to your mobile and web apps. | • Azure AI Search SDK for Java • Azure AI Search Maven package |
JavaScript Supported Services
Service | Description | Reference documentation |
---|---|---|
Add speech to text, text to speech, translation, and speaker recognition capabilities to applications. | • Speech SDK for JavaScript • Speech npm package |
|
Detect harmful content in applications and services. | • Content Safety SDK for JavaScript • Content Safety npm package |
|
Analyze content in digital images and rich media assets. | • Vision SDK for JavaScript • Vision npm package |
|
Build applications with natural language understanding capabilities. | • Language SDK for JavaScript (text analysis) • Language npm package |
|
Use AI-powered translation technology to translate more than 100 in-use, at-risk, and endangered languages and dialects. | • Translator SDK for JavaScript (text) • Translator npm package (text) |
|
Turn documents into intelligent data-driven solutions. | • Document Intelligence SDK for JavaScript • Document Intelligence npm package |
|
Bring AI-powered cloud search to your mobile and web apps. | • Azure AI Search SDK for JavaScript • Azure AI Search npm package |