Add exception on logit_bias for gpt-4-turbo (#360)

# PR Checklist
- [ ] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [ ] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions?
- [ ] Did you added a type def?

# Description
As gpt-4-turbo model can both receive logit_bias and inlay image, I make
some exceptions from removing bias on the request.
I check it run well with proxy, but not tested with API key, so testing
with official API is needed before merge.
This commit is contained in:
kwaroran
2024-04-16 11:58:00 +09:00
committed by GitHub

View File

@@ -469,8 +469,16 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
if(supportsInlayImage()){
// inlay models doesn't support logit_bias
// @ts-ignore
delete body.logit_bias
// gpt-4-turbo supports both logit_bias and inlay image
if(!(
aiModel.startsWith('gpt4_turbo') ||
(aiModel == 'reverse_proxy' && (
db.proxyRequestModel?.startsWith('gpt4_turbo') ||
(db.proxyRequestModel === 'custom' && db.customProxyRequestModel.startsWith('gpt-4-turbo'))
)))){
// @ts-ignore
delete body.logit_bias
}
}
let replacerURL = aiModel === 'openrouter' ? "https://openrouter.ai/api/v1/chat/completions" :