/** * GraphRAG-enhanced LLM orchestrator * * Extends the base orchestrator with semantic search capabilities * to provide better context for skill extraction and prerequisite inference. * * @packageDocumentation */ import type { LLMAdapter, SkillExtractionRequest, SkillExtractionResponse, PrerequisiteInferenceRequest, PrerequisiteInferenceResponse, DecompositionRequest, DecompositionResponse, ExtractedSkillLLM } from '../types/llm.js'; import type { BloomLevel } from '../types/bloom.js'; import type { GraphRAGStorage, VectorSearchResult } from '../types/graphrag.js'; import { LLMOrchestrator } from './orchestrator.js'; /** * Options for GraphRAG-enhanced operations */ export interface GraphRAGOrchestratorOptions { /** Maximum similar skills to include in context (default: 5) */ maxContextSkills?: number; /** Minimum similarity score for context skills (default: 0.6) */ minContextScore?: number; /** Include prerequisite chains in context (default: true) */ includePrerequisites?: boolean; /** Weight for similar skill context in prompt (default: 0.3) */ contextWeight?: number; } /** * Extended extraction request with RAG context */ export interface RAGSkillExtractionRequest extends SkillExtractionRequest { /** Enable RAG-enhanced extraction */ useRAG?: boolean; /** RAG options */ ragOptions?: GraphRAGOrchestratorOptions; } /** * Extended extraction response with RAG metadata */ export interface RAGSkillExtractionResponse extends SkillExtractionResponse { /** Similar skills used for context */ contextSkills?: VectorSearchResult[]; /** RAG context that was provided */ ragContext?: string; } /** * Extended decomposition request with RAG */ export interface RAGDecompositionRequest extends DecompositionRequest { /** Enable RAG-enhanced decomposition */ useRAG?: boolean; /** RAG options */ ragOptions?: GraphRAGOrchestratorOptions; } /** * Extended decomposition response with RAG metadata */ export interface RAGDecompositionResponse extends DecompositionResponse { /** Similar skills used for context */ contextSkills?: VectorSearchResult[]; /** RAG context that was provided */ ragContext?: string; /** Skills that were matched to existing graph skills */ matchedSkills?: Array<{ extractedId: string; matchedSkillId: string; similarity: number; }>; } /** * GraphRAG-enhanced LLM orchestrator * * Provides semantic search-enhanced skill extraction and prerequisite inference. */ export declare class GraphRAGOrchestrator extends LLMOrchestrator { private storage; private defaultOptions; constructor(adapter: LLMAdapter, storage?: GraphRAGStorage, options?: GraphRAGOrchestratorOptions); /** * Set the GraphRAG storage */ setStorage(storage: GraphRAGStorage): void; /** * Get the current storage */ getStorage(): GraphRAGStorage | null; /** * Check if GraphRAG is available */ isRAGEnabled(): boolean; /** * Build context string from similar skills */ private formatSkillContext; /** * Build context from full GraphRAG context */ private formatGraphRAGContext; /** * Extract skills with RAG enhancement */ extractSkillsWithRAG(request: RAGSkillExtractionRequest): Promise; /** * Infer prerequisites with RAG enhancement */ inferPrerequisitesWithRAG(request: PrerequisiteInferenceRequest & { useRAG?: boolean; ragOptions?: GraphRAGOrchestratorOptions; }): Promise; /** * Full curriculum decomposition with RAG enhancement */ decomposeWithRAG(request: RAGDecompositionRequest): Promise; /** * Find existing skills that match extracted skills * * Use this after extraction to identify duplicates */ matchExtractedSkills(extractedSkills: ExtractedSkillLLM[], options?: { minSimilarity?: number; }): Promise>; /** * Suggest prerequisite links between extracted and existing skills */ suggestPrerequisiteLinks(extractedSkills: Array<{ id: string; name: string; description: string; bloomLevel: BloomLevel; }>, options?: { maxSuggestionsPerSkill?: number; }): Promise; suggestedDependents: Array<{ skillId: string; skillName: string; confidence: number; }>; }>>; /** * Generate a personalized learning path with LLM-enhanced reasoning * * This combines GraphRAG path generation with LLM analysis * to provide better explanations and alternative paths. */ generateLearningPath(request: LearningPathRequest): Promise; /** * Format a learning path for LLM context */ private formatPathForLLM; /** * Analyze a learner's progress and recommend next steps */ analyzeProgressAndRecommend(request: ProgressAnalysisRequest): Promise; } /** * Request for learning path generation */ export interface LearningPathRequest { /** Natural language goal description */ goal: string; /** Current skill mastery states (skillId -> mastery 0-1) */ currentMastery?: Map; /** Maximum path length */ maxSteps?: number; /** Learning preferences */ preferences?: { style?: 'practical' | 'theoretical' | 'balanced'; difficulty?: 'gradual' | 'challenging'; }; /** Enhance path with LLM reasoning */ enhanceWithLLM?: boolean; } /** * Enhanced learning path result with LLM reasoning */ export interface LearningPathWithReasoning { /** Ordered list of skills with optional learning guidance */ path: Array; /** Edges connecting path skills */ edges: import('../types/edge.js').PrerequisiteEdge[]; /** Estimated total time (minutes) */ estimatedMinutes: number; /** Detailed reasoning for the path */ reasoning: string; /** Alternative paths */ alternatives?: Array<{ path: import('../types/skill.js').SkillNode[]; reasoning: string; }>; /** LLM-generated enhancements */ llmEnhancements?: { tips: string[]; potentialChallenges: string[]; alternativeApproaches?: Array<{ name: string; description: string; tradeoffs: string; }>; }; /** API usage */ usage?: import('../types/llm.js').CompletionResponse['usage']; /** Processing time in milliseconds */ durationMs: number; } /** * Progress analysis request */ export interface ProgressAnalysisRequest { /** Map of skill IDs to mastery levels (0-1) */ masteredSkills: Map; /** The learner's goal (optional) */ goal?: string; /** Generate LLM insights */ generateInsights?: boolean; /** Max recommendations to return */ maxRecommendations?: number; } /** * Skill recommendation */ export interface SkillRecommendation { /** The recommended skill */ skill: import('../types/skill.js').SkillNode; /** How ready the learner is (0-1) */ readiness: number; /** Why this skill is recommended */ reason: string; /** Priority score */ priority: number; } /** * LLM-generated progress insights */ export interface ProgressInsights { /** Summary of current progress */ progressSummary: string; /** Strengths identified */ strengths: string[]; /** Areas for improvement */ areasToImprove: string[]; /** Motivational message */ encouragement: string; /** Suggested focus areas */ focusAreas: string[]; } /** * Progress analysis result */ export interface ProgressAnalysisResult { /** Recommended skills */ recommendations: SkillRecommendation[]; /** LLM insights (if requested) */ insights?: ProgressInsights; /** Processing time */ durationMs: number; } /** * Create a GraphRAG-enhanced orchestrator */ export declare function createGraphRAGOrchestrator(adapter: LLMAdapter, storage?: GraphRAGStorage, options?: GraphRAGOrchestratorOptions): GraphRAGOrchestrator; //# sourceMappingURL=graphrag-orchestrator.d.ts.map