ai-chatbot icon indicating copy to clipboard operation
ai-chatbot copied to clipboard

Document content is not part of the context?

Open andrewshvv opened this issue 10 months ago • 2 comments

Context
Hello, I’m currently working on the Mermaid editor and have chosen this project as my starting point.

The scenario I have in mind involves a user requesting the creation of a Mermaid schema and then having the ability to modify the schema, either manually or through a chat interface.

Issue
I’ve observed that the document content isn't included in the context; only document IDs are. This results in any user questions regarding the current schema in the chat being misleading, as the AI lacks the context of the tool's invocation and its outcome.

Questions
Q: Will the document content be included in the context in the future?
Q: If yes, do you have an ETA for that?
Q: If no, could you please provide some initial guidance on the proper way to add such context without disrupting the application?

Other

  1. It seems as if the content of the tool invocation is not populated here intentionally https://github.com/vercel/ai-chatbot/blob/93b02a85e1bef5a2efb1f7c55364f1a56357b8c7/lib/ai/tools/create-document.ts#L143

Solutions

  1. Populate context into chat.
  2. Add additional tool command to explain the current version of document.

andrewshvv avatar Feb 01 '25 11:02 andrewshvv

facing same issue!

adithya04dev avatar Feb 03 '25 11:02 adithya04dev

Allow the artifact to populate the tool result would solve this.

ale-vigano avatar Apr 13 '25 12:04 ale-vigano

@jeremyphilemon Have you seen this? Artifact content not being included in the context for follow-up questions seems like a big miss.

nileshtrivedi avatar May 06 '25 14:05 nileshtrivedi

One way to do this would be to provide a tool called read-document which simply returns the current content of the artifact to the LLM.

But artifacts are broken in other major ways. See #948 where create-document does not take the chat context into account for artifact generation! 😲

nileshtrivedi avatar May 07 '25 07:05 nileshtrivedi