Creates a tool with a schema.
API
declare function createTool<
const Name extends string,
Schema extends s.HashbrownType ,
Result,
>(input: {
name: Name;
description: string;
schema: Schema;
handler: (
input: s.Infer <Schema>,
abortSignal: AbortSignal ,
) => Promise <Result>;
}): Chat.Tool <
Name,
s.Infer <Schema>,
Result
>;createTool
Chat.Tool<Name, s.Infer<Schema>, Result>@paraminput:{
name: Name;
description: string;
schema: Schema;
handler: (input: s.Infer<Schema>, abortSignal: AbortSignal) => Promise<Result>;
}The input for the tool containing: - name: The name of the tool - description: The description of the tool - schema: The schema of the tool - handler: The handler of the tool
@typeNamestring@typeSchemas.HashbrownType@typeResult@returnsChat.Tool<Name, s.Infer<Schema>, Result>API
declare function createTool<const Name extends string, Result>(input: {
name: Name;
description: string;
schema: object;
handler: (
input: any,
abortSignal: AbortSignal ,
) => Promise <Result>;
}): Chat.Tool <Name, any, Result>;createTool
Chat.Tool<Name, any, Result>@paraminput:{
name: Name;
description: string;
schema: object;
handler: (input: any, abortSignal: AbortSignal) => Promise<Result>;
}The input for the tool containing: - name: The name of the tool - description: The description of the tool - schema: The schema of the tool - handler: The handler of the tool
@typeNamestring@typeResult@returnsChat.Tool<Name, any, Result>API
declare function createTool<const Name extends string, Result>(input: {
name: Name;
description: string;
handler: (
abortSignal: AbortSignal ,
) => Promise <Result>;
}): Chat.Tool <Name, void, Result>;createTool
Chat.Tool<Name, void, Result>@paraminput:{
name: Name;
description: string;
handler: (abortSignal: AbortSignal) => Promise<Result>;
}The input for the tool containing: - name: The name of the tool - description: The description of the tool - handler: The handler of the tool
@typeNamestring@typeResult@returnsChat.Tool<Name, void, Result>