Skip to content

Conversation

@tkasuz
Copy link

@tkasuz tkasuz commented Sep 1, 2025

Description

The choice variable in the stream method could be unbound when accessing choice.finish_reason, causing an UnboundLocalError

Related Issues

Documentation PR

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…method

Signed-off-by: tkasuz <63289889+tkasuz@users.noreply.github.com>
@tkasuz tkasuz changed the title fix(openai): prevent UnboundLocalError for choice variable in stream method fix: prevent UnboundLocalError for choice variable in stream method Sep 1, 2025
@tkasuz tkasuz marked this pull request as draft September 3, 2025 22:44
@mkmeral
Copy link
Contributor

mkmeral commented Dec 22, 2025

Thanks for identifying the bug and opening up a PR. However, this was already fixed with #1099, so we can close out this one.

@mkmeral mkmeral closed this Dec 22, 2025
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.

2 participants