otto8-ai / otto8

Open source AI Agent Platform
Apache License 2.0
9 stars 9 forks source link

Notion - When updating contents of existing page , new page gets created with the updated contents. #251

Open sangee2004 opened 3 weeks ago

sangee2004 commented 3 weeks ago

Steps to reproduce the problem:

  1. Create a agent with all tools from Notion.

  2. Ask to create a new page

    Create a page "MyNew" with heading "my task list" and todo task "hello" under "My new test page"

    New page gets created as expected.

  3. Ask to update this page with some updated contents

    Add "my task list updated " and todo task "hello updated" in "MyNew" page

This results in another page with same name being created.

Screenshot 2024-10-21 at 12 47 57 PM

The new page gets created with following contents

Screenshot 2024-10-21 at 12 47 09 PM

Expected Behavior: Existing page should be updated instead.

Stack trace -calls (24).json

sangee2004 commented 3 weeks ago

In some cases, i see the behavior of new content that needs to be added to an existing page , results in a new page being added and linked to the existing page.

Asked to - Add a todo task with content "My check3" to page "hellosangee"

This resulted in a new page called "Todo task" created with content "My check3" and this page was added under hellosangee page.

Screenshot 2024-10-21 at 2 45 08 PM
njhale commented 3 weeks ago

Right now the notion tool only supports creating pages, not editing them. That would be an enhancement. I'll open a new issue for edit support, but in the meantime I'll add some guardrails to stop the LLM from calling the Create Page tool by mistake.

sangee2004 commented 1 week ago

@njhale I followed the same steps from outlined in the issue and still able to reproduce the issue.

Tool version used- github.com/otto8-ai/tools": "c03ab65f0d22660e733a897db4486582ddbc5974

I see a new page being created using the following the steps.

Image

This results in a new page getting created under the "MyNewNotoionUodate" page

Image

Debug logs - calls - 2024-11-05T151338.882.json

With the fix , do we expect this new file to be not created and instead expect the LLM to present a message to indicate that we do not support updating existing pages?

njhale commented 1 week ago

With the fix , do we expect this new file to be not created and instead expect the LLM to present a message to indicate that we do not support updating existing pages?

That's what we should expect. I think I can tighten the constraints in the context some more, but with the current tool version, it should definitely deny a request if you ask it to "Update a page" explicitly. It also seems like the phrasing of your query left enough ambiguity for the LLM to interpret this as "create a new subpage with this" instead of "update this page directly".

sangee2004 commented 1 week ago

@njhale I see the same behavior of creating new files even when I ask for updating the page.

Create chat: Image

Update chat: Image

Debug calls - calls - 2024-11-07T115341.159.json

calls - 2024-11-07T114956.902.json

njhale commented 1 week ago

OK, so it looks like this and only happens after you ask it to create at least one page. If you haven't done that yet it will block the "update" as intended.

Screenshot 2024-11-07 at 3 08 53 PM

I'll need to play around with the context some more to make sure it handles this case, but as it stands the context is pretty clear about asking for confirmation before creating ANY new page. Might be a case where I need to "yell" at the LLM and capitalize that line.

Should have something up today.