From 8b515201f341a3aba53f2f3bcbc7bc3a58b14303 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:53:03 +0530 Subject: [PATCH] feat(app): add search types --- src/lib/agents/search/types.ts | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/lib/agents/search/types.ts 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; +};