Spaces:
Runtime error
Runtime error
| import openai # for OpenAI API calls | |
| # Example of an OpenAI ChatCompletion request with stream=True | |
| # https://platform.openai.com/docs/guides/chat | |
| # a ChatCompletion request | |
| response = openai.ChatCompletion.create( | |
| model='gpt-3.5-turbo', | |
| messages=[ | |
| {'role': 'user', 'content': "写一个50字左右的小故事"} | |
| ], | |
| temperature=0, | |
| stream=True # this time, we set stream=True | |
| ) | |
| for chunk in response: | |
| print(chunk) |