ask
Interactive (human-in-the-loop) component tool — the model fills the component's props from the schema's output; the value the component emits back to the framework becomes the tool result sent to the model.
The component's signal inputs are checked against the schema output type
(strict-but-flexible: every schema key must be a declared input with an
assignable type; the component may declare extra inputs the schema doesn't
fill). Author the component with ViewProps<typeof schema> to derive input
prop types directly from the schema.
import { ask } from '@threadplane/chat';Declaration · overload 1
export declare function ask<S extends StandardSchemaV1, C>(description: string, schema: S, component: AcceptComponent<S, C>, options?: ClientToolContinuationOptions): AskToolDef<S, C>;Type parameters
C
Parameters
description· requiredstringNatural-language description the model sees.
schema· requiredSStandard Schema defining the props the model must supply.
component· requiredAcceptComponent<S, C>Angular component whose signal inputs must be compatible with the schema output. A type-level error is reported here when they diverge.
options· optionalClientToolContinuationOptions
Returns
AskToolDef<S, C>An AskToolDef for inclusion in tools.
Examples
const schema = z.object({ question: z.string(), options: z.array(z.string()) });
type Inputs = ViewProps<typeof schema>;
\@Component({ ... })
class ChoiceCardComponent {
question = input.required<string>();
options = input.required<string[]>();
// Emits the chosen option back to the model.
}
const choice = ask('Ask the user to choose', schema, ChoiceCardComponent);
const registry = tools({ pick_option: choice });