refactor(azure.py): working azure completion calls with openai v1 sdk

This commit is contained in:
Krrish Dholakia 2023-11-11 16:44:39 -08:00
parent d0bd932b3c
commit 39c2597c33
9 changed files with 70 additions and 58 deletions

View file

@ -3845,7 +3845,8 @@ def exception_type(
raise AuthenticationError(
message=f"AzureException - {original_exception.message}",
llm_provider="azure",
model=model
model=model,
response=original_exception.response
)
elif original_exception.status_code == 408:
exception_mapping_worked = True
@ -4225,7 +4226,6 @@ class CustomStreamWrapper:
raise ValueError(f"Unable to parse response. Original response: {chunk}")
def handle_azure_chunk(self, chunk):
chunk = chunk.decode("utf-8")
is_finished = False
finish_reason = ""
text = ""
@ -4299,7 +4299,6 @@ class CustomStreamWrapper:
def handle_openai_text_completion_chunk(self, chunk):
try:
# str_line = chunk.decode("utf-8") # Convert bytes to string
str_line = chunk
text = ""
is_finished = False