Skip to content

Conversation

@Rafi-Microsoft
Copy link
Contributor

@Rafi-Microsoft Rafi-Microsoft commented Oct 31, 2025

Purpose

This pull request migrates the codebase from the legacy OpenAI SDK to the new Azure AI Foundry (Inference) SDK for all AI model interactions, including chat completions and embeddings. It updates both infrastructure and Python scripts to use the new SDK, refactors utility functions, and adjusts outputs in Bicep templates to match the new resource naming conventions. These changes modernize the AI integration, improve authentication via managed identities, and ensure compatibility with Azure's latest AI services.

Migration to Azure AI Foundry (Inference) SDK:

  • Replaced all instances of openai and AzureOpenAI with azure.ai.inference.ChatCompletionsClient and EmbeddingsClient in Python scripts, updating imports and client initializations accordingly. [1] [2] [3]
  • Refactored embedding and chat completion utility functions to use the new Inference SDK clients, simplifying authentication and endpoint construction for managed identity. [1] [2] [3]
  • Updated all usages of chat and embedding model calls to use the new client methods (complete and embed), removing legacy token provider logic and OpenAI-specific parameters. [1] [2] [3] [4] [5] [6] [7] [8]

Infrastructure and configuration updates:

  • Modified Bicep output variables for Azure AI Search to use the correct resource names and endpoints, aligning with the new deployment model.
  • Updated SQL Server output in Bicep to append environment-specific suffixes for improved resource naming.
  • Added new dependencies for azure-ai-inference and azure-ai-projects to requirements.txt.

API service and agent changes:

  • Updated API service files to remove legacy OpenAI imports and switch to Foundry SDK clients, including adjustments to configuration and initialization logic. [1] [2] [3]

General modernization and error handling:

  • Improved error handling in embedding utility functions to provide clearer logging and robustness during vector generation. [1] [2]

These changes collectively ensure the project is using Azure's latest AI SDKs and resource conventions, improving maintainability and future compatibility.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

@Avijit-Microsoft Avijit-Microsoft merged commit 130cc02 into dev Nov 13, 2025
5 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.15.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Harmanpreet-Microsoft Harmanpreet-Microsoft deleted the psl-km-foundrysdkapi branch January 2, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants