Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix: Vllm tool call schema remove additionalProperties (#2118)

Wendong-Fan228b8ff172d5
diff --git a/camel/models/vllm_model.py b/camel/models/vllm_model.py
index d4d69e7dd..7111f1396 100644
--- a/camel/models/vllm_model.py
+++ b/camel/models/vllm_model.py
@@ -162,6 +162,14 @@ class VLLMModel(BaseModelBackend):
if response_format:
kwargs["response_format"] = {"type": "json_object"}
+ # Remove additionalProperties from each tool's function parameters
+ if tools and "tools" in kwargs:
+ for tool in kwargs["tools"]:
+ if "function" in tool and "parameters" in tool["function"]:
+ tool["function"]["parameters"].pop(
+ "additionalProperties", None
+ )
+
response = await self._async_client.chat.completions.create(
messages=messages,
model=self.model_type,
@@ -197,6 +205,14 @@ class VLLMModel(BaseModelBackend):
if response_format:
kwargs["response_format"] = {"type": "json_object"}
+ # Remove additionalProperties from each tool's function parameters
+ if tools and "tools" in kwargs:
+ for tool in kwargs["tools"]:
+ if "function" in tool and "parameters" in tool["function"]:
+ tool["function"]["parameters"].pop(
+ "additionalProperties", None
+ )
+
response = self._client.chat.completions.create(
messages=messages,
model=self.model_type,