ask

Unpublished development API. This package is under development and is not available as a published release.

Declares a tool the person answers. The model fills args; render draws the control in the transcript below the message's tool calls, and the value passed to answer becomes the tool result.

import { ask } from '@threadplane/react/chat';

Declaration · overload 1

export declare function ask<A, R>(tool: Omit<AskTool<A, R>, 'kind'>): AskTool<A, R>;

Type parameters

A
R

Parameters

tool · required
Omit<AskTool<A, R>, 'kind'>

Returns

AskTool<A, R>

Examples

const clientTools = createClientTools({
  pick_day: ask<{ days: string[] }, { day: string }>({
    description: 'Ask which day to plan.',
    render: ({ args, answer }) => <DayPicker days={args.days} onPick={(day) => answer({ day })} />,
  }),
});