Skip to content

Commit

Permalink
fix: replace Completion with ChatCompletion to use `gpt-3.5-turbo…
Browse files Browse the repository at this point in the history
…` model (#2066)

According to https://platform.openai.com/docs/guides/gpt/chat-completions-vs-completions , GPT-3.5 Turbo & GPT-4 is not working on **Legacy** Completions API
  • Loading branch information
ix64 authored Sep 5, 2023
1 parent 900a4fc commit 928ae77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apiserver/plane/api/views/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ def post(self, request, slug, project_id):
final_text = task + "\n" + prompt

openai.api_key = settings.OPENAI_API_KEY
response = openai.Completion.create(
response = openai.ChatCompletion.create(
model=settings.GPT_ENGINE,
prompt=final_text,
messages=[{"role": "user", "content": final_text}],
temperature=0.7,
max_tokens=1024,
)

workspace = Workspace.objects.get(slug=slug)
project = Project.objects.get(pk=project_id)

text = response.choices[0].text.strip()
text = response.choices[0].message.content.strip()
text_html = text.replace("\n", "<br/>")
return Response(
{
Expand Down

2 comments on commit 928ae77

@vercel
Copy link

@vercel vercel bot commented on 928ae77 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev-plane.vercel.app
plane-dev-git-develop-plane.vercel.app
plane-dev.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 928ae77 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-sh-dev-plane.vercel.app
plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app

Please sign in to comment.