ai-list
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

ai-list: AI-Powered List Generation

npm install ai-list

or

yarn add ai-list

Then you can use it simply:

import { AI } from 'ai-list'

const { list, gpt } = AI({ apiKey = 'OPENAI_API_KEY' })

const things = await list`fun things to do in Miami`
console.log(things)

or with Async iterators:

for await (const thing of list`fun things to do in Miami`) {
  console.log(thing)
}

Or in a more complex example:

const listBlogPosts = (count, topic) => list`${count} blog post titles about ${topic}`
const writeBlogPost = title => gpt`write a blog post in markdown starting with "# ${title}"`

async function* writeBlog(count, topic) {
  for await (const title of listBlogPosts(count, topic)) {
    const content = await writeBlogPost(title)
    yield { title, content }
  }
}

for await (const post of writeBlog(25, 'future of car sales')) {
  console.log({ post })
}

Package Sidebar

Install

npm i ai-list

Weekly Downloads

5

Version

0.1.4

License

MIT

Unpacked Size

26.9 kB

Total Files

8

Last publish

Collaborators

  • nathanclevenger