weaigc / bingo

Bingo,一个让你呼吸顺畅 New Bing。
https://bing.github1s.tk
MIT License
2.85k stars 1.22k forks source link

Stream False #101

Closed bluetooft closed 9 months ago

bluetooft commented 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"

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)