Skip to content

Commit

Permalink
fix: add max_tokens when using vision model (ChatGPTNextWeb#4157)
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-bf committed Feb 27, 2024
1 parent 44a5127 commit 08fa227
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export class ChatGPTApi implements LLMApi {
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};

// add max_tokens to vision model
if (visionModel) {
Object.defineProperty(requestPayload, "max_tokens", {
enumerable: true,
configurable: true,
writable: true,
value: Math.max(modelConfig.max_tokens, 4096),
});
}

console.log("[Request] openai payload: ", requestPayload);

const shouldStream = !!options.config.stream;
Expand Down

0 comments on commit 08fa227

Please sign in to comment.