htadashi / GPT3-AHK

An AutoHotKey script that enables you to use GPT3 in any input field on your computer
MIT License
102 stars 17 forks source link

Use gpt-3.5-turbo-instruct #15

Closed boromyr closed 1 month ago

boromyr commented 8 months ago

How can I update the model from text-davinci-edit-001 to gpt-3.5-turbo-instruct? I have already modified:

MODEL_AUTOCOMPLETE_ID := "gpt-3.5-turbo-instruct"
url := "https://api.openai.com/v1/completions"

but I am not getting any response.

htadashi commented 8 months ago

Hi @boromyr, thanks for opening the issue. According to OpenAI docs, "Most models that support the legacy Completions endpoint will be shut off on January 4th, 2024".

I will change both edit/auto-complete functions to use the chat endpoints in the future.

boromyr commented 8 months ago

I tried version 0.3 but it doesn't work with gpt-3.5-turbo-instruct. Also, line 4 should be #SingleInstance force, line 87 should be: body.messages := [{"role": "user", "content": UserInput . CutText}] otherwise without UserInput no instruction will be sent. Version 2 of cJson.ahk has been released, already tested with your code and it works.

htadashi commented 8 months ago

Thanks for your feedback and the heads up!

I tried version 0.3 but it doesn't work with gpt-3.5-turbo-instruct.

Sorry, I initially misunderstood. I thought that gpt-3.5-turbo-instruct was going to be deprecated, but now I understood that it is running. It does not work because it uses a different API schema from gpt-3.5-turbo. Do you get better experience using gpt-3.5-turbo-instruct rather than gpt-3.5-turbo? If so, I will support it in the future.

Also, line 4 should be #SingleInstance force,

According to AHK docs, if force is omitted, it already defaults to Force.

line 87 should be: body.messages := [{"role": "user", "content": UserInput . CutText}] otherwise without UserInput no instruction will be sent.

You are right. Thanks!

Version 2 of cJson.ahk has been released, already tested with your code and it works.

Thanks for the information. As soon as I update the code to AHK 2.0, I will also update the third-party libraries.

boromyr commented 7 months ago

gpt-3.5-turbo-instruct has several advantages explained better here https://blog.nextideatech.com/openai-gpt-3-5-turbo-instruct/, including more coherent output and not being a chat, for example to translate selected text without getting as output Certainly, here is the translated text: translated text. cJson also works with version 2 with GPT3-AHK v1.

htadashi commented 1 month ago

gpt-3.5-turbo-instruct is now compatible with the newer OpenAI scheme, so you only need to change the model in L64 of GPT3-AHK.ahk: https://github.com/htadashi/GPT3-AHK/blob/f9995797cf7e7cc060c65b50eab1f78545851b7c/GPT3-AHK.ahk#L64