How to stream non-chat completions (used by older models like text-davinci-003) (cont.)
# create variables to collect the stream of events
collected_events = []
completion_text = ''
# iterate through the stream of events
for event in response:
    event_time = time.time() - start_time  # calculate the time delay of the event
    collected_events.append(event)  # save the event response/...sponse received {event_time:.2f} seconds after request")
print(f"Full text received: {completion_text}
 However, with the streaming request, we received the first token after 0.18 seconds, and subsequent tokens every ~0.01-0.02 seconds")