Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Use Chat Completions API #53

Merged
merged 8 commits into from
Jan 27, 2024
Merged

Conversation

arindamlahiri
Copy link
Contributor

@arindamlahiri arindamlahiri commented Jan 20, 2024

Fixes #52

Changes

  • Refactored the code to use the Chat Completions API
    • Updated openai package to latest version - v4
  • Default model - gpt-3.5-turbo
  • User can switch to gpt-4
  • Removed top_p param as OpenAI suggests to only alter either temperature or top_p. Keeping both made gpt-3.5-turbo not follow the constraints
# with top_p
> ai ask "biggest country in the world?"
> Command is `The biggest country in the world by land area is Russia.`
# without top_p
> ai ask "biggest country in the world?"
> Sorry, Can't answer that.

/claim #52

Copy link

algora-pbc bot commented Jan 20, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe/Alipay.

@arindamlahiri arindamlahiri changed the title Remove deprecated models and Replace deprecated models Jan 20, 2024
@abhagsain
Copy link
Owner

Thanks for the PR, but we want to refactor it to GPT3.5 (Chat Model) so users can switch to GPT4 if they want to.

@arindamlahiri
Copy link
Contributor Author

Got it. Will refactor it to use the new Chat completions API

@arindamlahiri arindamlahiri changed the title Replace deprecated models Refactor: Use Chat Completions API Jan 20, 2024
@arindamlahiri
Copy link
Contributor Author

Updated the PR description to reflect the new changes

@arindamlahiri arindamlahiri marked this pull request as draft January 20, 2024 18:47
@arindamlahiri arindamlahiri marked this pull request as ready for review January 20, 2024 19:03
@arindamlahiri
Copy link
Contributor Author

@abhagsain can you please check this? I have refactored the code to use the new Chat Completions API

@abhagsain
Copy link
Owner

abhagsain commented Jan 27, 2024

@abhagsain can you please check this? I have refactored the code to use the new Chat Completions API

Hi, @arindamlahiri
I just checked, and it's not working as expected.
The issue is for an existing user who already has AI CLI installed. It will pick the text-davinci-003 model. (because it's saved in the config.json).
Users can switch to the turbo model manually, but it would be a good UX if we had checks in place to see if the user is using the deprecated model and replace it with the new one. (Let's fallback to the cheapest one)
Also, please change the README.md as well.

Thanks

@arindamlahiri
Copy link
Contributor Author

Hi @abhagsain
The required changes are done. Added a fallback to gpt-3.5-turbo in case the saved model is not in our defined list.

In the README, I have updated the pricing section and references to the default model.
Let me know if you want any other changes in the README.

Copy link
Owner

@abhagsain abhagsain left a comment

Choose a reason for hiding this comment

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

✅ LGTM

Thanks @arindamlahiri

@abhagsain abhagsain merged commit 67a43e6 into abhagsain:master Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default model text-davinci-003 deprecated
2 participants