Skip to content

Use the OpenAI SDK#86

Merged
sgoedecke merged 6 commits intomainfrom
sgoedecke/use-openai-sdk
Aug 5, 2025
Merged

Use the OpenAI SDK#86
sgoedecke merged 6 commits intomainfrom
sgoedecke/use-openai-sdk

Conversation

@sgoedecke
Copy link
Contributor

This PR switches from the Azure SDK to the OpenAI SDK. Unfortunately the Azure SDK automatically sets an apiVersion which is too early to make JSON schema responses work with some models. If we leave off apiVersion, the inference API will set it correctly, but the Azure SDK doesn't allow you to leave the version off entirely. Thus we're switching SDKs.

@sgoedecke sgoedecke marked this pull request as ready for review August 5, 2025 02:27
Copilot AI review requested due to automatic review settings August 5, 2025 02:27
@sgoedecke sgoedecke requested a review from a team as a code owner August 5, 2025 02:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates from the Azure SDK to the OpenAI SDK to resolve an issue where the Azure SDK automatically sets an apiVersion that is too early for JSON schema responses to work with some models. The OpenAI SDK allows for more flexible version handling by letting the inference API set the version correctly.

  • Replaces Azure REST AI Inference client with OpenAI SDK client
  • Updates type definitions to use more specific role types instead of generic strings
  • Removes Azure-specific error handling in favor of standard try-catch blocks

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/inference.ts Core migration from Azure to OpenAI SDK with updated client initialization and API calls
src/helpers.ts Removes Azure-specific error handling and updates message type definitions
package.json Replaces Azure dependencies with OpenAI SDK dependency
tests/inference.test.ts Updates test mocks and assertions to work with OpenAI SDK instead of Azure SDK
.licenses/npm/openai.dep.yml Adds license information for the new OpenAI dependency

@sgoedecke sgoedecke merged commit 0cbed4a into main Aug 5, 2025
23 checks passed
@sgoedecke sgoedecke deleted the sgoedecke/use-openai-sdk branch August 5, 2025 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants