diff --git a/src/lib/agents/search/types.ts b/src/lib/agents/search/types.ts new file mode 100644 index 0000000..c65d940 --- /dev/null +++ b/src/lib/agents/search/types.ts @@ -0,0 +1,64 @@ +import { EventEmitter } from 'stream'; +import z from 'zod'; +import BaseLLM from '../../models/base/llm'; +import BaseEmbedding from '@/lib/models/base/embedding'; + +export type SearchSources = 'web' | 'discussions' | 'academic'; + +export type SearchAgentConfig = { + sources: SearchSources[]; + llm: BaseLLM; + embedding: BaseEmbedding; +}; + +export type SearchAgentInput = { + chatHistory: Message[]; + followUp: string; + config: SearchAgentConfig; +}; + +export interface Intent { + name: string; + description: string; + requiresSearch: boolean; + enabled: (config: { sources: SearchSources[] }) => boolean; +} + +export type Widget = z.ZodObject> = { + name: string; + description: string; + schema: TSchema; + execute: ( + params: z.infer, + additionalConfig: AdditionalConfig, + ) => Promise; +}; + +export type WidgetConfig = { + type: string; + params: Record; +}; + +export type WidgetOutput = { + type: string; + data: any; +}; + +export type ClassifierInput = { + llm: BaseLLM; + enabledSources: SearchSources[]; + query: string; + chatHistory: Message[]; +}; + +export type ClassifierOutput = { + skipSearch: boolean; + intents: string[]; + widgets: WidgetConfig[]; +}; + +export type AdditionalConfig = { + llm: BaseLLM; + embedding: BaseLLM; + emitter: EventEmitter; +};