Add supports of gpt-4o tokenizer for reverse_proxy

This commit is contained in:
IHaBiS02
2024-05-14 06:30:36 +09:00
parent 4595a36adf
commit 1aade242ec

View File

@@ -35,6 +35,11 @@ export async function encode(data:string):Promise<(number[]|Uint32Array|Int32Arr
case 'llama3': case 'llama3':
return await tokenizeWebTokenizers(data, 'llama') return await tokenizeWebTokenizers(data, 'llama')
default: default:
// Add exception for gpt-4o tokenizers on reverse_proxy
if(db.proxyRequestModel?.startsWith('gpt4o') ||
(db.proxyRequestModel === 'custom' && db.customProxyRequestModel.startsWith('gpt-4o'))) {
return await tikJS(data, 'o200k_base')
}
return await tikJS(data) return await tikJS(data)
} }
} }