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

feat: ModelFactory support passing additional argument (#2327)

Wendong-Fana5211699c53d
diff --git a/camel/models/model_factory.py b/camel/models/model_factory.py
index 424b5c482..b6869c3b4 100644
--- a/camel/models/model_factory.py
+++ b/camel/models/model_factory.py
@@ -71,6 +71,7 @@ class ModelFactory:
api_key: Optional[str] = None,
url: Optional[str] = None,
timeout: Optional[float] = None,
+ **kwargs,
) -> BaseModelBackend:
r"""Creates an instance of `BaseModelBackend` of the specified type.
@@ -94,6 +95,10 @@ class ModelFactory:
(default: :obj:`None`)
timeout (Optional[float], optional): The timeout value in seconds
for API calls. (default: :obj:`None`)
+ **kwargs: Additional model-specific parameters that will be passed
+ to the model constructor. For example, Azure OpenAI models may
+ require `api_version`, `azure_deployment_name`,
+ `azure_ad_token_provider`, and `azure_ad_token`.
Returns:
BaseModelBackend: The initialized backend.
@@ -202,6 +207,7 @@ class ModelFactory:
url=url,
token_counter=token_counter,
timeout=timeout,
+ **kwargs,
)
@classmethod
diff --git a/camel/toolkits/function_tool.py b/camel/toolkits/function_tool.py
index 737d130ea..32d5b6035 100644
--- a/camel/toolkits/function_tool.py
+++ b/camel/toolkits/function_tool.py
@@ -458,9 +458,11 @@ class FunctionTool:
for param_name in properties.keys():
param_dict = properties[param_name]
if "description" not in param_dict:
- warnings.warn(f"""Parameter description is missing for
- {param_dict}. This may affect the quality of tool
- calling.""")
+ warnings.warn(
+ f"Parameter description is missing "
+ f"for {param_dict}. This may affect the "
+ f"quality of tool calling."
+ )
def get_openai_tool_schema(self) -> Dict[str, Any]:
r"""Gets the OpenAI tool schema for this function.