Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Azure Chat Completions #4

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions openai/api_resources/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
from openai import util
from openai.api_resources.abstract.engine_api_resource import EngineAPIResource
from openai.error import TryAgain
from openai.util import ApiType


class ChatCompletion(EngineAPIResource):
engine_required = False
OBJECT_NAME = "chat.completions"

_azure_preview_version = "2023-03-15-preview"

@classmethod
def _get_api_type_and_version(
cls, api_type = None, api_version = None
):
api_type, base_api_version = super()._get_api_type_and_version()
if api_type in (ApiType.AZURE, ApiType.AZURE_AD):
# This override is only temporary: DallE and GPT endpoint versioning is currently out of sync but will be aligned soon.
return (api_type, api_version or ChatCompletion._azure_preview_version)
else:
return (api_type, base_api_version)

@classmethod
def create(cls, *args, **kwargs):
"""
Expand Down