UNPKG

@ag076810/ai

Version:

Effortlessly integrate AI text and image models in your node applications

12 lines (11 loc) 291 B
async function expectStream(stream, value) { let response = ""; for await (const token of stream) { response += token; if (response.toLowerCase().indexOf(value) !== -1) { return true; } } return false; } module.exports = { expectStream };