@hazeljs/rag 0.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +379 -0
  2. package/dist/agentic/agentic-rag.service.d.ts +49 -0
  3. package/dist/agentic/agentic-rag.service.d.ts.map +1 -0
  4. package/dist/agentic/agentic-rag.service.js +149 -0
  5. package/dist/agentic/agentic-rag.service.js.map +1 -0
  6. package/dist/agentic/decorators/active-learning.decorator.d.ts +19 -0
  7. package/dist/agentic/decorators/active-learning.decorator.d.ts.map +1 -0
  8. package/dist/agentic/decorators/active-learning.decorator.js +98 -0
  9. package/dist/agentic/decorators/active-learning.decorator.js.map +1 -0
  10. package/dist/agentic/decorators/adaptive-retrieval.decorator.d.ts +16 -0
  11. package/dist/agentic/decorators/adaptive-retrieval.decorator.d.ts.map +1 -0
  12. package/dist/agentic/decorators/adaptive-retrieval.decorator.js +114 -0
  13. package/dist/agentic/decorators/adaptive-retrieval.decorator.js.map +1 -0
  14. package/dist/agentic/decorators/cached.decorator.d.ts +18 -0
  15. package/dist/agentic/decorators/cached.decorator.d.ts.map +1 -0
  16. package/dist/agentic/decorators/cached.decorator.js +93 -0
  17. package/dist/agentic/decorators/cached.decorator.js.map +1 -0
  18. package/dist/agentic/decorators/context-aware.decorator.d.ts +16 -0
  19. package/dist/agentic/decorators/context-aware.decorator.d.ts.map +1 -0
  20. package/dist/agentic/decorators/context-aware.decorator.js +169 -0
  21. package/dist/agentic/decorators/context-aware.decorator.js.map +1 -0
  22. package/dist/agentic/decorators/corrective-rag.decorator.d.ts +15 -0
  23. package/dist/agentic/decorators/corrective-rag.decorator.d.ts.map +1 -0
  24. package/dist/agentic/decorators/corrective-rag.decorator.js +146 -0
  25. package/dist/agentic/decorators/corrective-rag.decorator.js.map +1 -0
  26. package/dist/agentic/decorators/hyde.decorator.d.ts +14 -0
  27. package/dist/agentic/decorators/hyde.decorator.d.ts.map +1 -0
  28. package/dist/agentic/decorators/hyde.decorator.js +90 -0
  29. package/dist/agentic/decorators/hyde.decorator.js.map +1 -0
  30. package/dist/agentic/decorators/index.d.ts +16 -0
  31. package/dist/agentic/decorators/index.d.ts.map +1 -0
  32. package/dist/agentic/decorators/index.js +32 -0
  33. package/dist/agentic/decorators/index.js.map +1 -0
  34. package/dist/agentic/decorators/multi-hop.decorator.d.ts +14 -0
  35. package/dist/agentic/decorators/multi-hop.decorator.d.ts.map +1 -0
  36. package/dist/agentic/decorators/multi-hop.decorator.js +120 -0
  37. package/dist/agentic/decorators/multi-hop.decorator.js.map +1 -0
  38. package/dist/agentic/decorators/query-planner.decorator.d.ts +19 -0
  39. package/dist/agentic/decorators/query-planner.decorator.d.ts.map +1 -0
  40. package/dist/agentic/decorators/query-planner.decorator.js +227 -0
  41. package/dist/agentic/decorators/query-planner.decorator.js.map +1 -0
  42. package/dist/agentic/decorators/query-rewriter.decorator.d.ts +15 -0
  43. package/dist/agentic/decorators/query-rewriter.decorator.d.ts.map +1 -0
  44. package/dist/agentic/decorators/query-rewriter.decorator.js +140 -0
  45. package/dist/agentic/decorators/query-rewriter.decorator.js.map +1 -0
  46. package/dist/agentic/decorators/self-reflective.decorator.d.ts +18 -0
  47. package/dist/agentic/decorators/self-reflective.decorator.d.ts.map +1 -0
  48. package/dist/agentic/decorators/self-reflective.decorator.js +210 -0
  49. package/dist/agentic/decorators/self-reflective.decorator.js.map +1 -0
  50. package/dist/agentic/decorators/source-verification.decorator.d.ts +15 -0
  51. package/dist/agentic/decorators/source-verification.decorator.d.ts.map +1 -0
  52. package/dist/agentic/decorators/source-verification.decorator.js +121 -0
  53. package/dist/agentic/decorators/source-verification.decorator.js.map +1 -0
  54. package/dist/agentic/index.d.ts +9 -0
  55. package/dist/agentic/index.d.ts.map +1 -0
  56. package/dist/agentic/index.js +25 -0
  57. package/dist/agentic/index.js.map +1 -0
  58. package/dist/agentic/types.d.ts +209 -0
  59. package/dist/agentic/types.d.ts.map +1 -0
  60. package/dist/agentic/types.js +7 -0
  61. package/dist/agentic/types.js.map +1 -0
  62. package/dist/decorators/embeddable.decorator.d.ts +31 -0
  63. package/dist/decorators/embeddable.decorator.d.ts.map +1 -0
  64. package/dist/decorators/embeddable.decorator.js +44 -0
  65. package/dist/decorators/embeddable.decorator.js.map +1 -0
  66. package/dist/decorators/rag.decorator.d.ts +58 -0
  67. package/dist/decorators/rag.decorator.d.ts.map +1 -0
  68. package/dist/decorators/rag.decorator.js +78 -0
  69. package/dist/decorators/rag.decorator.js.map +1 -0
  70. package/dist/decorators/semantic-search.decorator.d.ts +69 -0
  71. package/dist/decorators/semantic-search.decorator.d.ts.map +1 -0
  72. package/dist/decorators/semantic-search.decorator.js +116 -0
  73. package/dist/decorators/semantic-search.decorator.js.map +1 -0
  74. package/dist/embeddings/cohere-embeddings.d.ts +33 -0
  75. package/dist/embeddings/cohere-embeddings.d.ts.map +1 -0
  76. package/dist/embeddings/cohere-embeddings.js +91 -0
  77. package/dist/embeddings/cohere-embeddings.js.map +1 -0
  78. package/dist/embeddings/openai-embeddings.d.ts +21 -0
  79. package/dist/embeddings/openai-embeddings.d.ts.map +1 -0
  80. package/dist/embeddings/openai-embeddings.js +53 -0
  81. package/dist/embeddings/openai-embeddings.js.map +1 -0
  82. package/dist/index.d.ts +27 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +54 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/memory/index.d.ts +11 -0
  87. package/dist/memory/index.d.ts.map +1 -0
  88. package/dist/memory/index.js +31 -0
  89. package/dist/memory/index.js.map +1 -0
  90. package/dist/memory/memory-manager.d.ts +96 -0
  91. package/dist/memory/memory-manager.d.ts.map +1 -0
  92. package/dist/memory/memory-manager.js +369 -0
  93. package/dist/memory/memory-manager.js.map +1 -0
  94. package/dist/memory/memory-store.interface.d.ts +73 -0
  95. package/dist/memory/memory-store.interface.d.ts.map +1 -0
  96. package/dist/memory/memory-store.interface.js +6 -0
  97. package/dist/memory/memory-store.interface.js.map +1 -0
  98. package/dist/memory/stores/buffer-memory.d.ts +47 -0
  99. package/dist/memory/stores/buffer-memory.d.ts.map +1 -0
  100. package/dist/memory/stores/buffer-memory.js +280 -0
  101. package/dist/memory/stores/buffer-memory.js.map +1 -0
  102. package/dist/memory/stores/hybrid-memory.d.ts +49 -0
  103. package/dist/memory/stores/hybrid-memory.d.ts.map +1 -0
  104. package/dist/memory/stores/hybrid-memory.js +194 -0
  105. package/dist/memory/stores/hybrid-memory.js.map +1 -0
  106. package/dist/memory/stores/vector-memory.d.ts +48 -0
  107. package/dist/memory/stores/vector-memory.d.ts.map +1 -0
  108. package/dist/memory/stores/vector-memory.js +312 -0
  109. package/dist/memory/stores/vector-memory.js.map +1 -0
  110. package/dist/memory/types.d.ts +119 -0
  111. package/dist/memory/types.d.ts.map +1 -0
  112. package/dist/memory/types.js +18 -0
  113. package/dist/memory/types.js.map +1 -0
  114. package/dist/rag-pipeline-with-memory.d.ts +68 -0
  115. package/dist/rag-pipeline-with-memory.d.ts.map +1 -0
  116. package/dist/rag-pipeline-with-memory.js +186 -0
  117. package/dist/rag-pipeline-with-memory.js.map +1 -0
  118. package/dist/rag-pipeline.d.ts +59 -0
  119. package/dist/rag-pipeline.d.ts.map +1 -0
  120. package/dist/rag-pipeline.js +181 -0
  121. package/dist/rag-pipeline.js.map +1 -0
  122. package/dist/rag.module.d.ts +26 -0
  123. package/dist/rag.module.d.ts.map +1 -0
  124. package/dist/rag.module.js +40 -0
  125. package/dist/rag.module.js.map +1 -0
  126. package/dist/rag.service.d.ts +95 -0
  127. package/dist/rag.service.d.ts.map +1 -0
  128. package/dist/rag.service.js +174 -0
  129. package/dist/rag.service.js.map +1 -0
  130. package/dist/retrieval/bm25.d.ts +57 -0
  131. package/dist/retrieval/bm25.d.ts.map +1 -0
  132. package/dist/retrieval/bm25.js +106 -0
  133. package/dist/retrieval/bm25.js.map +1 -0
  134. package/dist/retrieval/hybrid-search.d.ts +48 -0
  135. package/dist/retrieval/hybrid-search.d.ts.map +1 -0
  136. package/dist/retrieval/hybrid-search.js +123 -0
  137. package/dist/retrieval/hybrid-search.js.map +1 -0
  138. package/dist/retrieval/multi-query.d.ts +38 -0
  139. package/dist/retrieval/multi-query.d.ts.map +1 -0
  140. package/dist/retrieval/multi-query.js +135 -0
  141. package/dist/retrieval/multi-query.js.map +1 -0
  142. package/dist/text-splitters/recursive-text-splitter.d.ts +21 -0
  143. package/dist/text-splitters/recursive-text-splitter.d.ts.map +1 -0
  144. package/dist/text-splitters/recursive-text-splitter.js +95 -0
  145. package/dist/text-splitters/recursive-text-splitter.js.map +1 -0
  146. package/dist/types/index.d.ts +144 -0
  147. package/dist/types/index.d.ts.map +1 -0
  148. package/dist/types/index.js +16 -0
  149. package/dist/types/index.js.map +1 -0
  150. package/dist/utils/similarity.d.ts +16 -0
  151. package/dist/utils/similarity.d.ts.map +1 -0
  152. package/dist/utils/similarity.js +58 -0
  153. package/dist/utils/similarity.js.map +1 -0
  154. package/dist/vector-stores/chroma.store.d.ts +42 -0
  155. package/dist/vector-stores/chroma.store.d.ts.map +1 -0
  156. package/dist/vector-stores/chroma.store.js +242 -0
  157. package/dist/vector-stores/chroma.store.js.map +1 -0
  158. package/dist/vector-stores/memory-vector-store.d.ts +20 -0
  159. package/dist/vector-stores/memory-vector-store.d.ts.map +1 -0
  160. package/dist/vector-stores/memory-vector-store.js +94 -0
  161. package/dist/vector-stores/memory-vector-store.js.map +1 -0
  162. package/dist/vector-stores/pinecone.store.d.ts +34 -0
  163. package/dist/vector-stores/pinecone.store.d.ts.map +1 -0
  164. package/dist/vector-stores/pinecone.store.js +146 -0
  165. package/dist/vector-stores/pinecone.store.js.map +1 -0
  166. package/dist/vector-stores/qdrant.store.d.ts +31 -0
  167. package/dist/vector-stores/qdrant.store.d.ts.map +1 -0
  168. package/dist/vector-stores/qdrant.store.js +173 -0
  169. package/dist/vector-stores/qdrant.store.js.map +1 -0
  170. package/dist/vector-stores/weaviate.store.d.ts +37 -0
  171. package/dist/vector-stores/weaviate.store.d.ts.map +1 -0
  172. package/dist/vector-stores/weaviate.store.js +226 -0
  173. package/dist/vector-stores/weaviate.store.js.map +1 -0
  174. package/package.json +87 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-verification.decorator.d.ts","sourceRoot":"","sources":["../../../src/agentic/decorators/source-verification.decorator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAgD,MAAM,UAAU,CAAC;AAE1F,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAID,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,wBAA6B,GAAG,eAAe,CAoCzF;AAuGD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,gBAAgB,GAAG,SAAS,CAE9B"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /**
