'Create a document for a writing or content creation activities like image generation. This tool will call other functions that will generate the contents of the document based on the title and kind.',
parameters: z.object({
title: z.string(),
kind: z.enum(['text','code','image']),
}),
execute: async({title,kind})=>{
constid=generateUUID();
letdraftText='';
dataStream.writeData({
type:'id',
content: id,
});
dataStream.writeData({
type:'title',
content: title,
});
dataStream.writeData({
type:'kind',
content: kind,
});
dataStream.writeData({
type:'clear',
content:'',
});
if(kind==='text'){
const{fullStream}=streamText({
model: customModel(model.apiIdentifier),
system:
'Write about the given topic. Markdown is supported. Use headings wherever appropriate.',