Camel.toolkits.notion toolkit
get_plain_text_from_rich_text
Extracts plain text from a list of rich text elements.
Parameters:
- rich_text: A list of dictionaries representing rich text elements. Each dictionary should contain a key named “plain_text” with the plain text content.
Returns:
str: A string containing the combined plain text from all elements, joined together.
get_media_source_text
Extracts the source URL and optional caption from a Notion media block.
Parameters:
- block: A dictionary representing a Notion media block.
Returns:
A string containing the source URL and caption (if available), separated by a colon.
NotionToolkit
A toolkit for retrieving information from the user’s notion pages.
Attributes:
notion_token (Optional[str], optional): The notion_token used to
interact with notion APIs. (default: :obj:None
)
notion_client (module): The notion module for interacting with
the notion APIs.
init
Initializes the NotionToolkit.
Parameters:
- notion_token (Optional[str], optional): The optional notion_token used to interact with notion APIs.(default: :obj:
None
)
list_all_users
Returns:
List[dict]: A list of user objects with type, name, and workspace.
list_all_pages
Returns:
List[dict]: A list of page objects with title and id.
get_notion_block_text_content
Retrieves the text content of a Notion block.
Parameters:
- block_id (str): The ID of the Notion block to retrieve.
Returns:
str: The text content of a Notion block, containing all the sub blocks.
get_text_from_block
Extracts plain text from a Notion block based on its type.
Parameters:
- block (dict): A dictionary representing a Notion block.
Returns:
str: A string containing the extracted plain text and block type.
get_tools
Returns:
List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.