crewai-ts
Version:
TypeScript port of crewAI for agent-based workflows
57 lines • 1.78 kB
TypeScript
/**
* WebSearchTool implementation
* Provides search capabilities for agents to gather information from the web
* Optimized for performance and error handling
*/
import { z } from 'zod';
declare const searchInputSchema: z.ZodObject<{
query: z.ZodString;
numResults: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
includeUrls: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
includeDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
excludeDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
query?: string;
numResults?: number;
includeUrls?: boolean;
includeDomains?: string[];
excludeDomains?: string[];
}, {
query?: string;
numResults?: number;
includeUrls?: boolean;
includeDomains?: string[];
excludeDomains?: string[];
}>;
type SearchInput = z.infer<typeof searchInputSchema>;
export interface SearchResult {
title: string;
snippet: string;
url?: string;
position?: number;
}
/**
* Options for configuring the WebSearchTool
*/
export interface WebSearchToolOptions {
apiKey?: string;
searchEngine?: 'google' | 'bing' | 'duckduckgo' | 'custom';
customSearchFunction?: (input: SearchInput) => Promise<SearchResult[]>;
cacheResults?: boolean;
cacheExpiration?: number;
timeoutMs?: number;
maxRetries?: number;
userAgent?: string;
}
/**
* Creates a web search tool with the specified configuration
*/
export declare function createWebSearchTool(options?: WebSearchToolOptions): import("../StructuredTool.js").StructuredTool<{
query?: string;
numResults?: number;
includeUrls?: boolean;
includeDomains?: string[];
excludeDomains?: string[];
}, SearchResult[]>;
export {};
//# sourceMappingURL=WebSearchTool.d.ts.map