Skip to content

Commit

Permalink
update docstring format
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendong-Fan committed Oct 17, 2024
1 parent 39ce593 commit 8edcd11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions camel/toolkits/whatsapp_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class WhatsAppToolkit(BaseToolkit):
"""

def __init__(self, retries: int = 3, delay: int = 1):
"""Initializes the WhatsAppToolkit with the specified number of retries
and delay.
r"""Initializes the WhatsAppToolkit with the specified number of
retries and delay.
Args:
retries (int): Number of times to retry the request in case of
failure. Defaults to 3.
failure. (default: :obj:`3`)
delay (int): Time in seconds to wait between retries.
Defaults to 1.
(default: :obj:`1`)
"""
self.retries = retries
self.delay = delay
Expand All @@ -64,16 +64,16 @@ def __init__(self, retries: int = 3, delay: int = 1):
def send_message(
self, to: str, message: str
) -> Union[Dict[str, Any], str]:
"""Sends a text message to a specified WhatsApp number.
r"""Sends a text message to a specified WhatsApp number.
Args:
to (str): The recipient's WhatsApp number in international format.
message (str): The text message to send.
Returns:
Union[Dict[str, Any], str]: A dictionary containing
the API response if successful,
or an error message string if failed.
the API response if successful, or an error message string if
failed.
"""
url = f"{self.base_url}/{self.version}/{self.phone_number_id}/messages"
headers = {
Expand Down Expand Up @@ -102,7 +102,7 @@ def send_message(
return f"Failed to send message: {e!s}"

def get_message_templates(self) -> Union[List[Dict[str, Any]], str]:
"""Retrieves all message templates for the WhatsApp Business account.
r"""Retrieves all message templates for the WhatsApp Business account.
Returns:
Union[List[Dict[str, Any]], str]: A list of dictionaries containing
Expand All @@ -129,7 +129,7 @@ def get_message_templates(self) -> Union[List[Dict[str, Any]], str]:
return f"Failed to retrieve message templates: {e!s}"

def get_business_profile(self) -> Union[Dict[str, Any], str]:
"""Retrieves the WhatsApp Business profile information.
r"""Retrieves the WhatsApp Business profile information.
Returns:
Union[Dict[str, Any], str]: A dictionary containing the business
Expand Down Expand Up @@ -163,7 +163,7 @@ def get_business_profile(self) -> Union[Dict[str, Any], str]:
return f"Failed to retrieve business profile: {e!s}"

def get_tools(self) -> List[FunctionTool]:
"""Returns a list of OpenAIFunction objects representing the
r"""Returns a list of OpenAIFunction objects representing the
functions in the toolkit.
Returns:
Expand Down
8 changes: 4 additions & 4 deletions camel/utils/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,12 @@ def handle_http_error(response: requests.Response) -> str:
def retry_request(
func: Callable, retries: int = 3, delay: int = 1, *args: Any, **kwargs: Any
) -> Any:
"""Retries a function in case of any errors.
r"""Retries a function in case of any errors.
Args:
func (callable): The function to be retried.
retries (int): Number of retry attempts. Defaults to 3.
delay (int): Delay between retries in seconds. Defaults to 1.
func (Callable): The function to be retried.
retries (int): Number of retry attempts. (default: :obj:`3`)
delay (int): Delay between retries in seconds. (default: :obj:`1`)
*args: Arguments to pass to the function.
**kwargs: Keyword arguments to pass to the function.
Expand Down

0 comments on commit 8edcd11

Please sign in to comment.