How to stream non-chat completions (used by older models like text-davinci-003) (cont.)
# calculate the time it took to receive the response
response_time = time.time() - start_time

# extract the text from the response
completion_text = response['choices'][0]['text']