🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
chore: polish docstring of slack toolkit
Wendong2f838dcf3276
diff --git a/camel/toolkits/slack_toolkit.py b/camel/toolkits/slack_toolkit.pyindex 54fe6cfe8..9d35bf3bc 100644--- a/camel/toolkits/slack_toolkit.py+++ b/camel/toolkits/slack_toolkit.py@@ -128,18 +128,14 @@ class SlackToolkit(BaseToolkit):return f"Error creating conversation: {e.response['error']}"def join_slack_channel(self, channel_id: str) -> str:- r"""Joins an existing Slack channel.+ r"""Joins an existing Slack channel. To get the `channel_id` of a+ channel, you can use the `get_slack_channel_information` function.Args:channel_id (str): The ID of the Slack channel to join.Returns:- str: A confirmation message indicating whether join successfully- or an error message.-- Raises:- SlackApiError: If there is an error during get slack channel- information.+ str: A string containing the API response from Slack."""from slack_sdk.errors import SlackApiError@@ -148,21 +144,17 @@ class SlackToolkit(BaseToolkit):response = slack_client.conversations_join(channel=channel_id)return str(response)except SlackApiError as e:- return f"Error creating conversation: {e.response['error']}"+ return f"Error joining channel: {e.response['error']}"def leave_slack_channel(self, channel_id: str) -> str:- r"""Leaves an existing Slack channel.+ r"""Leaves an existing Slack channel. To get the `channel_id` of a+ channel, you can use the `get_slack_channel_information` function.Args:channel_id (str): The ID of the Slack channel to leave.Returns:- str: A confirmation message indicating whether leave successfully- or an error message.-- Raises:- SlackApiError: If there is an error during get slack channel- information.+ str: A string containing the API response from Slack."""from slack_sdk.errors import SlackApiError@@ -171,18 +163,18 @@ class SlackToolkit(BaseToolkit):response = slack_client.conversations_leave(channel=channel_id)return str(response)except SlackApiError as e:- return f"Error creating conversation: {e.response['error']}"+ return f"Error leaving channel: {e.response['error']}"def get_slack_channel_information(self) -> str:- r"""Retrieve Slack channels and return relevant information in JSON- format.+ r"""Retrieve a list of all public channels in the Slack workspace.- Returns:- str: JSON string containing information about Slack channels.+ This function is crucial for discovering available channels and their+ `channel_id`s, which are required by many other functions.- Raises:- SlackApiError: If there is an error during get slack channel- information.+ Returns:+ str: A JSON string representing a list of channels. Each channel+ object in the list contains 'id', 'name', 'created', and+ 'num_members'. Returns an error message string on failure."""from slack_sdk.errors import SlackApiError@@ -204,21 +196,20 @@ class SlackToolkit(BaseToolkit):]return json.dumps(filtered_result, ensure_ascii=False)except SlackApiError as e:- return f"Error creating conversation: {e.response['error']}"+ return f"Error retrieving channel list: {e.response['error']}"def get_slack_channel_message(self, channel_id: str) -> str:- r"""Retrieve messages from a Slack channel.+ r"""Retrieve messages from a Slack channel. To get the `channel_id`+ of a channel, you can use the `get_slack_channel_information`+ function.Args:channel_id (str): The ID of the Slack channel to retrieve messagesfrom.Returns:- str: JSON string containing filtered message data.-- Raises:- SlackApiError: If there is an error during get- slack channel message.+ str: A JSON string representing a list of messages. Each message+ object contains 'user', 'text', and 'ts' (timestamp)."""from slack_sdk.errors import SlackApiError@@ -242,19 +233,20 @@ class SlackToolkit(BaseToolkit):file_path: Optional[str] = None,user: Optional[str] = None,) -> str:- r"""Send a message to a Slack channel.+ r"""Send a message to a Slack channel. To get the `channel_id` of a+ channel, you can use the `get_slack_channel_information` function.Args:message (str): The message to send.- channel_id (str): The ID of the Slack channel to send message.- file_path (Optional[str]): The path of the file to send.- Defaults to `None`.- user (Optional[str]): The user ID of the recipient.- Defaults to `None`.+ channel_id (str): The ID of the channel to send the message to.+ file_path (Optional[str]): The local path of a file to upload+ with the message.+ user (Optional[str]): The ID of a user to send an ephemeral+ message to (visible only to that user).Returns:- str: A confirmation message indicating whether the message was sent- successfully or an error message.+ str: A confirmation message indicating success or an error+ message."""from slack_sdk.errors import SlackApiError@@ -280,25 +272,23 @@ class SlackToolkit(BaseToolkit):f"got response: {response}")except SlackApiError as e:- return f"Error creating conversation: {e.response['error']}"+ return f"Error sending message: {e.response['error']}"def delete_slack_message(self,time_stamp: str,channel_id: str,) -> str:- r"""Delete a message to a Slack channel.+ r"""Delete a message from a Slack channel.Args:- time_stamp (str): Timestamp of the message to be deleted.- channel_id (str): The ID of the Slack channel to delete message.+ time_stamp (str): The 'ts' value of the message to be deleted.+ You can get this from the `get_slack_channel_message` function.+ channel_id (str): The ID of the channel where the message is. Use+ `get_slack_channel_information` to find the `channel_id`.Returns:- str: A confirmation message indicating whether the message- was delete successfully or an error message.-- Raises:- SlackApiError: If an error occurs while sending the message.+ str: A string containing the API response from Slack."""from slack_sdk.errors import SlackApiError@@ -309,7 +299,7 @@ class SlackToolkit(BaseToolkit):)return str(response)except SlackApiError as e:- return f"Error creating conversation: {e.response['error']}"+ return f"Error deleting message: {e.response['error']}"def get_tools(self) -> List[FunctionTool]:r"""Returns a list of FunctionTool objects representing the