Good to know: depending on the product you're building, it can be useful to explicitly document use cases. Got a product that can be used by a bunch of people in different ways? Maybe consider splitting it out!
Python example:
import openai # openai==0.28openai.api_key ="sk_xxx"# Your API tokenopenai.api_base ="https://neuroapi.host/v1"# Our API Endpointdefmain(): chat_completion = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[{"role": "user", "content": "write a poem about a tree"}], stream=True, )ifisinstance(chat_completion, dict):# not streamprint(chat_completion.choices[0].message.content)else:# streamfor token in chat_completion: content = token["choices"][0]["delta"].get("content")if content !=None:print(content, end="", flush=True)if__name__=="__main__":main()