@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
73 lines (72 loc) • 2.29 kB
TypeScript
/**
* Vector Query Tool
*
* Provides semantic search capabilities for RAG pipelines.
* Integrates with vector stores and supports metadata filtering and reranking.
*/
import { z } from "zod";
import type { MetadataFilter, RequestContext, VectorQueryResponse, VectorQueryResult, VectorQueryToolConfig, VectorStore } from "../../types/index.js";
/**
* Creates a vector query tool for semantic search
* Follows NeuroLink's factory pattern
*
* @param config - Tool configuration
* @param vectorStore - Vector store instance or resolver function
* @returns Tool object with execute method
*/
export declare function createVectorQueryTool(config: VectorQueryToolConfig, vectorStore: VectorStore | ((context: RequestContext) => VectorStore)): {
name: string;
description: string;
parameters: z.ZodObject<{
topK: z.ZodOptional<z.ZodNumber>;
filter?: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>> | undefined;
query: z.ZodString;
}, z.core.$strip>;
/**
* Execute the vector query
* @param params - Query parameters
* @param context - Optional request context
* @returns Query results with relevant context
*/
execute: (params: {
query: string;
filter?: MetadataFilter;
topK?: number;
}, context?: RequestContext) => Promise<VectorQueryResponse>;
};
/**
* In-memory vector store implementation for testing and development
*/
export declare class InMemoryVectorStore implements VectorStore {
private vectors;
/**
* Add vectors to an index
*/
upsert(indexName: string, items: Array<{
id: string;
vector: number[];
metadata?: Record<string, unknown>;
}>): Promise<void>;
/**
* Query vectors by similarity
*/
query(params: {
indexName: string;
queryVector: number[];
topK?: number;
filter?: MetadataFilter;
includeVectors?: boolean;
}): Promise<VectorQueryResult[]>;
/**
* Delete vectors from an index
*/
delete(indexName: string, ids: string[]): Promise<void>;
/**
* Check if metadata matches filter
*/
private matchesFilter;
/**
* Calculate cosine similarity between two vectors
*/
private cosineSimilarity;
}