agents
Version:
A home for your AI agents
72 lines (70 loc) • 2.03 kB
TypeScript
import {
C as WebSearchResponse,
E as WebSearchToolOutput,
S as WEB_SEARCH_TOOL_NAME,
T as WebSearchToolInput,
c as WebSearchError,
d as WebSearchProvider,
l as WebSearchErrorCode,
p as WebSearchSource,
r as WebSearchToolOptions,
w as WebSearchResult
} from "../../../tool-CTp72Jb_.js";
//#region src/web/search/tools/tanstack-ai.d.ts
type TanStackWebSearchToolOptions<
TName extends string = typeof WEB_SEARCH_TOOL_NAME
> = WebSearchToolOptions & {
/** The tool's name. TanStack AI tools carry it in the definition. */ name?: TName;
};
/**
* Create a TanStack AI tool that searches the web through Cloudflare's Web
* Search API. TanStack AI has one return channel, so the model and the host
* both get the trimmed text rendering. A failed search throws a
* `WebSearchError`, which TanStack AI reports as an error result: its
* `message` is written for the model, and its `cause` is the source's error
* with the API's detail. The tool is named `web_search` unless you pass
* `name`.
*
* @example
* ```ts
* import { webSearchTool } from "agents/websearch/tanstack-ai";
* import { chat } from "@tanstack/ai";
*
* const stream = chat({
* adapter,
* tools: [webSearchTool({ binding: env.AI })],
* messages
* });
* ```
*/
declare function webSearchTool<
TName extends string = typeof WEB_SEARCH_TOOL_NAME
>(
options: TanStackWebSearchToolOptions<TName>
): import("@tanstack/ai").ServerTool<
import("zod").ZodObject<
{
query: import("zod").ZodString;
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
},
import("zod/v4/core").$strip
>,
import("@tanstack/ai").SchemaInput,
TName,
unknown
>;
//#endregion
export {
TanStackWebSearchToolOptions,
WebSearchError,
type WebSearchErrorCode,
type WebSearchProvider,
type WebSearchResponse,
type WebSearchResult,
type WebSearchSource,
type WebSearchToolInput,
type WebSearchToolOptions,
type WebSearchToolOutput,
webSearchTool
};
//# sourceMappingURL=tanstack-ai.d.ts.map