emacs-openai / codegpt

Use GPT-3 inside Emacs
GNU General Public License v3.0
88 stars 12 forks source link

Support `code-davinci-002` model #14

Closed lccambiaghi closed 1 year ago

lccambiaghi commented 1 year ago

Hi, thank you for an amazing package!!

The documentation for the Codex models recommends to use the model code-davinci-002 when hitting the "completion" endpoint. As a nice bonus, the model is free to use for this initial period of beta.

I tried to (setq codegpt-model 'code-davinci-002) but I get Internal error: 404, do you have any idea what could be wrong?

lccambiaghi commented 1 year ago

And here is some help from OpenAI's help to build the POST request:

Write a POST request to the completion endpoint of the OpenAI API using code-davinci-002 model

POST /v1/engines/code-davinci-002/completions HTTP/1.1

Host: api.openai.com

Authorization: Bearer <token>

Content-Type: application/json

{
    "temperature": 0.5,
    "top_p": 1.0,
    "prompt": "The cow jumped over the",
    "max_tokens": 10
}
lccambiaghi commented 1 year ago

Oops, nevermind. Apparently code-davinci-002 has been recently marked as deprecated by OpenAI, as described in this post. Please disregard this issue.

jcs090218 commented 1 year ago

For future references, you can use different model by setting the variable:

https://github.com/emacs-openai/codegpt/blob/7ad39a808d3d07f982e7cd45866d86cac0557631/codegpt.el#L72-L75

Hope this helps! :D