Closed bluetooft closed 9 months ago
When i set stream to false it prints the error "AttributeError: 'str' object has no attribute 'choices'.
Here's my code: import openai
openai.api_key = "dummy" openai.api_base = "https://copilot.github1s.tk/api/v1/chat/completions"
completion = openai.ChatCompletion.create(model="gpt-4", stream=False, messages=[{"role": "system", "content": "SYSTEM_PROMPT"}, {"role": "user", "content": "USER_PROMPT"}])
for chat_completion in completion:
print(chat_completion.choices[0].message.content)
When i set stream to false it prints the error "AttributeError: 'str' object has no attribute 'choices'.
Here's my code: import openai
openai.api_key = "dummy" openai.api_base = "https://copilot.github1s.tk/api/v1/chat/completions"
Create a chat completion
completion = openai.ChatCompletion.create(model="gpt-4", stream=False, messages=[{"role": "system", "content": "SYSTEM_PROMPT"}, {"role": "user", "content": "USER_PROMPT"}])
for chat_completion in completion:
Print the completion
print(chat_completion.choices[0].message.content)