Best of all
Use this flow to generate multiple alternatives and pick the best one.
Loading graph...
API Reference
criteria
type: string
Criteria to evaluate the responses and pick the best one.
input
type: FlowDefinition[]
Array of flows to evaluate.
Example
import { bestOfAll } from 'flows-ai/flows'
const bestOfFlow = bestOfAll({ criteria: 'Pick the response that is most helpful and concise', input: [ { agent: 'responseAgent', input: 'Generate response version 1' }, { agent: 'responseAgent', input: 'Generate response version 2' } ],})
12 collapsed lines
import { agent, execute } from 'flows-ai'
const responseAgent = agent({ model: openai('gpt-4o'), system: 'You are consumer relations specialist...',})
execute(bestOfFlow, { agents: { responseAgent }})