Unverified Commit 8aca43bd authored by Strive-for-excellence's avatar Strive-for-excellence Committed by GitHub
Browse files

update Openai API call method (#27628)


Co-authored-by: default avatar张兴言 <SENSETIME\zhangxingyan1@cn0214006377l.domain.sensetime.com>
parent 7f6a804d
......@@ -440,13 +440,13 @@ class OpenAiAgent(Agent):
return self._completion_generate([prompt], stop)[0]
def _chat_generate(self, prompt, stop):
result = openai.ChatCompletion.create(
result = openai.chat.completions.create(
model=self.model,
messages=[{"role": "user", "content": prompt}],
temperature=0,
stop=stop,
)
return result["choices"][0]["message"]["content"]
return result.choices[0].message.content
def _completion_generate(self, prompts, stop):
result = openai.Completion.create(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment