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

helo #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/commands/ai/gpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ export const gpt = async ({
mArgs['large'] ||
mArgs['bigtokenlimit'] ||
(mArgs['1'] && mArgs['6'])
let useGPT4 =
mArgs['4'] ||
mArgs['GPT4'] ||
mArgs['gpt4'] ||
mArgs['gpt-4'] ||
(mArgs['1'] && mArgs['4'] )

const parsedQuery = [mArgs['6'] || use16k || [], mArgs._].flat().join(' ')
//const parsedQuery = [mArgs['6'] || use16k || [], mArgs._].flat().join(' ')
const parsedQuery = [mArgs['6'] || use16k || useGPT4 || [], mArgs._].flat().join(' ')

// lets just make it use 16k if its longer than 4096, but enforce the ratelimits
if (parsedQuery.length > 3800) use16k = true
Expand Down Expand Up @@ -105,10 +112,10 @@ export const gpt = async ({
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${OPENAI_KEY}`,
},
Authorization: useGPT4 ? `Bearer ${GPT4_KEY}` : `Bearer ${OPENAI_KEY}`,
},
body: JSON.stringify({
model: tokenLimit < 4097 ? 'gpt-3.5-turbo' : 'gpt-3.5-turbo-16k',
model: useGPT4 ? 'gpt-4' : (use16k && tokenLimit < 4097 ? 'gpt-3.5-turbo-16k' : 'gpt-3.5-turbo'),
messages,
temperature,
top_p,
Expand Down