Skip to main content

Function: baleybotFamily()

baleybotFamily<TInput, TOutputSchema, TTools>(build, options?): BaleybotFamily<TInput, TOutputSchema, TTools>

Defined in: packages/core/src/baleybot-family.ts:43

Declare a family of Baleybots.

A thin specialisation of processableFamily: the build function returns a config rather than a node, and the member is constructed with a declared family, which is what gives it a stable id and collapses the whole family into one dev-panel row whose override reaches every member.

Type Parameters​

TInput​

TInput

TOutputSchema​

TOutputSchema = undefined

TTools​

TTools extends Tools = Record<string, never>

Parameters​

build​

(input) => BaleybotConfig<TOutputSchema, TTools>

options?​

FamilyOptions<TInput>

Returns​

BaleybotFamily<TInput, TOutputSchema, TTools>

Example​

const supportBot = baleybotFamily(
(input: { team: string }) => ({
name: `support-${input.team}`,
goal: `Handle ${input.team} tickets`,
}),
{ name: 'support', key: (i) => i.team },
);

const billing = supportBot({ team: 'billing' }); // a real Baleybot
supportBot({ team: 'billing' }) === billing; // memoized