Skip to content
Discussion options

You must be logged in to vote

I think you don't need that construction. You can just put generate_messages into StreamingResponse.
The reason why you had async generator ignored GeneratorExit error was likely that you were catching all the exceptions (except Exception:).

To avoid such problems, you should catch specific exceptions instead of all exceptions.
Or, you can start with adding except block to re-raise GeneratorExit:

try:
    ...

except GeneratorExit as e: # Add these two lines
    raise e

except Exception as e:
    ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants