AlibabaResearch / DAMO-ConvAI

DAMO-ConvAI: The official repository which contains the codebase for Alibaba DAMO Conversational AI.
MIT License
1.15k stars 185 forks source link

BIRD Issue: It seems that gpt-3.5-turbo api call is not implemented in bird/llm/src/gpt_request.py. Maybe authors forget to update code. #31

Closed wbbeyourself closed 1 year ago

wbbeyourself commented 1 year ago

bird/llm/src/gpt_request.py

error:This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?\t----- bird -----\tcalifornia_schools

The origin function:

def connect_gpt(engine, prompt, max_tokens, temperature, stop):

print(prompt)

try:
    result = openai.Completion.create(engine=engine, prompt=prompt, max_tokens=max_tokens, temperature=temperature, stop=stop)
except Exception as e:
    result = 'error:{}'.format(e)
return result

While gpt-3.5-turbo api call is:

response = openai.ChatCompletion.create( model=engine, messages=[{"role": "user", "content": prompt}], temperature=temperature, stop=stop )

accpatrick commented 1 year ago

Hi @wbbeyourself Thank you for your interest in our work. Sorry for confusiong. It seems like you're facing an issue with the OpenAI keys. In our project, we utilized Azure OpenAI API keys to evaluate the performance of ChatGPT. To fetch the results, we used the openai.Completion.create() function, which is consistent with other models such as code-davinci-002 and text-davinci-003.

However, we observed that for the regular keys, you should refer to the documentation at https://platform.openai.com/docs/api-reference/chat and use openai.ChatCompletion.create() instead. Additionally, for prompt design, please follow the instructions provided in the chatlm tag documentation at https://github.com/openai/openai-python/blob/main/chatml.md#few-shot-prompting. In this case, you will need to place your tag within the message parameter instead of prompt.

During our experiments, we found that the performance of ChatGPT with Azure OpenAI Key is superior to ChatGPT with the regular OpenAI key, and we only reported the best performance in our paper. However, we also consider actively working on updating the standard methods for calling ChatGPT in the regular account. Thanks a lot.

wbbeyourself commented 1 year ago

Ok, I got it. I use the regular account/key indeed. Thanks a lot.