Path: /examples/openai-sql
This is a nice example, but I noticed that the following line will throw an error and crash the program:
if token := part.choices[0].delta.content or "":
The problem is that the part.choices may be zero length initially (first part of the stream), and therefore throws an IndexError: list index out of range error, instead of substituting the default ("") and proceeding.
The following additional check makes everything work as expected:
if part.choices and (token := part.choices[0].delta.content or ""):
Hopefully this is helpful for another newbie to Chainlit such as my self!