From 5b6c2e029195ab823c4ec68b91b9346689289c8e Mon Sep 17 00:00:00 2001 From: csgulati09 Date: Sat, 1 Jun 2024 01:34:51 +0530 Subject: [PATCH] hotfix: response type for chat completion for azure --- .../api_resources/types/chat_complete_type.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/portkey_ai/api_resources/types/chat_complete_type.py b/portkey_ai/api_resources/types/chat_complete_type.py index 078baf27..3c6ff3be 100644 --- a/portkey_ai/api_resources/types/chat_complete_type.py +++ b/portkey_ai/api_resources/types/chat_complete_type.py @@ -34,7 +34,7 @@ class DeltaToolCallFunction(BaseModel): class DeltaToolCall(BaseModel): - index: int + index: Optional[int] id: Optional[str] = None function: Optional[DeltaToolCallFunction] = None type: Optional[str] = None @@ -62,13 +62,13 @@ def __getitem__(self, key): class FunctionCall(BaseModel): - arguments: str - name: str + arguments: Optional[str] + name: Optional[str] class ChatCompletionMessageToolCall(BaseModel): id: Optional[str] - function: FunctionCall + function: Optional[FunctionCall] type: Optional[str] @@ -89,7 +89,7 @@ class ChatCompletionTokenLogprob(BaseModel): token: Optional[str] bytes: Optional[List[int]] = None logprob: Optional[float] - top_logprobs: List[TopLogprob] + top_logprobs: Optional[List[TopLogprob]] class ChoiceLogprobs(BaseModel): @@ -100,12 +100,12 @@ class Choice(BaseModel): finish_reason: Optional[str] index: Optional[int] logprobs: Optional[ChoiceLogprobs] = None - message: ChatCompletionMessage + message: Optional[ChatCompletionMessage] class ChatCompletions(BaseModel): id: Optional[str] - choices: List[Choice] + choices: Optional[List[Choice]] created: Optional[int] model: Optional[str] object: Optional[str]