kchro3 / minutes

Records -> Transcribes -> Prompts
1 stars 1 forks source link

Update the summarizer to use the chat completion API #2

Open kchro3 opened 1 year ago

kchro3 commented 1 year ago

It's currently using the openai.Completion.create API, but I want to use the completion API instead

flydevbot commented 1 year ago

Okay, let me take a look at the issue. From what I understand, the issue is about updating the summarizer to use the chat completion API instead of the openai.Completion.create API.

Before I propose an implementation plan, I have a few questions:

Once I have answers to these questions, I can propose an implementation plan.

kchro3 commented 1 year ago

The chat completion API is part of OpenAI's python library.

It works like this:

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")

completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Hello!"}
  ]
)

print(completion.choices[0].message)

I want to use it because it gives me more control than the older openai.Completion.create API.

The summarizer code is in summarizer.py

flydevbot commented 1 year ago

Okay, I understand the issue now. The user wants to update the summarizer code located in summarizer.py to use the chat completion API instead of the openai.Completion.create API. The chat completion API is part of OpenAI's python library and provides more control than the older API.

Here's my proposed commit plan:

  1. Update the import statement in summarizer.py to include the openai library.
  2. Replace the openai.Completion.create API call with the openai.ChatCompletion.create API call in the summarize function.
  3. Modify the messages parameter of the openai.ChatCompletion.create API call to include the appropriate user messages for the summarization task.

Once the above changes are made, the summarizer code will be updated to use the chat completion API instead of the older API.