Closed woohooyeah closed 10 months ago
Greetings,
For recent versions (>=1.0.0) of the openai Python package, some minor changes are necessary in the ChatGPT plugin.
Please see this patch:
--- ChatGPT/plugin.py.old 2023-11-14 19:42:28.032663945 +0100 +++ ChatGPT/plugin.py 2023-11-14 19:42:58.888824298 +0100 @@ -31,7 +31,7 @@ from supybot import utils, plugins, ircutils, callbacks from supybot.commands import * from supybot.i18n import PluginInternationalization -import openai +from openai import OpenAI _ = PluginInternationalization("ChatGPT") @@ -44,9 +44,11 @@ def chat(self, irc, msg, args, text): """Manual Call to the ChatGPT API""" - openai.api_key = self.registryValue("api_key") + client = OpenAI( + api_key = self.registryValue("api_key"), + ) prompt = self.registryValue("prompt", msg.channel).replace("$botnick", irc.nick) - completion = openai.ChatCompletion.create( + completion = client.chat.completions.create( model=self.registryValue("model", msg.channel), messages=[ {"role": "system", "content": prompt},
Hope this helps.
Best regards, Dorian
thanks will give it a try shortly...
Thank you, appreciate the heads up!
Greetings,
For recent versions (>=1.0.0) of the openai Python package, some minor changes are necessary in the ChatGPT plugin.
Please see this patch:
Hope this helps.
Best regards, Dorian