Building generative AI applications involves working with a wide range of language models from diverse providers.
- Language models can be large (LLM) or small (SLM) in terms of model size and complexity.
- Models can be proprietary (e.g., GPT-4 from OpenAI) or open-source (e.g., GPT-2 from HuggingFace).
- Models can differ in their capabilities (text generation, embedding) and API features (config parameters, system prompt, stop words etc.)
This creates a challenge for AI application developers when interacting with these models - particularly when they want to evaluate diverse models, or switch to a different model later.
The Azure AI Model Inference API tries addresses this challenge by providing a unified API that abstracts the differences between the various models into common API calls for convenience - while providing extensibility to support model-specific features.
Developers can now focus on building their applications for a specific capability without worrying about how that capability is implemented in a specific model instance.
In this workshop, we'll explore the Azure AI Model Inference API from core concepts to applied usage with various models and inference tasks.
By the end of the workshop you should be able to:
- Describe the Azure AI Inference API capabilities
- Describe the benefits of using the unified API
- Configure your application to use the unified API
- Use Inference API with diverse deployed models
- Ensure responsible AI with content safety tooling
- Python 3.8 or higher
- Azure Subscription
- Model Deployments (Azure AI Studio)
- Authentication Credentials
Model deployments will have default key, endpoint, region properties.
- Use endpoint for initializing the inference API library.
- Use key to create a traditional authentication credential if preferred.
- Alternatively, use Microsoft Entra ID (32-character string) for a secure managed identity solution.
Check out the samples README for updated requirements.
Currently, we can deploy models in the Azure AI platform in one of two ways:
- Managed Compute Endpoints - using Models as a Platform (MaaP) with subscription based pricing for managed inference capability.
- Serveless API Endpoints - using Models As a Service (MaaS) with token-based billing for pay as you go inference capability.
Currently only a subset of these models are available for use with the Azure AI Inference API.
Azure Inference API | Managed | Serverless |
---|---|---|
Cohere Embed V3 family | - | ✅ |
Cohere Command R family | - | ✅ |
Meta LLama 2 chat family | - | ✅ |
Meta Llama 3 instruct family | ✅ | ✅ |
Phi-3 family | ✅ | ✅ |
Mistral-Small | - | ✅ |
Mistral-Large | - | ✅ |
Mixtral family | ✅ | ✅ |
- Docs - Azure AI Model Inference API
- Docs - Azure AI Inference Library (Python)
- Docs - AI Model Inferene Package (Python)
- Repo - Azure AI Inference Samples (Python)
- Docs - Deploy models .. with Azure AI Studio
- Video - Accelerate your AI Journey with Azure AI Model Catalog
- Slides - Accelerate your AI Journey with Azure AI Model Catalog
Step-by-step instructions will be provided in the docs/
folder. You can view the workshop guide in your browser by opening this repository in GitHub Codespaces (or Docker Desktop) then using this command:
mkdocs serve
This should start the dev server at http://localhost:8000
so you can preview the guide. You should also see a pop up a dialog with options to view the preview in the browser, or in the Visual Studio Code editor. If you miss the pop up, you can open the Visual Studio Code Terminal Ports
tab and use the options under the Forwarded Address column to take desired actions.