@agentdao/core
Version:
Core functionality, skills, and ready-made UI components for AgentDAO - Web3 subscriptions, content generation, social media, help support, live chat, RSS fetching, web search, and agent pricing integration
79 lines (78 loc) • 2.12 kB
TypeScript
import { SearchOptions, SearchResult, AISearchResult } from './search-utils';
export interface WebSearchOptions {
query: string;
maxResults?: number;
includeImages?: boolean;
includeNews?: boolean;
language?: string;
region?: string;
timeRange?: 'day' | 'week' | 'month' | 'year';
provider?: 'google' | 'bing' | 'openai';
}
export interface WebSearchConfig {
agentId: string;
agentName: string;
domain: string;
ai: {
provider: 'openai';
model?: string;
apiKey: string;
maxTokens?: number;
temperature?: number;
};
search: {
provider?: 'google' | 'bing' | 'openai';
apiKey?: string;
maxResults?: number;
includeImages?: boolean;
includeNews?: boolean;
};
integrations?: {
newsApi?: string;
unsplashApi?: string;
};
robust?: {
enableRetry?: boolean;
enableRateLimit?: boolean;
enableCache?: boolean;
enableCircuitBreaker?: boolean;
};
database?: {
endpoint: string;
apiKey?: string;
};
}
export declare class WebSearchSkill {
private config;
private cache?;
private circuitBreaker?;
constructor(config: WebSearchConfig);
searchWeb(options: WebSearchOptions): Promise<SearchResult[]>;
searchNews(query: string, options?: SearchOptions): Promise<SearchResult[]>;
searchImages(query: string, options?: SearchOptions): Promise<SearchResult[]>;
searchWithAI(query: string, context?: string): Promise<AISearchResult>;
/**
* Validate search query
*/
validateQuery(query: string): Promise<{
isValid: boolean;
errors: string[];
suggestions: string[];
}>;
/**
* Save search results to database (if configured)
*/
saveSearch(query: string, results: SearchResult[]): Promise<void>;
/**
* Clear the search cache
*/
clearCache(): void;
/**
* Get circuit breaker state
*/
getCircuitBreakerState(): string;
/**
* Get cache size
*/
getCacheSize(): number;
}