Skip to content

refactor: replace openai sdk with foundrysdk#344

Merged
Avijit-Microsoft merged 5 commits intodevfrom
psl-foundrysdkcps
Nov 28, 2025
Merged

refactor: replace openai sdk with foundrysdk#344
Avijit-Microsoft merged 5 commits intodevfrom
psl-foundrysdkcps

Conversation

@Rafi-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request migrates the content processing pipeline from using the OpenAI SDK to the new Azure AI Foundry (Inference) SDK, updates dependencies, and refactors related code to accommodate the new SDK’s response format. It also improves the confidence merging logic and updates infrastructure permissions for Azure AI Developer role.

SDK Migration and Dependency Updates

  • Replaced the openai SDK with azure-ai-inference throughout the codebase, updating both requirements.txt and pyproject.toml to remove openai and add azure-ai-inference. [1] [2]
  • Refactored the Azure OpenAI client logic in azure_openai.py to use ChatCompletionsClient from the Azure AI Foundry SDK and updated endpoint handling.

Pipeline Handler Refactoring

  • Updated map_handler.py to invoke the Azure AI Foundry client for completions, handle schema validation, and serialize responses in the new format, including logprobs and usage details. [1] [2] [3]
  • Refactored evaluate_handler.py to deserialize and process responses according to the new Azure AI Foundry format, including changes to how confidence scores and token usage are extracted. [1] [2] [3]

Confidence Logic Improvements

  • Enhanced the confidence merging logic in confidence.py to merge keys from both input dictionaries, ensuring no data loss if keys are present in only one input.
  • Updated the confidence evaluator to work with the new Azure AI Foundry response structure, replacing attribute access with dictionary access. [1] [2]

Configuration and Infrastructure Updates

  • Added new configuration option for the AI Foundry project endpoint in application_configuration.py. [1] [2]
  • Updated Bicep infrastructure to grant the Azure AI Developer role to the container app’s managed identity for access to AI Foundry resources.

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 changed the title perf: replace openai sdk with foundrysdk refactor: replace openai sdk with foundrysdk Nov 28, 2025
@Avijit-Microsoft Avijit-Microsoft merged commit f6a9f96 into dev Nov 28, 2025
6 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2025

🎉 This PR is included in version 1.11.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Priyanka-Microsoft Priyanka-Microsoft deleted the psl-foundrysdkcps branch December 25, 2025 09:08
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.

2 participants