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

docs: Update models (#2755)

Sarthak Bhardwaj974e0252d668
diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.py
index 5d10fff00..1e27ed201 100644
--- a/camel/agents/chat_agent.py
+++ b/camel/agents/chat_agent.py
@@ -173,7 +173,7 @@ class ChatAgent(BaseAgent):
stop_event (Optional[threading.Event], optional): Event to signal
termination of the agent's operation. When set, the agent will
terminate its execution. (default: :obj:`None`)
- mask_tool_output (Optional[bool]): Whether to return a sanitized
+ mask_tool_output (Optional[bool]): Whether to return a sanitized
placeholder instead of the raw tool output. (default: :obj:`False`)
"""
@@ -1966,8 +1966,10 @@ class ChatAgent(BaseAgent):
raw_result = tool(**args)
if self.mask_tool_output:
self._secure_result_store[tool_call_id] = raw_result
- result= "[The tool has been executed successfully, but the output" \
- " from the tool is masked. You can move forward]"
+ result = (
+ "[The tool has been executed successfully, but the output"
+ " from the tool is masked. You can move forward]"
+ )
mask_flag = True
else:
result = raw_result
@@ -1979,7 +1981,9 @@ class ChatAgent(BaseAgent):
mask_flag = False
logging.warning(error_msg)
- return self._record_tool_calling(func_name, args, result, tool_call_id, mask_output=mask_flag)
+ return self._record_tool_calling(
+ func_name, args, result, tool_call_id, mask_output=mask_flag
+ )
async def _aexecute_tool(
self,
@@ -2039,12 +2043,13 @@ class ChatAgent(BaseAgent):
args (Dict[str, Any]): The arguments passed to the tool.
result (Any): The result returned by the tool execution.
tool_call_id (str): A unique identifier for the tool call.
- mask_output (bool, optional): Whether to return a sanitized placeholder instead
- of the raw tool output.
+ mask_output (bool, optional): Whether to return a sanitized
+ placeholder instead of the raw tool output.
(default: :obj:`False`)
Returns:
- ToolCallingRecord: A struct containing information about this tool call.
+ ToolCallingRecord: A struct containing information about this tool
+ call.
"""
assist_msg = FunctionCallingMessage(
role_name=self.role_name,
diff --git a/camel/messages/func_message.py b/camel/messages/func_message.py
index c4c815296..2767e1c0c 100644
--- a/camel/messages/func_message.py
+++ b/camel/messages/func_message.py
@@ -47,8 +47,8 @@ class FunctionCallingMessage(BaseMessage):
(default: :obj:`None`)
tool_call_id (Optional[str]): The ID of the tool call, if available.
(default: :obj:`None`)
- mask_output (Optional[bool]): Whether to return a sanitized placeholder instead
- of the raw tool output.
+ mask_output (Optional[bool]): Whether to return a sanitized placeholder
+ instead of the raw tool output.
(default: :obj:`False`)
"""
@@ -109,10 +109,13 @@ class FunctionCallingMessage(BaseMessage):
# This is a function response
# TODO: Allow for more flexible setting of tool role,
# optionally to be the same as assistant messages
- content = function_format.format_tool_response(
- self.func_name, # type: ignore[arg-type]
- self.result, # type: ignore[arg-type]
- )
+ if self.mask_output:
+ content = "[MASKED]"
+ else:
+ content = function_format.format_tool_response(
+ self.func_name, # type: ignore[arg-type]
+ self.result, # type: ignore[arg-type]
+ )
return ShareGPTMessage(from_="tool", value=content) # type: ignore[call-arg]
def to_openai_assistant_message(self) -> OpenAIAssistantMessage:
@@ -158,14 +161,17 @@ class FunctionCallingMessage(BaseMessage):
" due to missing function name."
)
- result_content = str(self.result)
+ if self.mask_output:
+ result_content = "[MASKED]"
+ else:
+ result_content = str(self.result)
return {
"role": "tool",
"content": result_content,
"tool_call_id": self.tool_call_id or "null",
}
-
+
def to_dict(self) -> Dict:
r"""Converts the message to a dictionary.
diff --git a/docs/mintlify/key_modules/models.mdx b/docs/mintlify/key_modules/models.mdx
index 81a7cba63..1b1afbaa2 100644
--- a/docs/mintlify/key_modules/models.mdx
+++ b/docs/mintlify/key_modules/models.mdx
@@ -41,7 +41,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **Mistral AI** | mistral-large-latest, pixtral-12b-2409<br/>ministral-8b-latest, ministral-3b-latest<br/>open-mistral-nemo, codestral-latest<br/>open-mistral-7b, open-mixtral-8x7b<br/>open-mixtral-8x22b, open-codestral-mamba<br/>magistral-medium-2506, mistral-small-2506 |
| **Moonshot** | moonshot-v1-8k<br/>moonshot-v1-32k<br/>moonshot-v1-128k |
| **Anthropic** | claude-2.1, claude-2.0, claude-instant-1.2<br/>claude-3-opus-latest, claude-3-sonnet-20240229, claude-3-haiku-20240307<br/>claude-3-5-sonnet-latest, claude-3-5-haiku-latest |
-| **Gemini** | gemini-2.5-flash-preview-04-17, gemini-2.5-pro-preview-06-05<br/>gemini-2.0-flash, gemini-2.0-flash-exp, gemini-2.0-flash-thinking-exp<br/>gemini-2.0-pro-exp-02-05, gemini-2.0-flash-lite, gemini-2.0-flash-lite-preview-02-05<br/>gemini-1.5-flash, gemini-1.5-pro |
+| **Gemini** | gemini-2.5-pro, gemini-2.5-flash<br/>gemini-2.0-flash, gemini-2.0-flash-thinking<br/> gemini-2.0-flash-lite|
| **Lingyiwanwu** | yi-lightning, yi-large, yi-medium<br/>yi-large-turbo, yi-vision, yi-medium-200k<br/>yi-spark, yi-large-rag, yi-large-fc |
| **Qwen** | qwq-32b-preview, qwen-max, qwen-plus, qwen-turbo, qwen-long<br/>qwen-vl-max, qwen-vl-plus, qwen-math-plus, qwen-math-turbo, qwen-coder-turbo<br/>qwen2.5-coder-32b-instruct, qwen2.5-72b-instruct, qwen2.5-32b-instruct, qwen2.5-14b-instruct |
| **DeepSeek** | deepseek-chat<br/>deepseek-reasoner |
diff --git a/test/messages/test_func_message.py b/test/messages/test_func_message.py
index 9b533b63a..e2e503384 100644
--- a/test/messages/test_func_message.py
+++ b/test/messages/test_func_message.py
@@ -204,6 +204,7 @@ def test_function_func_message_to_openai_assistant_message(
):
function_result_message.to_openai_assistant_message()
+
def test_masking_in_openai_tool_message():
msg = FunctionCallingMessage(
role_name="assistant",