Browse Source

Merge 9b7c5ab397 into 3107855044

pull/6963/merge
张大侠 GitHub 10 months ago
parent
commit
e040ba1c48
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py

+ 3
- 2
python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py View File

@@ -523,6 +523,9 @@ class AzureAIChatCompletionClient(ChatCompletionClient):
if choice and choice.finish_reason is not None:
if isinstance(choice.finish_reason, CompletionsFinishReason):
finish_reason = cast(FinishReasons, choice.finish_reason.value)
# Handle special case for TOOL_CALLS finish reason
if choice.finish_reason is CompletionsFinishReason.TOOL_CALLS:
finish_reason = "function_calls"
else:
if choice.finish_reason in ["stop", "length", "function_calls", "content_filter", "unknown"]:
finish_reason = choice.finish_reason # type: ignore
@@ -554,8 +557,6 @@ class AzureAIChatCompletionClient(ChatCompletionClient):
if finish_reason is None:
raise ValueError("No stop reason found")

if choice and choice.finish_reason is CompletionsFinishReason.TOOL_CALLS:
finish_reason = "function_calls"

content: Union[str, List[FunctionCall]]



Loading…
Cancel
Save