Generating documents as a result of a chat #3949
-
Hi, might be a very simple answer - in my use case the user has an interaction with the AI (currently with useChat and streamText), and using this information I want to generate a templated document for the user (as you might have an artifact from Claude). Could I use a tool for this and call another generateText route or is there a standard approach for this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! It depends on exactly when you would want to create the document, but yes, you could absolutely do this with a tool. You can access the entire |
Beta Was this translation helpful? Give feedback.
Hey! It depends on exactly when you would want to create the document, but yes, you could absolutely do this with a tool. You can access the entire
messages
from any tool call and could perform a generateText or generateObject within the tool call. You could add system instructions to control when the model should run the tool if you want it to be run every x turns etc.