Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

😎 fix: Azure Bug, short default `max_tokens` response using `gpt-4-vision-preview` (#2885)

Danny Avila2b7a973a333e
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js
index dbb066534c..1635e600ca 100644
--- a/api/app/clients/OpenAIClient.js
+++ b/api/app/clients/OpenAIClient.js
@@ -1108,7 +1108,12 @@ ${convo}
}
if (this.azure || this.options.azure) {
- // Azure does not accept `model` in the body, so we need to remove it.
+ /* Azure Bug, extremely short default `max_tokens` response */
+ if (!modelOptions.max_tokens && modelOptions.model === 'gpt-4-vision-preview') {
+ modelOptions.max_tokens = 4000;
+ }
+
+ /* Azure does not accept `model` in the body, so we need to remove it. */
delete modelOptions.model;
opts.baseURL = this.langchainProxy