0.2.17 • Published 3 months ago

ai-functions v0.2.17

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

AI Functions

Library for Developing and Managing AI Functions (including OpenAI GPT4 / GPT3.5)

Key Features:

  • Enables easy development of AI functions
import { AI } from 'ai-functions'

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

Then you can use magic ai functions:

const categorizeProduct = ai.categorizeProduct({
  productType: 'App | API | Marketplace | Platform | Packaged Service | Professional Service | Website',
  customer: 'ideal customer profile in 3-5 words',
  solution: 'describe the offer in 4-10 words',
  description: 'website meta description',
})

const product = await categorizeProduct({ domain: name })

you can also use list tagged template as a convienence function:

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 })
}
0.2.17

3 months ago

0.2.16

4 months ago

0.2.15

4 months ago

0.2.14

4 months ago

0.2.13

4 months ago

0.2.11

4 months ago

0.2.10

4 months ago

0.2.7

4 months ago

0.2.6

4 months ago

0.2.9

4 months ago

0.2.8

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.2.3

4 months ago

0.2.2

4 months ago

0.2.5

4 months ago

0.2.4

4 months ago

0.1.4

6 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

10 months ago