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

add tolerance for empty choices #4311

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MohMaz
Copy link
Contributor

@MohMaz MohMaz commented Nov 22, 2024

Why are these changes needed?

I encountered this issue only in AzureOpenAIChatCompletionClient, adding some tolerance for empty choices ! Not a super clean fix ... just works to unblock updating streaming samples using AzureOpenAIChatCompletionClient

Related issue number

closes #4213

Checks

Signed-off-by: Mohammad Mazraeh <mazraeh.mohammad@gmail.com>
@MohMaz MohMaz self-assigned this Nov 22, 2024
@MohMaz MohMaz marked this pull request as ready for review November 22, 2024 07:54
@@ -556,6 +556,7 @@ async def create_stream(
json_output: Optional[bool] = None,
extra_create_args: Mapping[str, Any] = {},
cancellation_token: Optional[CancellationToken] = None,
max_empty_consequative_chunk_tolerance: Optional[int] = 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "max_consecutive..."?

@@ -566,6 +567,7 @@ async def create_stream(
json_output (Optional[bool], optional): If True, the output will be in JSON format. Defaults to None.
extra_create_args (Mapping[str, Any], optional): Additional arguments for the creation process. Default to `{}`.
cancellation_token (Optional[CancellationToken], optional): A token to cancel the operation. Defaults to None.
max_empty_consequative_chunk_tolerance (int, optional): The maximum number of consecutive empty chunks to tolerate before stopping the stream. Defaults to 3.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it defaults to zero?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

finish_reason not set in AzureOpenAIChatCompletionClient.create_stream
2 participants