Skip to content

[FIX] remove /v1 from path for azure openai#1056

Merged
VisargD merged 2 commits into
Portkey-AI:mainfrom
narengogi:fix/azure-openai-batches-and-files-incorrect-path
Apr 23, 2025
Merged

[FIX] remove /v1 from path for azure openai#1056
VisargD merged 2 commits into
Portkey-AI:mainfrom
narengogi:fix/azure-openai-batches-and-files-incorrect-path

Conversation

@narengogi
Copy link
Copy Markdown
Member

@narengogi narengogi commented Apr 23, 2025

Code Quality bug fix

Author Description

Description

🔄 What Changed

This PR removes the /v1 prefix from API paths for Azure OpenAI requests. The implementation now uses a direct string replacement approach instead of splitting the URL by /v1. Additionally, multiple duplicate case statements with identical implementations have been consolidated to improve code maintainability.

🔍 Impact of the Change

This change ensures proper URL construction when communicating with Azure OpenAI endpoints, fixing potential issues with API requests.

📁 Total Files Changed

1 file modified: src/providers/azure-openai/api.ts (3 additions, 16 deletions)

🧪 Test Added

N/A - No tests were added in this PR.

🔒 Security Vulnerabilities

N/A - No security vulnerabilities were addressed or introduced.

Motivation

Azure OpenAI API endpoints do not require the /v1 prefix in the path, and including it was causing issues with API requests.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

N/A

Quality Recommendations

  1. Add unit tests to verify the URL path handling for Azure OpenAI API requests

  2. Add comments explaining why /v1 needs to be removed from the path for Azure OpenAI

  3. Consider adding error handling for URL parsing to handle potential exceptions

  4. Add logging to track URL transformations for debugging purposes

@narengogi narengogi requested a review from sk-portkey April 23, 2025 13:22
@VisargD VisargD merged commit 874ab37 into Portkey-AI:main Apr 23, 2025
1 check passed
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.

2 participants