lists
Generate multiple named lists at once
Generate multiple named lists at once.
Import
import { lists } from 'ai-functions'Syntax
lists`prompt`
lists`prompt`(options)Examples
// Tagged template
const { pros, cons } = await lists`pros and cons of ${topic}`
// SWOT analysis
const { strengths, weaknesses, opportunities, threats } = await lists`
SWOT analysis for ${{ company, market, competitors }}
`
// Content gaps
const { existing, missing, opportunities } = await lists`
content gap analysis for ${{ topic, competitors }}
`Use Cases
// Decision making
const { reasons, risks } = await lists`
reasons to proceed and risks for ${decision}
`
// Competitive analysis
const { ourAdvantages, theirAdvantages } = await lists`
comparison of ${ourProduct} vs ${competitor}
`
// Planning
const { mustHave, niceToHave, outOfScope } = await lists`
requirements prioritization for ${project}
`Return Type
Returns an object with string arrays:
const result = await lists`pros and cons of ${topic}`
// {
// pros: ['Pro 1', 'Pro 2', ...],
// cons: ['Con 1', 'Con 2', ...]
// }vs Multiple list() Calls
// These achieve similar results:
// Single call - faster, contextual
const { pros, cons } = await lists`pros and cons of ${topic}`
// Multiple calls - separate context
const pros = await list`pros of ${topic}`
const cons = await list`cons of ${topic}`Use lists when items are related and should be generated together.
Was this page helpful?