Skip to content

Commit 262b402

Browse files
authored
fix code to adjust max_tokens according to model selection (#263)
1 parent 56ea956 commit 262b402

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/app/clients/chatgpt-client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ const askClient = async ({
2323
};
2424

2525
const azure = process.env.AZURE_OPENAI_API_KEY ? true : false;
26-
26+
const max_tokens = (model === "gpt-4") ? 7200 : (model === "gpt-4-32k") ? 31000 : 3071;
2727
const clientOptions = {
2828
reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null,
2929
azure,
3030
modelOptions: {
3131
model: model,
32+
max_tokens: max_tokens,
3233
temperature,
3334
top_p,
3435
presence_penalty,

0 commit comments

Comments
 (0)