UNPKG

mcp-context-engineering

Version:

The intelligent context optimization system for AI coding assistants. Built with Cole's PRP methodology, Context Portal knowledge graphs, and production-ready MongoDB architecture.

905 lines (904 loc) 31.9 kB
import { ObjectId } from 'mongodb'; import { z } from 'zod'; /** * Vector Embeddings Schema - MongoDB Atlas Vector Search Optimized * * Following best practices for: * - MongoDB Atlas Vector Search with hybrid search capabilities * - Voyage AI embeddings for English methodology descriptions * - Semantic search across context patterns and knowledge graphs * - Cross-workspace knowledge sharing and discovery */ export declare const EmbeddingDocumentSchema: z.ZodObject<{ _id: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; workspace_id: z.ZodString; project_id: z.ZodString; item_type: z.ZodEnum<["prp_methodology", "context_pattern", "decision", "progress_entry", "system_pattern", "query", "product_context", "active_context"]>; item_id: z.ZodString; embedding: z.ZodArray<z.ZodNumber, "many">; text_content: z.ZodString; text_type: z.ZodEnum<["methodology_description", "context_description", "query_text", "combined_text"]>; metadata: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; category: z.ZodOptional<z.ZodString>; tech_stack: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; complexity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>; pattern_type: z.ZodOptional<z.ZodString>; effectiveness_score: z.ZodOptional<z.ZodNumber>; usage_count: z.ZodDefault<z.ZodNumber>; success_rate: z.ZodOptional<z.ZodNumber>; created_at: z.ZodDate; last_accessed: z.ZodOptional<z.ZodDate>; last_updated: z.ZodDate; workspace_type: z.ZodDefault<z.ZodEnum<["private", "team", "public"]>>; access_level: z.ZodDefault<z.ZodEnum<["read", "write", "admin"]>>; }, "strip", z.ZodTypeAny, { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }, { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }>; related_items: z.ZodDefault<z.ZodArray<z.ZodObject<{ item_type: z.ZodString; item_id: z.ZodString; relationship: z.ZodString; strength: z.ZodNumber; }, "strip", z.ZodTypeAny, { item_type?: string; item_id?: string; relationship?: string; strength?: number; }, { item_type?: string; item_id?: string; relationship?: string; strength?: number; }>, "many">>; embedding_metadata: z.ZodObject<{ model: z.ZodDefault<z.ZodString>; model_version: z.ZodOptional<z.ZodString>; generation_timestamp: z.ZodDate; token_count: z.ZodOptional<z.ZodNumber>; processing_time_ms: z.ZodOptional<z.ZodNumber>; confidence_score: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }, { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }>; version: z.ZodDefault<z.ZodNumber>; superseded_by: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; supersedes: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; }, "strip", z.ZodTypeAny, { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }, { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }>; export declare const SemanticQuerySchema: z.ZodObject<{ query_text: z.ZodString; query_embedding: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>; k: z.ZodDefault<z.ZodNumber>; min_score: z.ZodDefault<z.ZodNumber>; filters: z.ZodOptional<z.ZodObject<{ workspace_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; project_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; item_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; tech_stacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; complexity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>; min_effectiveness: z.ZodOptional<z.ZodNumber>; created_after: z.ZodOptional<z.ZodDate>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { tags?: string[]; complexity?: "low" | "medium" | "high"; tech_stacks?: string[]; min_effectiveness?: number; workspace_ids?: string[]; project_ids?: string[]; item_types?: string[]; created_after?: Date; }, { tags?: string[]; complexity?: "low" | "medium" | "high"; tech_stacks?: string[]; min_effectiveness?: number; workspace_ids?: string[]; project_ids?: string[]; item_types?: string[]; created_after?: Date; }>>; include_metadata: z.ZodDefault<z.ZodBoolean>; include_text_content: z.ZodDefault<z.ZodBoolean>; cross_workspace: z.ZodDefault<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { filters?: { tags?: string[]; complexity?: "low" | "medium" | "high"; tech_stacks?: string[]; min_effectiveness?: number; workspace_ids?: string[]; project_ids?: string[]; item_types?: string[]; created_after?: Date; }; query_text?: string; query_embedding?: number[]; k?: number; min_score?: number; include_metadata?: boolean; include_text_content?: boolean; cross_workspace?: boolean; }, { filters?: { tags?: string[]; complexity?: "low" | "medium" | "high"; tech_stacks?: string[]; min_effectiveness?: number; workspace_ids?: string[]; project_ids?: string[]; item_types?: string[]; created_after?: Date; }; query_text?: string; query_embedding?: number[]; k?: number; min_score?: number; include_metadata?: boolean; include_text_content?: boolean; cross_workspace?: boolean; }>; export declare const SearchResultSchema: z.ZodObject<{ document: z.ZodObject<{ _id: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; workspace_id: z.ZodString; project_id: z.ZodString; item_type: z.ZodEnum<["prp_methodology", "context_pattern", "decision", "progress_entry", "system_pattern", "query", "product_context", "active_context"]>; item_id: z.ZodString; embedding: z.ZodArray<z.ZodNumber, "many">; text_content: z.ZodString; text_type: z.ZodEnum<["methodology_description", "context_description", "query_text", "combined_text"]>; metadata: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; category: z.ZodOptional<z.ZodString>; tech_stack: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; complexity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>; pattern_type: z.ZodOptional<z.ZodString>; effectiveness_score: z.ZodOptional<z.ZodNumber>; usage_count: z.ZodDefault<z.ZodNumber>; success_rate: z.ZodOptional<z.ZodNumber>; created_at: z.ZodDate; last_accessed: z.ZodOptional<z.ZodDate>; last_updated: z.ZodDate; workspace_type: z.ZodDefault<z.ZodEnum<["private", "team", "public"]>>; access_level: z.ZodDefault<z.ZodEnum<["read", "write", "admin"]>>; }, "strip", z.ZodTypeAny, { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }, { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }>; related_items: z.ZodDefault<z.ZodArray<z.ZodObject<{ item_type: z.ZodString; item_id: z.ZodString; relationship: z.ZodString; strength: z.ZodNumber; }, "strip", z.ZodTypeAny, { item_type?: string; item_id?: string; relationship?: string; strength?: number; }, { item_type?: string; item_id?: string; relationship?: string; strength?: number; }>, "many">>; embedding_metadata: z.ZodObject<{ model: z.ZodDefault<z.ZodString>; model_version: z.ZodOptional<z.ZodString>; generation_timestamp: z.ZodDate; token_count: z.ZodOptional<z.ZodNumber>; processing_time_ms: z.ZodOptional<z.ZodNumber>; confidence_score: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }, { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }>; version: z.ZodDefault<z.ZodNumber>; superseded_by: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; supersedes: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; }, "strip", z.ZodTypeAny, { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }, { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }>; similarity_score: z.ZodNumber; rank: z.ZodNumber; explanation: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { similarity_score?: number; document?: { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }; rank?: number; explanation?: string; }, { similarity_score?: number; document?: { workspace_id?: string; project_id?: string; _id?: ObjectId; metadata?: { title?: string; description?: string; tags?: string[]; effectiveness_score?: number; usage_count?: number; pattern_type?: string; complexity?: "low" | "medium" | "high"; created_at?: Date; tech_stack?: string[]; last_updated?: Date; category?: string; success_rate?: number; last_accessed?: Date; workspace_type?: "private" | "team" | "public"; access_level?: "read" | "write" | "admin"; }; version?: number; item_type?: "active_context" | "product_context" | "prp_methodology" | "query" | "decision" | "progress_entry" | "system_pattern" | "context_pattern"; item_id?: string; embedding?: number[]; text_content?: string; text_type?: "methodology_description" | "context_description" | "query_text" | "combined_text"; related_items?: { item_type?: string; item_id?: string; relationship?: string; strength?: number; }[]; embedding_metadata?: { confidence_score?: number; model?: string; model_version?: string; generation_timestamp?: Date; token_count?: number; processing_time_ms?: number; }; superseded_by?: ObjectId; supersedes?: ObjectId; }; rank?: number; explanation?: string; }>; export declare const BatchEmbeddingSchema: z.ZodObject<{ _id: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; batch_id: z.ZodString; workspace_id: z.ZodString; project_id: z.ZodString; status: z.ZodEnum<["pending", "processing", "completed", "failed"]>; total_items: z.ZodNumber; processed_items: z.ZodDefault<z.ZodNumber>; failed_items: z.ZodDefault<z.ZodNumber>; started_at: z.ZodOptional<z.ZodDate>; completed_at: z.ZodOptional<z.ZodDate>; processing_time_ms: z.ZodOptional<z.ZodNumber>; items: z.ZodArray<z.ZodObject<{ item_id: z.ZodString; item_type: z.ZodString; text_content: z.ZodString; metadata: z.ZodRecord<z.ZodString, z.ZodAny>; status: z.ZodDefault<z.ZodEnum<["pending", "processing", "completed", "failed"]>>; error_message: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { status?: "completed" | "pending" | "processing" | "failed"; metadata?: Record<string, any>; item_type?: string; item_id?: string; text_content?: string; error_message?: string; }, { status?: "completed" | "pending" | "processing" | "failed"; metadata?: Record<string, any>; item_type?: string; item_id?: string; text_content?: string; error_message?: string; }>, "many">; embedding_config: z.ZodObject<{ model: z.ZodDefault<z.ZodString>; batch_size: z.ZodDefault<z.ZodNumber>; retry_attempts: z.ZodDefault<z.ZodNumber>; timeout_ms: z.ZodDefault<z.ZodNumber>; }, "strip", z.ZodTypeAny, { model?: string; batch_size?: number; retry_attempts?: number; timeout_ms?: number; }, { model?: string; batch_size?: number; retry_attempts?: number; timeout_ms?: number; }>; created_at: z.ZodDate; updated_at: z.ZodDate; }, "strip", z.ZodTypeAny, { status?: "completed" | "pending" | "processing" | "failed"; workspace_id?: string; project_id?: string; _id?: ObjectId; created_at?: Date; updated_at?: Date; items?: { status?: "completed" | "pending" | "processing" | "failed"; metadata?: Record<string, any>; item_type?: string; item_id?: string; text_content?: string; error_message?: string; }[]; processing_time_ms?: number; batch_id?: string; total_items?: number; processed_items?: number; failed_items?: number; started_at?: Date; completed_at?: Date; embedding_config?: { model?: string; batch_size?: number; retry_attempts?: number; timeout_ms?: number; }; }, { status?: "completed" | "pending" | "processing" | "failed"; workspace_id?: string; project_id?: string; _id?: ObjectId; created_at?: Date; updated_at?: Date; items?: { status?: "completed" | "pending" | "processing" | "failed"; metadata?: Record<string, any>; item_type?: string; item_id?: string; text_content?: string; error_message?: string; }[]; processing_time_ms?: number; batch_id?: string; total_items?: number; processed_items?: number; failed_items?: number; started_at?: Date; completed_at?: Date; embedding_config?: { model?: string; batch_size?: number; retry_attempts?: number; timeout_ms?: number; }; }>; export declare const VectorIndexConfigSchema: z.ZodObject<{ index_name: z.ZodString; collection_name: z.ZodString; vector_field: z.ZodDefault<z.ZodString>; dimensions: z.ZodDefault<z.ZodNumber>; similarity: z.ZodDefault<z.ZodEnum<["cosine", "euclidean", "dotProduct"]>>; index_options: z.ZodObject<{ type: z.ZodLiteral<"vector">; numLists: z.ZodOptional<z.ZodNumber>; filters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { type?: "vector"; filters?: string[]; numLists?: number; }, { type?: "vector"; filters?: string[]; numLists?: number; }>; created_at: z.ZodDate; status: z.ZodEnum<["creating", "ready", "failed"]>; index_size_mb: z.ZodOptional<z.ZodNumber>; document_count: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { status?: "failed" | "creating" | "ready"; created_at?: Date; index_name?: string; collection_name?: string; vector_field?: string; dimensions?: number; similarity?: "cosine" | "euclidean" | "dotProduct"; index_options?: { type?: "vector"; filters?: string[]; numLists?: number; }; index_size_mb?: number; document_count?: number; }, { status?: "failed" | "creating" | "ready"; created_at?: Date; index_name?: string; collection_name?: string; vector_field?: string; dimensions?: number; similarity?: "cosine" | "euclidean" | "dotProduct"; index_options?: { type?: "vector"; filters?: string[]; numLists?: number; }; index_size_mb?: number; document_count?: number; }>; export declare const EmbeddingAnalyticsSchema: z.ZodObject<{ _id: z.ZodOptional<z.ZodType<ObjectId, z.ZodTypeDef, ObjectId>>; workspace_id: z.ZodString; analysis_period: z.ZodObject<{ start_date: z.ZodDate; end_date: z.ZodDate; }, "strip", z.ZodTypeAny, { start_date?: Date; end_date?: Date; }, { start_date?: Date; end_date?: Date; }>; usage_stats: z.ZodObject<{ total_embeddings: z.ZodNumber; new_embeddings: z.ZodNumber; updated_embeddings: z.ZodNumber; search_queries: z.ZodNumber; avg_search_latency_ms: z.ZodNumber; cache_hit_rate: z.ZodNumber; }, "strip", z.ZodTypeAny, { total_embeddings?: number; new_embeddings?: number; updated_embeddings?: number; search_queries?: number; avg_search_latency_ms?: number; cache_hit_rate?: number; }, { total_embeddings?: number; new_embeddings?: number; updated_embeddings?: number; search_queries?: number; avg_search_latency_ms?: number; cache_hit_rate?: number; }>; quality_metrics: z.ZodObject<{ avg_similarity_score: z.ZodNumber; search_satisfaction_rate: z.ZodNumber; false_positive_rate: z.ZodNumber; coverage_completeness: z.ZodNumber; }, "strip", z.ZodTypeAny, { avg_similarity_score?: number; search_satisfaction_rate?: number; false_positive_rate?: number; coverage_completeness?: number; }, { avg_similarity_score?: number; search_satisfaction_rate?: number; false_positive_rate?: number; coverage_completeness?: number; }>; performance_insights: z.ZodObject<{ top_search_patterns: z.ZodArray<z.ZodString, "many">; most_effective_embeddings: z.ZodArray<z.ZodString, "many">; optimization_opportunities: z.ZodArray<z.ZodString, "many">; recommended_actions: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { optimization_opportunities?: string[]; top_search_patterns?: string[]; most_effective_embeddings?: string[]; recommended_actions?: string[]; }, { optimization_opportunities?: string[]; top_search_patterns?: string[]; most_effective_embeddings?: string[]; recommended_actions?: string[]; }>; cost_tracking: z.ZodObject<{ embedding_api_calls: z.ZodNumber; estimated_cost_usd: z.ZodNumber; token_usage: z.ZodNumber; cost_per_search: z.ZodNumber; }, "strip", z.ZodTypeAny, { embedding_api_calls?: number; estimated_cost_usd?: number; token_usage?: number; cost_per_search?: number; }, { embedding_api_calls?: number; estimated_cost_usd?: number; token_usage?: number; cost_per_search?: number; }>; analysis_date: z.ZodDate; next_analysis_due: z.ZodDate; }, "strip", z.ZodTypeAny, { workspace_id?: string; _id?: ObjectId; analysis_date?: Date; analysis_period?: { start_date?: Date; end_date?: Date; }; next_analysis_due?: Date; usage_stats?: { total_embeddings?: number; new_embeddings?: number; updated_embeddings?: number; search_queries?: number; avg_search_latency_ms?: number; cache_hit_rate?: number; }; quality_metrics?: { avg_similarity_score?: number; search_satisfaction_rate?: number; false_positive_rate?: number; coverage_completeness?: number; }; performance_insights?: { optimization_opportunities?: string[]; top_search_patterns?: string[]; most_effective_embeddings?: string[]; recommended_actions?: string[]; }; cost_tracking?: { embedding_api_calls?: number; estimated_cost_usd?: number; token_usage?: number; cost_per_search?: number; }; }, { workspace_id?: string; _id?: ObjectId; analysis_date?: Date; analysis_period?: { start_date?: Date; end_date?: Date; }; next_analysis_due?: Date; usage_stats?: { total_embeddings?: number; new_embeddings?: number; updated_embeddings?: number; search_queries?: number; avg_search_latency_ms?: number; cache_hit_rate?: number; }; quality_metrics?: { avg_similarity_score?: number; search_satisfaction_rate?: number; false_positive_rate?: number; coverage_completeness?: number; }; performance_insights?: { optimization_opportunities?: string[]; top_search_patterns?: string[]; most_effective_embeddings?: string[]; recommended_actions?: string[]; }; cost_tracking?: { embedding_api_calls?: number; estimated_cost_usd?: number; token_usage?: number; cost_per_search?: number; }; }>; export type EmbeddingDocument = z.infer<typeof EmbeddingDocumentSchema>; export type SemanticQuery = z.infer<typeof SemanticQuerySchema>; export type SearchResult = z.infer<typeof SearchResultSchema>; export type BatchEmbedding = z.infer<typeof BatchEmbeddingSchema>; export type VectorIndexConfig = z.infer<typeof VectorIndexConfigSchema>; export type EmbeddingAnalytics = z.infer<typeof EmbeddingAnalyticsSchema>; /** * Vector Search Service Helper Class * Provides utilities for working with MongoDB Atlas Vector Search */ export declare class VectorSearchHelper { /** * Generate MongoDB Atlas Vector Search aggregation pipeline */ static createVectorSearchPipeline(query: SemanticQuery): any[]; /** * Build filter expression for hybrid search */ private static buildFilterExpression; /** * Create vector search index definition */ static createVectorIndexDefinition(config: VectorIndexConfig): any; /** * Calculate embedding similarity */ static calculateCosineSimilarity(embedding1: number[], embedding2: number[]): number; }