hashbrown

uiDecisionResource

Chooses UI for an input with a decision.

In candidates mode the model picks among app-supplied components and the chosen candidates are exposed in order; render them with hb-ui-decision. Below minConfidence, or with no candidates, nothing is chosen. Must be called in an injection context and requires provideHashbrown.

API

declare function uiDecisionResource(
  options:  UiDecisionResourceCandidatesOptions ,
):  UiDecisionResourceCandidatesRef ;

The candidates-mode options.

Examples

readonly cards = uiDecisionResource({
  input: this.query,
  select: 'one',
  candidates: [
    { id: 'flight', description: 'One aircraft', component: FlightCard },
    { id: 'airport', description: 'An airport', component: AirportCard },
  ],
});

API

declare function uiDecisionResource(
  options:  UiDecisionResourceChatOptions ,
):  UiDecisionResourceChatRef ;
uiDecisionResource

The chat-mode options.

Examples

readonly chat = uiChatResource({
  system: 'Answer questions about live flights.',
  components: [flightCard, airportCard, weatherCard],
  tools: [getFlights],
});
readonly narrowing = uiDecisionResource({
  chat: this.chat,
  select: { max: 2 },
  system: 'A flight-tracking app. The input is a chat message.',
});