Skip to main content

Python SDK Overview

The Python SDKs provide comprehensive access to Azure AI services including Foundry Local, Azure Machine Learning, and Azure AI Search. This guide covers installation, authentication, and usage examples.

Installation

Azure AI Foundry SDK

Install the Azure AI Projects client library:

Foundry Local SDK

Azure Machine Learning

Authentication

All SDKs support Microsoft Entra ID authentication using DefaultAzureCredential:
Ensure you’re logged in with Azure CLI: az login

Azure AI Foundry

Project Client

Connect to your Azure AI Foundry project:

Chat Completions

Use the OpenAI-compatible client for model inference:

List Connections

Retrieve project connections:

Enable Tracing

Enable application tracing for debugging:

Foundry Local

FoundryLocalManager

Manage local AI models:

Model Information

Access detailed model metadata:

OpenAI Integration

Use Foundry Local with the OpenAI SDK:

Cache Management

Azure AI Search

Search Client

Connect to Azure AI Search:
Combine full-text and vector search:

Upload Documents

Azure Machine Learning

ML Client

Connect to Azure ML workspace:

Register Model

Create Online Endpoint

Deploy Model

Submit Training Job

Monitor Job

Azure AI Services

Speech to Text

Text to Speech

Content Safety

Error Handling

Handle common errors gracefully:

Best Practices

In production, use managed identity instead of API keys:
Reuse client instances for better performance:
Use async clients for better concurrency:

Package References

REST API Reference

Foundry REST API documentation

JavaScript SDK

JavaScript and TypeScript SDK

.NET SDK

C# and .NET SDK reference

Azure CLI

Command-line tools