Fix UnboundLocalError for StreamingResponse in chat_completions
The issue was caused by importing StreamingResponse and JSONResponse inside the chat_completions function. In Python, when you have an import statement anywhere inside a function, it creates a local variable for that name throughout the entire function scope. This caused the code in the original implementation path to fail because Python saw StreamingResponse as an unassigned local variable. Fix: Move StreamingResponse and JSONResponse imports to module level and remove redundant imports from inside the function.
Showing
Please
register
or
sign in
to comment