Skip to content
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