Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(vlm): omit unset OpenAI max_tokens (#2946)

Qin Haojieb90c6626cbc4
diff --git a/openviking/models/vlm/backends/openai_vlm.py b/openviking/models/vlm/backends/openai_vlm.py
index 012adcbf3..e90d64092 100644
--- a/openviking/models/vlm/backends/openai_vlm.py
+++ b/openviking/models/vlm/backends/openai_vlm.py
@@ -233,8 +233,8 @@ class OpenAIVLM(VLMBase):
else:
kwargs["temperature"] = self.temperature
self._apply_provider_specific_extra_body(kwargs, effective_thinking)
- max_tokens = self.max_tokens or 32768
- kwargs["max_completion_tokens" if is_reasoning else "max_tokens"] = max_tokens
+ if self.max_tokens is not None:
+ kwargs["max_completion_tokens" if is_reasoning else "max_tokens"] = self.max_tokens
if tools:
kwargs["tools"] = tools
kwargs["tool_choice"] = tool_choice or "auto"
@@ -271,8 +271,8 @@ class OpenAIVLM(VLMBase):
else:
kwargs["temperature"] = self.temperature
self._apply_provider_specific_extra_body(kwargs, effective_thinking)
- max_tokens = self.max_tokens or 32768
- kwargs["max_completion_tokens" if is_reasoning else "max_tokens"] = max_tokens
+ if self.max_tokens is not None:
+ kwargs["max_completion_tokens" if is_reasoning else "max_tokens"] = self.max_tokens
if tools:
kwargs["tools"] = tools
kwargs["tool_choice"] = tool_choice or "auto"