3
+ * Source Verification Decorator
4
+ * Verifies source quality and generates citations
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SourceVerification = SourceVerification;
8
+ exports.getVerifiedResponse = getVerifiedResponse;
9
+ require("reflect-metadata");
10
+ const VERIFICATION_METADATA_KEY = Symbol('sourceVerification');
11
+ function SourceVerification(config = {}) {
12
+ return function (target, propertyKey, descriptor) {
13
+ const originalMethod = descriptor.value;
14
+ descriptor.value = async function (...args) {
15
+ const results = await originalMethod.apply(this, args);
16
+ if (!Array.isArray(results)) {
17
+ return results;
18
+ }
19
+ // Verify each source
20
+ const verifiedSources = await Promise.all(results.map((result) => verifySource(result, config)));
21
+ // Generate citations
22
+ const citations = config.requireCitations ? generateCitations(verifiedSources) : [];
23
+ // Calculate overall confidence
24
+ const overallConfidence = calculateOverallConfidence(verifiedSources);
25
+ const verifiedResponse = {
26
+ answer: '', // Would be filled by calling code
27
+ sources: verifiedSources,
28
+ overallConfidence,
29
+ citations,
30
+ };
31
+ Reflect.defineMetadata(VERIFICATION_METADATA_KEY, verifiedResponse, target, propertyKey);
32
+ return verifiedSources;
33
+ };
34
+ return descriptor;
35
+ };
36
+ }
37
+ async function verifySource(
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+ source, config) {
40
+ const verification = {
41
+ authorityScore: 0.7,
42
+ freshnessScore: 0.7,
43
+ relevanceScore: source.score || 0.5,
44
+ verified: true,
45
+ issues: [],
46
+ };
47
+ // Check freshness
48
+ if (config.checkFreshness && source.metadata?.timestamp) {
49
+ const freshnessScore = calculateFreshnessScore(source.metadata.timestamp, config.freshnessThresholdDays || 365);
50
+ verification.freshnessScore = freshnessScore;
51
+ if (freshnessScore < 0.5) {
52
+ verification.issues.push('Content may be outdated');
53
+ }
54
+ }
55
+ // Check authority
56
+ if (config.verifyAuthority && source.metadata?.source) {
57
+ const authorityScore = calculateAuthorityScore(source.metadata.source);
58
+ verification.authorityScore = authorityScore;
59
+ if (authorityScore < 0.5) {
60
+ verification.issues.push('Source authority uncertain');
61
+ }
62
+ }
63
+ // Overall verification
64
+ const avgScore = (verification.authorityScore + verification.freshnessScore + verification.relevanceScore) / 3;
65
+ verification.verified = avgScore >= 0.6 && verification.issues.length === 0;
66
+ return {
67
+ ...source,
68
+ verification,
69
+ };
70
+ }
71
+ function calculateFreshnessScore(timestamp, thresholdDays) {
72
+ const date = typeof timestamp === 'string' ? new Date(timestamp) : timestamp;
73
+ const now = new Date();
74
+ const ageInDays = (now.getTime() - date.getTime()) / (1000 * 60 * 60 * 24);
75
+ if (ageInDays <= 30)
76
+ return 1.0;
77
+ if (ageInDays <= 90)
78
+ return 0.9;
79
+ if (ageInDays <= 180)
80
+ return 0.8;
81
+ if (ageInDays <= 365)
82
+ return 0.7;
83
+ if (ageInDays <= thresholdDays)
84
+ return 0.5;
85
+ return 0.3;
86
+ }
87
+ function calculateAuthorityScore(source) {
88
+ const lowerSource = source.toLowerCase();
89
+ // High authority domains
90
+ const highAuthority = ['.edu', '.gov', '.org', 'wikipedia', 'scholar'];
91
+ if (highAuthority.some((domain) => lowerSource.includes(domain))) {
92
+ return 0.9;
93
+ }
94
+ // Medium authority
95
+ const mediumAuthority = ['.com', 'blog', 'medium'];
96
+ if (mediumAuthority.some((domain) => lowerSource.includes(domain))) {
97
+ return 0.7;
98
+ }
99
+ return 0.5;
100
+ }
101
+ function generateCitations(sources) {
102
+ return sources
103
+ .filter((s) => s.verification.verified)
104
+ .map((source, index) => ({
105
+ text: source.content.slice(0, 100) + '...',
106
+ sourceId: source.id,
107
+ position: index + 1,
108
+ confidence: source.verification.relevanceScore,
109
+ }));
110
+ }
111
+ function calculateOverallConfidence(sources) {
112
+ if (sources.length === 0)
113
+ return 0;
114
+ const verifiedCount = sources.filter((s) => s.verification.verified).length;
115
+ const avgRelevance = sources.reduce((sum, s) => sum + s.verification.relevanceScore, 0) / sources.length;
116
+ return (verifiedCount / sources.length) * avgRelevance;
117
+ }
118
+ function getVerifiedResponse(target, propertyKey) {
119
+ return Reflect.getMetadata(VERIFICATION_METADATA_KEY, target, propertyKey);
120
+ }
121
+ //# sourceMappingURL=source-verification.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-verification.decorator.js","sourceRoot":"","sources":["../../../src/agentic/decorators/source-verification.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAcH,gDAoCC;AAuGD,kDAKC;AA5JD,4BAA0B;AAU1B,MAAM,yBAAyB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAE/D,SAAgB,kBAAkB,CAAC,SAAmC,EAAE;IACtE,OAAO,UAAU,MAAc,EAAE,WAA4B,EAAE,UAA8B;QAC3F,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,K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EAAE,EAAE,CAAC,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK;QAC1C,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,QAAQ,EAAE,KAAK,GAAG,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc;KAC/C,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,0BAA0B,CAAC,OAAyB;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEnC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IAC5E,MAAM,YAAY,GAChB,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAEtF,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;AACzD,CAAC;AAED,SAAgB,mBAAmB,CACjC,MAAc,EACd,WAA4B;IAE5B,OAAO,OAAO,CAAC,WAAW,CAAC,yBAAyB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Agentic RAG - Advanced Retrieval-Augmented Generation
3
+ * Export all agentic RAG functionality
4
+ */
5
+ export type { QueryPlan, SubQuery, ReasoningChain, ReasoningHop, ReflectionResult, QualityAssessment, VerifiedResponse, VerifiedSource, Citation, Context, FeedbackData, GraphSearchResult, GraphNode, GraphEdge, AdaptiveStrategyResult, HyDEResult, CorrectiveRAGResult, Correction, AgenticLLMProvider, LLMOptions, CacheEntry, AgenticRAGConfig, } from './types';
6
+ export type { Entity as AgenticEntity, Message as AgenticMessage } from './types';
7
+ export * from './decorators';
8
+ export * from './agentic-rag.service';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agentic/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,MAAM,IAAI,aAAa,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAGlF,cAAc,cAAc,CAAC;AAG7B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Agentic RAG - Advanced Retrieval-Augmented Generation
4
+ * Export all agentic RAG functionality
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ // Decorators
22
+ __exportStar(require("./decorators"), exports);
23
+ // Service
24
+ __exportStar(require("./agentic-rag.service"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agentic/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AA+BH,aAAa;AACb,+CAA6B;AAE7B,UAAU;AACV,wDAAsC"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Agentic RAG Types
3
+ * Core types and interfaces for agentic RAG capabilities
4
+ */
5
+ import { SearchResult } from '../types';
6
+ /**
7
+ * Query Plan - Decomposed query structure
8
+ */
9
+ export interface QueryPlan {
10
+ originalQuery: string;
11
+ subQueries: SubQuery[];
12
+ strategy: 'sequential' | 'parallel' | 'adaptive';
13
+ estimatedComplexity: number;
14
+ }
15
+ export interface SubQuery {
16
+ id: string;
17
+ query: string;
18
+ type: 'factual' | 'analytical' | 'comparative' | 'temporal';
19
+ dependencies: string[];
20
+ priority: number;
21
+ }
22
+ /**
23
+ * Reasoning Chain - Multi-hop reasoning result
24
+ */
25
+ export interface ReasoningChain {
26
+ query: string;
27
+ hops: ReasoningHop[];
28
+ finalAnswer: string;
29
+ confidence: number;
30
+ sources: SearchResult[];
31
+ }
32
+ export interface ReasoningHop {
33
+ hopNumber: number;
34
+ query: string;
35
+ results: SearchResult[];
36
+ reasoning: string;
37
+ nextQuery?: string;
38
+ }
39
+ /**
40
+ * Reflection Result - Self-reflection output
41
+ */
42
+ export interface ReflectionResult {
43
+ originalResponse: string;
44
+ quality: QualityAssessment;
45
+ improvements: string[];
46
+ revisedResponse?: string;
47
+ iterations: number;
48
+ }
49
+ export interface QualityAssessment {
50
+ score: number;
51
+ relevance: number;
52
+ completeness: number;
53
+ accuracy: number;
54
+ clarity: number;
55
+ issues: string[];
56
+ }
57
+ /**
58
+ * Verified Response - Response with source verification
59
+ */
60
+ export interface VerifiedResponse {
61
+ answer: string;
62
+ sources: VerifiedSource[];
63
+ overallConfidence: number;
64
+ citations: Citation[];
65
+ }
66
+ export interface VerifiedSource extends SearchResult {
67
+ verification: SourceVerification;
68
+ }
69
+ export interface SourceVerification {
70
+ authorityScore: number;
71
+ freshnessScore: number;
72
+ relevanceScore: number;
73
+ verified: boolean;
74
+ issues: string[];
75
+ }
76
+ export interface Citation {
77
+ text: string;
78
+ sourceId: string;
79
+ position: number;
80
+ confidence: number;
81
+ }
82
+ /**
83
+ * Context - Conversation and session context
84
+ */
85
+ export interface Context {
86
+ sessionId: string;
87
+ userId?: string;
88
+ conversationHistory: Message[];
89
+ entities: Entity[];
90
+ topics: Topic[];
91
+ metadata: Record<string, unknown>;
92
+ }
93
+ export interface Message {
94
+ role: 'user' | 'assistant' | 'system';
95
+ content: string;
96
+ timestamp: Date;
97
+ }
98
+ export interface Entity {
99
+ name: string;
100
+ type: string;
101
+ mentions: number;
102
+ lastSeen: Date;
103
+ attributes: Record<string, unknown>;
104
+ }
105
+ export interface Topic {
106
+ name: string;
107
+ relevance: number;
108
+ keywords: string[];
109
+ }
110
+ /**
111
+ * Feedback Data - User feedback for active learning
112
+ */
113
+ export interface FeedbackData {
114
+ resultId: string;
115
+ rating: number;
116
+ relevant: boolean;
117
+ comments?: string;
118
+ timestamp: Date;
119
+ userId?: string;
120
+ }
121
+ /**
122
+ * Graph Search Result - Knowledge graph retrieval result
123
+ */
124
+ export interface GraphSearchResult extends SearchResult {
125
+ nodes: GraphNode[];
126
+ edges: GraphEdge[];
127
+ path: string[];
128
+ }
129
+ export interface GraphNode {
130
+ id: string;
131
+ label: string;
132
+ type: string;
133
+ properties: Record<string, unknown>;
134
+ }
135
+ export interface GraphEdge {
136
+ source: string;
137
+ target: string;
138
+ type: string;
139
+ properties: Record<string, unknown>;
140
+ }
141
+ /**
142
+ * Adaptive Strategy Result
143
+ */
144
+ export interface AdaptiveStrategyResult {
145
+ selectedStrategy: string;
146
+ reason: string;
147
+ confidence: number;
148
+ alternatives: Array<{
149
+ strategy: string;
150
+ score: number;
151
+ }>;
152
+ }
153
+ /**
154
+ * HyDE Result - Hypothetical Document Embeddings
155
+ */
156
+ export interface HyDEResult {
157
+ hypotheticalDocuments: string[];
158
+ retrievedResults: SearchResult[];
159
+ aggregatedScore: number;
160
+ }
161
+ /**
162
+ * Corrective RAG Result
163
+ */
164
+ export interface CorrectiveRAGResult {
165
+ results: SearchResult[];
166
+ corrections: Correction[];
167
+ fallbackUsed: boolean;
168
+ confidence: number;
169
+ }
170
+ export interface Correction {
171
+ type: 'low_relevance' | 'missing_info' | 'contradictory';
172
+ description: string;
173
+ action: string;
174
+ }
175
+ /**
176
+ * LLM Provider Interface for Agentic RAG
177
+ */
178
+ export interface AgenticLLMProvider {
179
+ generate(prompt: string, options?: LLMOptions): Promise<string>;
180
+ generateStructured<T>(prompt: string, schema: unknown): Promise<T>;
181
+ embed(text: string): Promise<number[]>;
182
+ }
183
+ export interface LLMOptions {
184
+ temperature?: number;
185
+ maxTokens?: number;
186
+ stopSequences?: string[];
187
+ }
188
+ /**
189
+ * Cache Entry
190
+ */
191
+ export interface CacheEntry<T> {
192
+ key: string;
193
+ value: T;
194
+ timestamp: number;
195
+ ttl: number;
196
+ hits: number;
197
+ }
198
+ /**
199
+ * Agentic RAG Configuration
200
+ */
201
+ export interface AgenticRAGConfig {
202
+ name: string;
203
+ description?: string;
204
+ llmProvider?: AgenticLLMProvider;
205
+ enableCaching?: boolean;
206
+ enableMetrics?: boolean;
207
+ maxRetries?: number;
208
+ }
209
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agentic/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,QAAQ,EAAE,YA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Agentic RAG Types
4
+ * Core types and interfaces for agentic RAG capabilities
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agentic/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @Embeddable Decorator
3
+ * Automatically generates embeddings for entity fields
4
+ */
5
+ import 'reflect-metadata';
6
+ type NewableFunction = new (...args: unknown[]) => unknown;
7
+ export interface EmbeddableOptions {
8
+ fields: string[];
9
+ strategy?: 'concat' | 'weighted' | 'separate';
10
+ model?: string;
11
+ separator?: string;
12
+ weights?: Record<string, number>;
13
+ }
14
+ /**
15
+ * Marks an entity as embeddable with automatic embedding generation
16
+ */
17
+ export declare function Embeddable(options: EmbeddableOptions): ClassDecorator;
18
+ /**
19
+ * Get embeddable metadata from a class
20
+ */
21
+ export declare function getEmbeddableMetadata(target: NewableFunction): EmbeddableOptions | undefined;
22
+ /**
23
+ * Marks a property as a vector column for storing embeddings
24
+ */
25
+ export declare function VectorColumn(): PropertyDecorator;
26
+ /**
27
+ * Get vector column metadata
28
+ */
29
+ export declare function getVectorColumns(target: NewableFunction): string[];
30
+ export {};
31
+ //# sourceMappingURL=embeddable.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddable.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/embeddable.decorator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,KAAK,eAAe,GAAG,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAID;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAKrE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,GAAG,SAAS,CAE5F;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,iBAAiB,CAMhD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE,CAElE"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * @Embeddable Decorator
4
+ * Automatically generates embeddings for entity fields
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Embeddable = Embeddable;
8
+ exports.getEmbeddableMetadata = getEmbeddableMetadata;
9
+ exports.VectorColumn = VectorColumn;
10
+ exports.getVectorColumns = getVectorColumns;
11
+ require("reflect-metadata");
12
+ const EMBEDDABLE_METADATA_KEY = Symbol('embeddable');
13
+ /**
14
+ * Marks an entity as embeddable with automatic embedding generation
15
+ */
16
+ function Embeddable(options) {
17
+ return ((target) => {
18
+ Reflect.defineMetadata(EMBEDDABLE_METADATA_KEY, options, target);
19
+ return target;
20
+ });
21
+ }
22
+ /**
23
+ * Get embeddable metadata from a class
24
+ */
25
+ function getEmbeddableMetadata(target) {
26
+ return Reflect.getMetadata(EMBEDDABLE_METADATA_KEY, target);
27
+ }
28
+ /**
29
+ * Marks a property as a vector column for storing embeddings
30
+ */
31
+ function VectorColumn() {
32
+ return (target, propertyKey) => {
33
+ const vectorColumns = Reflect.getMetadata('vectorColumns', target.constructor) || [];
34
+ vectorColumns.push(propertyKey);
35
+ Reflect.defineMetadata('vectorColumns', vectorColumns, target.constructor);
36
+ };
37
+ }
38
+ /**
39
+ * Get vector column metadata
40
+ */
41
+ function getVectorColumns(target) {
42
+ return Reflect.getMetadata('vectorColumns', target) || [];
43
+ }
44
+ //# sourceMappingURL=embeddable.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddable.decorator.js","sourceRoot":"","sources":["../../src/decorators/embeddable.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAmBH,gCAKC;AAKD,sDAEC;AAKD,oCAMC;AAKD,4CAEC;AA/CD,4BAA0B;AAY1B,MAAM,uBAAuB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAErD;;GAEG;AACH,SAAgB,UAAU,CAAC,OAA0B;IACnD,OAAO,CAAC,CAAC,MAAuB,EAAE,EAAE;QAClC,OAAO,CAAC,cAAc,CAAC,uBAAuB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACjE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAmB,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,MAAuB;IAC3D,OAAO,OAAO,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACtD,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACrF,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChC,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAAuB;IACtD,OAAO,OAAO,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @RAG Module Decorator
3
+ * Configure RAG at module level
4
+ */
5
+ import 'reflect-metadata';
6
+ type NewableFunction = new (...args: unknown[]) => unknown;
7
+ export interface RAGModuleOptions {
8
+ vectorDB?: 'pinecone' | 'weaviate' | 'qdrant' | 'chroma' | 'milvus' | 'pgvector' | 'redis' | 'memory';
9
+ embeddingModel?: string;
10
+ chunkSize?: number;
11
+ chunkOverlap?: number;
12
+ indexName?: string;
13
+ apiKey?: string;
14
+ endpoint?: string;
15
+ namespace?: string;
16
+ }
17
+ export interface ConversationalRAGOptions {
18
+ memoryType?: 'buffer' | 'summary' | 'window';
19
+ maxTokens?: number;
20
+ sessionStore?: 'memory' | 'redis' | 'database';
21
+ }
22
+ export interface MultiModalEmbeddingOptions {
23
+ models?: {
24
+ text?: string;
25
+ image?: string;
26
+ code?: string;
27
+ };
28
+ }
29
+ /**
30
+ * Configure RAG for a module
31
+ */
32
+ export declare function RAG(options: RAGModuleOptions): ClassDecorator;
33
+ /**
34
+ * Get RAG module configuration
35
+ */
36
+ export declare function getRAGConfig(target: NewableFunction): RAGModuleOptions | undefined;
37
+ /**
38
+ * Configure conversational RAG with memory
39
+ */
40
+ export declare function ConversationalRAG(options: ConversationalRAGOptions): ClassDecorator;
41
+ /**
42
+ * Configure multi-modal embeddings
43
+ */
44
+ export declare function MultiModalEmbedding(options: MultiModalEmbeddingOptions): ClassDecorator;
45
+ /**
46
+ * Embed image decorator
47
+ */
48
+ export declare function EmbedImage(): MethodDecorator;
49
+ /**
50
+ * Embed code decorator
51
+ */
52
+ export declare function EmbedCode(): MethodDecorator;
53
+ /**
54
+ * Cross-modal search decorator
55
+ */
56
+ export declare function CrossModalSearch(): MethodDecorator;
57
+ export {};
58
+ //# sourceMappingURL=rag.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/rag.decorator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,KAAK,eAAe,GAAG,KAAK,GAAG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3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAKlD"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * @RAG Module Decorator
4
+ * Configure RAG at module level
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RAG = RAG;
8
+ exports.getRAGConfig = getRAGConfig;
9
+ exports.ConversationalRAG = ConversationalRAG;
10
+ exports.MultiModalEmbedding = MultiModalEmbedding;
11
+ exports.EmbedImage = EmbedImage;
12
+ exports.EmbedCode = EmbedCode;
13
+ exports.CrossModalSearch = CrossModalSearch;
14
+ require("reflect-metadata");
15
+ const RAG_MODULE_KEY = Symbol('ragModule');
16
+ const CONVERSATIONAL_RAG_KEY = Symbol('conversationalRAG');
17
+ const MULTIMODAL_EMBEDDING_KEY = Symbol('multiModalEmbedding');
18
+ /**
19
+ * Configure RAG for a module
20
+ */
21
+ function RAG(options) {
22
+ return ((target) => {
23
+ Reflect.defineMetadata(RAG_MODULE_KEY, options, target);
24
+ return target;
25
+ });
26
+ }
27
+ /**
28
+ * Get RAG module configuration
29
+ */
30
+ function getRAGConfig(target) {
31
+ return Reflect.getMetadata(RAG_MODULE_KEY, target);
32
+ }
33
+ /**
34
+ * Configure conversational RAG with memory
35
+ */
36
+ function ConversationalRAG(options) {
37
+ return ((target) => {
38
+ Reflect.defineMetadata(CONVERSATIONAL_RAG_KEY, options, target);
39
+ return target;
40
+ });
41
+ }
42
+ /**
43
+ * Configure multi-modal embeddings
44
+ */
45
+ function MultiModalEmbedding(options) {
46
+ return ((target) => {
47
+ Reflect.defineMetadata(MULTIMODAL_EMBEDDING_KEY, options, target);
48
+ return target;
49
+ });
50
+ }
51
+ /**
52
+ * Embed image decorator
53
+ */
54
+ function EmbedImage() {
55
+ return (target, propertyKey, descriptor) => {
56
+ Reflect.defineMetadata('embedImage', true, target, propertyKey);
57
+ return descriptor;
58
+ };
59
+ }
60
+ /**
61
+ * Embed code decorator
62
+ */
63
+ function EmbedCode() {
64
+ return (target, propertyKey, descriptor) => {
65
+ Reflect.defineMetadata('embedCode', true, target, propertyKey);
66
+ return descriptor;
67
+ };
68
+ }
69
+ /**
70
+ * Cross-modal search decorator
71
+ */
72
+ function CrossModalSearch() {
73
+ return (target, propertyKey, descriptor) => {
74
+ Reflect.defineMetadata('crossModalSearch', true, target, propertyKey);
75
+ return descriptor;
76
+ };
77
+ }
78
+ //# sourceMappingURL=rag.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag.decorator.js","sourceRoot":"","sources":["../../src/decorators/rag.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8CH,kBAKC;AAKD,oCAEC;AAKD,8CAKC;AAKD,kDAKC;AAKD,gCAKC;AAKD,8BAKC;AAKD,4CAKC;AA1GD,4BAA0B;AAqC1B,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAC3C,MAAM,sBAAsB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC3D,MAAM,wBAAwB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAE/D;;GAEG;AACH,SAAgB,GAAG,CAAC,OAAyB;IAC3C,OAAO,CAAC,CAAC,MAAuB,EAAE,EAAE;QAClC,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAmB,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAuB;IAClD,OAAO,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAiC;IACjE,OAAO,CAAC,CAAC,MAAuB,EAAE,EAAE;QAClC,OAAO,CAAC,cAAc,CAAC,sBAAsB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAChE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAmB,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