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 AI Search
Azure Machine Learning
Authentication
All SDKs support Microsoft Entra ID authentication usingDefaultAzureCredential:
Ensure you’re logged in with Azure CLI:
az loginAzure 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:Full-Text Search
Vector Search
Hybrid 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
Use Managed Identity
Use Managed Identity
In production, use managed identity instead of API keys:
Connection Pooling
Connection Pooling
Reuse client instances for better performance:
Async Operations
Async Operations
Use async clients for better concurrency:
Package References
Related Resources
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