This dead simple library lets humans mock machines that mock humans. Forget about the bundle size, it's freaking AI tech.
You can chat with this fake AI here.
createStream
import { createStream } from 'aify';
const config = { delay: 1000, interval: 200 };
const reader = createStream('Hello, world!', config).getReader();
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
console.log(value);
}
createGenerator
This is a wrapper over createStream
.
import { createGenerator } from 'aify';
for await (const chunk of createGenerator('Hello, world!')) {
console.log(chunk);
}