const thread = await client.thread().upsert();
const fileStream = createReadStream('PATH_TO_FILE');
const mime = 'image/png';
const { objectKey } = await client.api.uploadFile({
threadId: thread.id,
content: fileStream,
mime
});
const attachment = new Attachment({
name: 'test',
objectKey,
mime
});
const finalStep = await thread
.step({
name: 'Assistant',
type: 'assistant_message',
output: "Here is the generated image!",
attachments: [attachment]
})
.send();