Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Header Handling for Azure-Specific Authorization #162

Merged
merged 6 commits into from
Sep 26, 2024

Conversation

Max-FM
Copy link
Contributor

@Max-FM Max-FM commented Sep 25, 2024

Description

This pull request fixes #161 by updating header management for Azure-specific authorization requirements in both the lib/modelHelpers.py and Images/ai-images.py files.

Changes

  1. lib/modelHelpers.py:

    • Moved header setup: The Authorization and Content-Type headers were moved closer to the request execution.
    • Conditional logic for Azure endpoints: For Azure endpoints, the api-key header is used instead of Authorization. Non-Azure endpoints continue using the Authorization header.
  2. Images/ai-images.py:

    • Modified header setup: Added conditional logic to handle the api-key header for Azure and Authorization for OpenAI.

Note

While the headers have been updated for Azure compatibility, image generation will still not function with Azure, as the endpoint remains hardcoded to OpenAI. A future PR will be required to support Azure image generation.

@Max-FM Max-FM changed the title Fix azure endpoint header Fix Header Handling for Azure-Specific Authorization Sep 25, 2024
@Max-FM Max-FM marked this pull request as ready for review September 26, 2024 02:01
@C-Loftus
Copy link
Owner

Thanks! Don't worry too much about image generation (fine either way though!) unless you are using it and want it. I think it's more of a novelty; wasn't even sure if it worked with Azure hence the hardcoding.

@C-Loftus C-Loftus merged commit 52bb75e into C-Loftus:main Sep 26, 2024
5 checks passed
@Max-FM Max-FM deleted the fix-azure-endpoint-header branch September 26, 2024 17:49
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.

Azure endpoints require a different header
2 participants