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

[Frontend] request.tool_choice is not completely exhausted in non-stream mode #5764

Closed
wants to merge 1 commit into from

Conversation

MatheMatrix
Copy link

request.tool_choice could be "auto" or others, in that cases message would not be defined.

In chat_completion_stream_generator, request.tool_choice is completely exhausted:

if request.tool_choice and type(
        request.tool_choice
) is ChatCompletionNamedToolChoiceParam:
    delta_message = DeltaMessage(tool_calls=[
        ToolCall(function=FunctionCall(
            name=request.tool_choice.function.name,
            arguments=delta_text))
    ])
else:
    delta_message = DeltaMessage(content=delta_text)

so this pr just follow the approach in chat_completion_stream_generator

@MatheMatrix
Copy link
Author

@simon-mo This is a small fix avoid message would be not defined since the if-else is not completely exhausted

`request.tool_choice` could be "auto" or others, in that cases message would not be defined.
Copy link

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale label Oct 25, 2024
@DarkLight1337
Copy link
Member

Closing as superseded by #5649

@mergify mergify bot added the frontend label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants