Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NotionTool load_data bug #17522

Open
zhaoyilong1 opened this issue Jan 15, 2025 · 1 comment
Open

[Bug]: NotionTool load_data bug #17522

zhaoyilong1 opened this issue Jan 15, 2025 · 1 comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@zhaoyilong1
Copy link

Bug Description

    def load_data(
        self, page_ids: Optional[List[str]] = None, database_id: Optional[str] = None
    ) -> str:
        """Loads content from a set of page ids or a database id.

        Don't use this endpoint if you don't know the page ids or database id.

        """
        page_ids = page_ids or []
        docs = self.reader.load_data(page_ids=page_ids, database_id=database_id)
        return "\n".join([doc.get_content() for doc in docs])

above code in the notion tool is incorrect the database_id should database_ids in the read, so exception will throw here

Version

llama-index-tools-notion = "^0.3.0"

Steps to Reproduce

import
llama-index-tools-notion = "^0.3.0"
simply calling the method load_data will have errors.

Relevant Logs/Tracbacks

@zhaoyilong1 zhaoyilong1 added bug Something isn't working triage Issue needs to be triaged/prioritized labels Jan 15, 2025
Copy link

dosubot bot commented Jan 15, 2025

Hey @zhaoyilong1! 👋 I'm here to help you with any bugs, questions, or contributions you have regarding the NotionTool. I'll do my best to assist you while we wait for a human maintainer.

The issue you're encountering is due to a mismatch in the parameter name for the load_data method. The NotionTool class's load_data method is using database_id as a parameter, but it should be database_ids to match the expected parameter name in the reader object's load_data method [1].

To fix this, you should update the method signature and the call to the reader.load_data method to use database_ids instead of database_id. Here's how you can modify the code:

def load_data(
    self, page_ids: Optional[List[str]] = None, database_ids: Optional[List[str]] = None
) -> str:
    """Loads content from a set of page ids or a database id.

    Don't use this endpoint if you don't know the page ids or database id.

    """
    page_ids = page_ids or []
    docs = self.reader.load_data(page_ids=page_ids, database_ids=database_ids)
    return "\n".join([doc.get_content() for doc in docs])

This change should resolve the error you're experiencing.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

1 participant