datawhalechina / llm-cookbook

面向开发者的 LLM 入门教程,吴恩达大模型系列课程中文版
https://datawhalechina.github.io/llm-cookbook/
11.77k stars 1.47k forks source link

适配最新的openai的API版本 #148

Closed wenshudai closed 5 months ago

wenshudai commented 6 months ago

修复了哪些问题:

  1. 用openai推荐方法设置API_KEY,同时为下文函数作准备
  2. openai版本更新后(>=1.0.0)不再支持openai.ChatCompletion,改为client.chat.completions。
  3. 函数中返回值(response.choices[0].message["content"])测试后报错:TypeError: 'ChatCompletionMessage' object is not subscriptable。更新为response.choices[0].message.content。
logan-zou commented 5 months ago

感谢提醒,我们目前正在更新现有内容以适配新版本,如您有兴趣参与,可以邮件联系我

wenshudai commented 4 months ago

你好,我有兴趣参与更新内容,请问如何参与?

On Mon, May 27, 2024 at 12:38 AM Logan Zou @.***> wrote:

感谢提醒,我们目前正在更新现有内容以适配新版本,如您有兴趣参与,可以邮件联系我

— Reply to this email directly, view it on GitHub https://github.com/datawhalechina/llm-cookbook/pull/148#issuecomment-2132840148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWSGPDZW466GE3P32GL2263ZELPIZAVCNFSM6AAAAABGGLBHAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZSHA2DAMJUHA . You are receiving this because you authored the thread.Message ID: @.***>