@wanshi-kg/wanshi 0.1.0

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 (443) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +458 -0
  3. package/dist/__tests__/helpers.js +27 -0
  4. package/dist/__tests__/helpers.js.map +1 -0
  5. package/dist/cli/commands/export.command.js +99 -0
  6. package/dist/cli/commands/export.command.js.map +1 -0
  7. package/dist/cli/commands/index.js +22 -0
  8. package/dist/cli/commands/index.js.map +1 -0
  9. package/dist/cli/commands/inspectMerges.command.js +84 -0
  10. package/dist/cli/commands/inspectMerges.command.js.map +1 -0
  11. package/dist/cli/commands/metrics.command.js +196 -0
  12. package/dist/cli/commands/metrics.command.js.map +1 -0
  13. package/dist/cli/commands/process.command.js +82 -0
  14. package/dist/cli/commands/process.command.js.map +1 -0
  15. package/dist/cli/commands/watch.command.js +91 -0
  16. package/dist/cli/commands/watch.command.js.map +1 -0
  17. package/dist/cli/index.js +269 -0
  18. package/dist/cli/index.js.map +1 -0
  19. package/dist/cli/optionsToConfig.js +160 -0
  20. package/dist/cli/optionsToConfig.js.map +1 -0
  21. package/dist/config/index.js +59 -0
  22. package/dist/config/index.js.map +1 -0
  23. package/dist/config/legacyHints.js +113 -0
  24. package/dist/config/legacyHints.js.map +1 -0
  25. package/dist/config/schema.js +803 -0
  26. package/dist/config/schema.js.map +1 -0
  27. package/dist/config/ui.js +221 -0
  28. package/dist/config/ui.js.map +1 -0
  29. package/dist/core/DirectoryProcessor.js +725 -0
  30. package/dist/core/DirectoryProcessor.js.map +1 -0
  31. package/dist/core/adapters/IStructuredAdapter.js +3 -0
  32. package/dist/core/adapters/IStructuredAdapter.js.map +1 -0
  33. package/dist/core/adapters/SqliteAdapter.js +267 -0
  34. package/dist/core/adapters/SqliteAdapter.js.map +1 -0
  35. package/dist/core/adapters/StructuredAdapterRegistry.js +31 -0
  36. package/dist/core/adapters/StructuredAdapterRegistry.js.map +1 -0
  37. package/dist/core/adapters/index.js +20 -0
  38. package/dist/core/adapters/index.js.map +1 -0
  39. package/dist/core/checkpoint/CheckpointService.js +188 -0
  40. package/dist/core/checkpoint/CheckpointService.js.map +1 -0
  41. package/dist/core/checkpoint/index.js +18 -0
  42. package/dist/core/checkpoint/index.js.map +1 -0
  43. package/dist/core/corpus/CorpusAnalyzer.js +266 -0
  44. package/dist/core/corpus/CorpusAnalyzer.js.map +1 -0
  45. package/dist/core/corpus/CorpusProfileStore.js +92 -0
  46. package/dist/core/corpus/CorpusProfileStore.js.map +1 -0
  47. package/dist/core/corpus/index.js +21 -0
  48. package/dist/core/corpus/index.js.map +1 -0
  49. package/dist/core/corpus/normalizeGlossary.js +60 -0
  50. package/dist/core/corpus/normalizeGlossary.js.map +1 -0
  51. package/dist/core/corpus/relPath.js +52 -0
  52. package/dist/core/corpus/relPath.js.map +1 -0
  53. package/dist/core/corpus/termFrequency.js +86 -0
  54. package/dist/core/corpus/termFrequency.js.map +1 -0
  55. package/dist/core/cost/CostMeter.js +235 -0
  56. package/dist/core/cost/CostMeter.js.map +1 -0
  57. package/dist/core/cost/index.js +19 -0
  58. package/dist/core/cost/index.js.map +1 -0
  59. package/dist/core/cost/prices.js +38 -0
  60. package/dist/core/cost/prices.js.map +1 -0
  61. package/dist/core/cv/ObjectDetectionService.js +119 -0
  62. package/dist/core/cv/ObjectDetectionService.js.map +1 -0
  63. package/dist/core/di/ContainerFactory.js +670 -0
  64. package/dist/core/di/ContainerFactory.js.map +1 -0
  65. package/dist/core/di/DIContainer.js +103 -0
  66. package/dist/core/di/DIContainer.js.map +1 -0
  67. package/dist/core/di/index.js +19 -0
  68. package/dist/core/di/index.js.map +1 -0
  69. package/dist/core/errors/CustomErrors.js +342 -0
  70. package/dist/core/errors/CustomErrors.js.map +1 -0
  71. package/dist/core/errors/index.js +18 -0
  72. package/dist/core/errors/index.js.map +1 -0
  73. package/dist/core/export/KnowledgeGraphExportService.js +56 -0
  74. package/dist/core/export/KnowledgeGraphExportService.js.map +1 -0
  75. package/dist/core/export/index.js +19 -0
  76. package/dist/core/export/index.js.map +1 -0
  77. package/dist/core/export/strategies/GraphitiExportStrategy.js +115 -0
  78. package/dist/core/export/strategies/GraphitiExportStrategy.js.map +1 -0
  79. package/dist/core/export/strategies/GraphvizDotExportStrategy.js +331 -0
  80. package/dist/core/export/strategies/GraphvizDotExportStrategy.js.map +1 -0
  81. package/dist/core/export/strategies/IExportStrategy.js +3 -0
  82. package/dist/core/export/strategies/IExportStrategy.js.map +1 -0
  83. package/dist/core/export/strategies/JsonExportStrategy.js +19 -0
  84. package/dist/core/export/strategies/JsonExportStrategy.js.map +1 -0
  85. package/dist/core/export/strategies/JsonlExportStrategy.js +69 -0
  86. package/dist/core/export/strategies/JsonlExportStrategy.js.map +1 -0
  87. package/dist/core/export/strategies/KblamExportStrategy.js +36 -0
  88. package/dist/core/export/strategies/KblamExportStrategy.js.map +1 -0
  89. package/dist/core/export/strategies/LoraExportStrategy.js +46 -0
  90. package/dist/core/export/strategies/LoraExportStrategy.js.map +1 -0
  91. package/dist/core/export/strategies/McpExportStrategy.js +67 -0
  92. package/dist/core/export/strategies/McpExportStrategy.js.map +1 -0
  93. package/dist/core/export/strategies/index.js +25 -0
  94. package/dist/core/export/strategies/index.js.map +1 -0
  95. package/dist/core/export/strategies/kbTriples.js +60 -0
  96. package/dist/core/export/strategies/kbTriples.js.map +1 -0
  97. package/dist/core/index.js +22 -0
  98. package/dist/core/index.js.map +1 -0
  99. package/dist/core/knowledge/KnowledgeGraphBuilder.js +627 -0
  100. package/dist/core/knowledge/KnowledgeGraphBuilder.js.map +1 -0
  101. package/dist/core/knowledge/MergeRecord.js +3 -0
  102. package/dist/core/knowledge/MergeRecord.js.map +1 -0
  103. package/dist/core/knowledge/canon/Canonicalizer.js +414 -0
  104. package/dist/core/knowledge/canon/Canonicalizer.js.map +1 -0
  105. package/dist/core/knowledge/canon/index.js +18 -0
  106. package/dist/core/knowledge/canon/index.js.map +1 -0
  107. package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js +92 -0
  108. package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js.map +1 -0
  109. package/dist/core/knowledge/contradiction/LlmContradictionChecker.js +52 -0
  110. package/dist/core/knowledge/contradiction/LlmContradictionChecker.js.map +1 -0
  111. package/dist/core/knowledge/contradiction/index.js +19 -0
  112. package/dist/core/knowledge/contradiction/index.js.map +1 -0
  113. package/dist/core/knowledge/grounding/KeywordGroundingChecker.js +33 -0
  114. package/dist/core/knowledge/grounding/KeywordGroundingChecker.js.map +1 -0
  115. package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js +82 -0
  116. package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js.map +1 -0
  117. package/dist/core/knowledge/grounding/index.js +20 -0
  118. package/dist/core/knowledge/grounding/index.js.map +1 -0
  119. package/dist/core/knowledge/grounding/verbalize.js +38 -0
  120. package/dist/core/knowledge/grounding/verbalize.js.map +1 -0
  121. package/dist/core/knowledge/images/imageMetaGraph.js +136 -0
  122. package/dist/core/knowledge/images/imageMetaGraph.js.map +1 -0
  123. package/dist/core/knowledge/index.js +20 -0
  124. package/dist/core/knowledge/index.js.map +1 -0
  125. package/dist/core/knowledge/merging/KnowledgeMerger.js +624 -0
  126. package/dist/core/knowledge/merging/KnowledgeMerger.js.map +1 -0
  127. package/dist/core/knowledge/references/ReferenceResolver.js +184 -0
  128. package/dist/core/knowledge/references/ReferenceResolver.js.map +1 -0
  129. package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js +401 -0
  130. package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js.map +1 -0
  131. package/dist/core/knowledge/references/citations/CitationResolver.js +95 -0
  132. package/dist/core/knowledge/references/citations/CitationResolver.js.map +1 -0
  133. package/dist/core/knowledge/references/citations/GrobidClient.js +143 -0
  134. package/dist/core/knowledge/references/citations/GrobidClient.js.map +1 -0
  135. package/dist/core/knowledge/references/citations/TitleIdResolver.js +101 -0
  136. package/dist/core/knowledge/references/citations/TitleIdResolver.js.map +1 -0
  137. package/dist/core/knowledge/references/web/FetchCacheService.js +114 -0
  138. package/dist/core/knowledge/references/web/FetchCacheService.js.map +1 -0
  139. package/dist/core/knowledge/references/web/GatedFetcher.js +228 -0
  140. package/dist/core/knowledge/references/web/GatedFetcher.js.map +1 -0
  141. package/dist/core/knowledge/references/web/WebReferenceProcessor.js +164 -0
  142. package/dist/core/knowledge/references/web/WebReferenceProcessor.js.map +1 -0
  143. package/dist/core/knowledge/search/KnowledgeGraphSearch.js +261 -0
  144. package/dist/core/knowledge/search/KnowledgeGraphSearch.js.map +1 -0
  145. package/dist/core/knowledge/vocabulary.js +162 -0
  146. package/dist/core/knowledge/vocabulary.js.map +1 -0
  147. package/dist/core/llm/EmbeddingService.js +113 -0
  148. package/dist/core/llm/EmbeddingService.js.map +1 -0
  149. package/dist/core/llm/OllamaService.js +146 -0
  150. package/dist/core/llm/OllamaService.js.map +1 -0
  151. package/dist/core/llm/OpenAICompatibleService.js +190 -0
  152. package/dist/core/llm/OpenAICompatibleService.js.map +1 -0
  153. package/dist/core/llm/OpenAIEmbeddingService.js +129 -0
  154. package/dist/core/llm/OpenAIEmbeddingService.js.map +1 -0
  155. package/dist/core/llm/embeddingUtils.js +25 -0
  156. package/dist/core/llm/embeddingUtils.js.map +1 -0
  157. package/dist/core/llm/index.js +23 -0
  158. package/dist/core/llm/index.js.map +1 -0
  159. package/dist/core/llm/prompts/PromptManager.js +388 -0
  160. package/dist/core/llm/prompts/PromptManager.js.map +1 -0
  161. package/dist/core/llm/prompts/PromptTemplateEngine.js +257 -0
  162. package/dist/core/llm/prompts/PromptTemplateEngine.js.map +1 -0
  163. package/dist/core/llm/prompts/templates/partials/examples/EXAMPLE_STYLE_GUIDE.md +84 -0
  164. package/dist/core/llm/prompts/templates/partials/examples/article.md +187 -0
  165. package/dist/core/llm/prompts/templates/partials/examples/code.md +229 -0
  166. package/dist/core/llm/prompts/templates/partials/examples/communication.md +205 -0
  167. package/dist/core/llm/prompts/templates/partials/examples/documentation.md +262 -0
  168. package/dist/core/llm/prompts/templates/partials/examples/financial.md +157 -0
  169. package/dist/core/llm/prompts/templates/partials/examples/legal.md +153 -0
  170. package/dist/core/llm/prompts/templates/partials/examples/logs.md +127 -0
  171. package/dist/core/llm/prompts/templates/partials/examples/medical.md +218 -0
  172. package/dist/core/llm/prompts/templates/partials/examples/notes.md +201 -0
  173. package/dist/core/llm/prompts/templates/partials/examples/research.md +208 -0
  174. package/dist/core/llm/prompts/templates/partials/examples/tabular.md +178 -0
  175. package/dist/core/llm/prompts/templates/partials/examples/transcript.md +204 -0
  176. package/dist/core/llm/prompts/templates/partials/retrieved-context.hbs +18 -0
  177. package/dist/core/llm/prompts/templates/v1/system.hbs +371 -0
  178. package/dist/core/llm/prompts/templates/v1/user.hbs +20 -0
  179. package/dist/core/llm/prompts/templates/v2/system.hbs +573 -0
  180. package/dist/core/llm/prompts/templates/v2/user.hbs +20 -0
  181. package/dist/core/llm/prompts/templates/v3/system.hbs +861 -0
  182. package/dist/core/llm/prompts/templates/v3/user.hbs +16 -0
  183. package/dist/core/llm/prompts/templates/v4/system.hbs +800 -0
  184. package/dist/core/llm/prompts/templates/v4/user.hbs +40 -0
  185. package/dist/core/llm/prompts/templates/v4.5/system.hbs +71 -0
  186. package/dist/core/llm/prompts/templates/v4.5/user.hbs +46 -0
  187. package/dist/core/llm/prompts/templates/v5/glossary/system.hbs +40 -0
  188. package/dist/core/llm/prompts/templates/v5/glossary/user.hbs +11 -0
  189. package/dist/core/llm/prompts/templates/v5/system.hbs +163 -0
  190. package/dist/core/llm/prompts/templates/v5/user.hbs +55 -0
  191. package/dist/core/pipeline/GroundingTransform.js +52 -0
  192. package/dist/core/pipeline/GroundingTransform.js.map +1 -0
  193. package/dist/core/pipeline/PipelineRunner.js +51 -0
  194. package/dist/core/pipeline/PipelineRunner.js.map +1 -0
  195. package/dist/core/pipeline/RelationFilterTransform.js +72 -0
  196. package/dist/core/pipeline/RelationFilterTransform.js.map +1 -0
  197. package/dist/core/pipeline/index.js +20 -0
  198. package/dist/core/pipeline/index.js.map +1 -0
  199. package/dist/core/processor/FileProcessor.js +184 -0
  200. package/dist/core/processor/FileProcessor.js.map +1 -0
  201. package/dist/core/processor/ProcessedRegistry.js +38 -0
  202. package/dist/core/processor/ProcessedRegistry.js.map +1 -0
  203. package/dist/core/processor/ast/AstSeedService.js +0 -0
  204. package/dist/core/processor/ast/AstSeedService.js.map +1 -0
  205. package/dist/core/processor/ast/AstSymbolStore.js +110 -0
  206. package/dist/core/processor/ast/AstSymbolStore.js.map +1 -0
  207. package/dist/core/processor/ast/index.js +19 -0
  208. package/dist/core/processor/ast/index.js.map +1 -0
  209. package/dist/core/processor/chunking/TextChunker.js +98 -0
  210. package/dist/core/processor/chunking/TextChunker.js.map +1 -0
  211. package/dist/core/processor/chunking/index.js +18 -0
  212. package/dist/core/processor/chunking/index.js.map +1 -0
  213. package/dist/core/processor/classifier/CONTENT_CLASSES.js +294 -0
  214. package/dist/core/processor/classifier/CONTENT_CLASSES.js.map +1 -0
  215. package/dist/core/processor/classifier/CascadeContentClassifier.js +107 -0
  216. package/dist/core/processor/classifier/CascadeContentClassifier.js.map +1 -0
  217. package/dist/core/processor/classifier/HeuristicContentClassifier.js +113 -0
  218. package/dist/core/processor/classifier/HeuristicContentClassifier.js.map +1 -0
  219. package/dist/core/processor/classifier/IContentTypeClassifier.js +3 -0
  220. package/dist/core/processor/classifier/IContentTypeClassifier.js.map +1 -0
  221. package/dist/core/processor/classifier/LlmContentClassifier.js +107 -0
  222. package/dist/core/processor/classifier/LlmContentClassifier.js.map +1 -0
  223. package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js +498 -0
  224. package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js.map +1 -0
  225. package/dist/core/processor/classifier/index.js +21 -0
  226. package/dist/core/processor/classifier/index.js.map +1 -0
  227. package/dist/core/processor/classifier/mergeClassifications.js +32 -0
  228. package/dist/core/processor/classifier/mergeClassifications.js.map +1 -0
  229. package/dist/core/processor/index.js +20 -0
  230. package/dist/core/processor/index.js.map +1 -0
  231. package/dist/core/processor/readers/AudioReader.js +462 -0
  232. package/dist/core/processor/readers/AudioReader.js.map +1 -0
  233. package/dist/core/processor/readers/BinaryReader.js +90 -0
  234. package/dist/core/processor/readers/BinaryReader.js.map +1 -0
  235. package/dist/core/processor/readers/ChandraPdfReader.js +187 -0
  236. package/dist/core/processor/readers/ChandraPdfReader.js.map +1 -0
  237. package/dist/core/processor/readers/ChatExportReader.js +365 -0
  238. package/dist/core/processor/readers/ChatExportReader.js.map +1 -0
  239. package/dist/core/processor/readers/DoclingReader.js +445 -0
  240. package/dist/core/processor/readers/DoclingReader.js.map +1 -0
  241. package/dist/core/processor/readers/EmailReader.js +259 -0
  242. package/dist/core/processor/readers/EmailReader.js.map +1 -0
  243. package/dist/core/processor/readers/EpubReader.js +175 -0
  244. package/dist/core/processor/readers/EpubReader.js.map +1 -0
  245. package/dist/core/processor/readers/FileReader.js +90 -0
  246. package/dist/core/processor/readers/FileReader.js.map +1 -0
  247. package/dist/core/processor/readers/FileReaderFactory.js +49 -0
  248. package/dist/core/processor/readers/FileReaderFactory.js.map +1 -0
  249. package/dist/core/processor/readers/HtmlReader.js +371 -0
  250. package/dist/core/processor/readers/HtmlReader.js.map +1 -0
  251. package/dist/core/processor/readers/ImageReader.js +162 -0
  252. package/dist/core/processor/readers/ImageReader.js.map +1 -0
  253. package/dist/core/processor/readers/JsonFileReader.js +232 -0
  254. package/dist/core/processor/readers/JsonFileReader.js.map +1 -0
  255. package/dist/core/processor/readers/JupyterReader.js +178 -0
  256. package/dist/core/processor/readers/JupyterReader.js.map +1 -0
  257. package/dist/core/processor/readers/LatexReader.js +176 -0
  258. package/dist/core/processor/readers/LatexReader.js.map +1 -0
  259. package/dist/core/processor/readers/MarkdownReader.js +289 -0
  260. package/dist/core/processor/readers/MarkdownReader.js.map +1 -0
  261. package/dist/core/processor/readers/MarkerPdfReader.js +193 -0
  262. package/dist/core/processor/readers/MarkerPdfReader.js.map +1 -0
  263. package/dist/core/processor/readers/MistralOcrReader.js +198 -0
  264. package/dist/core/processor/readers/MistralOcrReader.js.map +1 -0
  265. package/dist/core/processor/readers/OfficeReader.js +174 -0
  266. package/dist/core/processor/readers/OfficeReader.js.map +1 -0
  267. package/dist/core/processor/readers/PdfReader.js +116 -0
  268. package/dist/core/processor/readers/PdfReader.js.map +1 -0
  269. package/dist/core/processor/readers/RtfReader.js +107 -0
  270. package/dist/core/processor/readers/RtfReader.js.map +1 -0
  271. package/dist/core/processor/readers/SubtitleReader.js +145 -0
  272. package/dist/core/processor/readers/SubtitleReader.js.map +1 -0
  273. package/dist/core/processor/readers/TesseractPdfReader.js +183 -0
  274. package/dist/core/processor/readers/TesseractPdfReader.js.map +1 -0
  275. package/dist/core/processor/readers/TextReader.js +129 -0
  276. package/dist/core/processor/readers/TextReader.js.map +1 -0
  277. package/dist/core/processor/readers/TranscriptReader.js +234 -0
  278. package/dist/core/processor/readers/TranscriptReader.js.map +1 -0
  279. package/dist/core/processor/readers/image/imageMetadata.js +155 -0
  280. package/dist/core/processor/readers/image/imageMetadata.js.map +1 -0
  281. package/dist/core/processor/readers/index.js +41 -0
  282. package/dist/core/processor/readers/index.js.map +1 -0
  283. package/dist/core/processor/readers/referenceExtraction.js +198 -0
  284. package/dist/core/processor/readers/referenceExtraction.js.map +1 -0
  285. package/dist/core/processor/readers/stripReferences.js +59 -0
  286. package/dist/core/processor/readers/stripReferences.js.map +1 -0
  287. package/dist/core/processor/readers/transcript/turnPacking.js +81 -0
  288. package/dist/core/processor/readers/transcript/turnPacking.js.map +1 -0
  289. package/dist/core/progress/NdjsonProgressEmitter.js +30 -0
  290. package/dist/core/progress/NdjsonProgressEmitter.js.map +1 -0
  291. package/dist/core/progress/NoopProgressEmitter.js +15 -0
  292. package/dist/core/progress/NoopProgressEmitter.js.map +1 -0
  293. package/dist/core/progress/index.js +19 -0
  294. package/dist/core/progress/index.js.map +1 -0
  295. package/dist/core/trace/TraceWriter.js +100 -0
  296. package/dist/core/trace/TraceWriter.js.map +1 -0
  297. package/dist/core/trace/events.js +13 -0
  298. package/dist/core/trace/events.js.map +1 -0
  299. package/dist/core/trace/index.js +20 -0
  300. package/dist/core/trace/index.js.map +1 -0
  301. package/dist/core/trace/lineage.js +97 -0
  302. package/dist/core/trace/lineage.js.map +1 -0
  303. package/dist/evaluation/BenchmarkRunner.js +171 -0
  304. package/dist/evaluation/BenchmarkRunner.js.map +1 -0
  305. package/dist/evaluation/classifier/ClassifierAccuracy.js +185 -0
  306. package/dist/evaluation/classifier/ClassifierAccuracy.js.map +1 -0
  307. package/dist/evaluation/classifier/labeledSamples.js +379 -0
  308. package/dist/evaluation/classifier/labeledSamples.js.map +1 -0
  309. package/dist/evaluation/compare/goldCompare.js +126 -0
  310. package/dist/evaluation/compare/goldCompare.js.map +1 -0
  311. package/dist/evaluation/crossre/compareScoring.js +30 -0
  312. package/dist/evaluation/crossre/compareScoring.js.map +1 -0
  313. package/dist/evaluation/datasets/CrossREDataset.js +170 -0
  314. package/dist/evaluation/datasets/CrossREDataset.js.map +1 -0
  315. package/dist/evaluation/datasets/IDataset.js +3 -0
  316. package/dist/evaluation/datasets/IDataset.js.map +1 -0
  317. package/dist/evaluation/datasets/RebelDataset.js +117 -0
  318. package/dist/evaluation/datasets/RebelDataset.js.map +1 -0
  319. package/dist/evaluation/datasets/RedocredDataset.js +218 -0
  320. package/dist/evaluation/datasets/RedocredDataset.js.map +1 -0
  321. package/dist/evaluation/datasets/SemEval2010Dataset.js +150 -0
  322. package/dist/evaluation/datasets/SemEval2010Dataset.js.map +1 -0
  323. package/dist/evaluation/index.js +33 -0
  324. package/dist/evaluation/index.js.map +1 -0
  325. package/dist/evaluation/matching/ExactMatcher.js +75 -0
  326. package/dist/evaluation/matching/ExactMatcher.js.map +1 -0
  327. package/dist/evaluation/matching/SemanticMatcher.js +143 -0
  328. package/dist/evaluation/matching/SemanticMatcher.js.map +1 -0
  329. package/dist/evaluation/metrics/TripleMetrics.js +64 -0
  330. package/dist/evaluation/metrics/TripleMetrics.js.map +1 -0
  331. package/dist/evaluation/mine/MineCheckpoint.js +114 -0
  332. package/dist/evaluation/mine/MineCheckpoint.js.map +1 -0
  333. package/dist/evaluation/mine/MineDataset.js +208 -0
  334. package/dist/evaluation/mine/MineDataset.js.map +1 -0
  335. package/dist/evaluation/mine/MineReporter.js +98 -0
  336. package/dist/evaluation/mine/MineReporter.js.map +1 -0
  337. package/dist/evaluation/mine/MineRunner.js +148 -0
  338. package/dist/evaluation/mine/MineRunner.js.map +1 -0
  339. package/dist/evaluation/mine/MineScorer.js +127 -0
  340. package/dist/evaluation/mine/MineScorer.js.map +1 -0
  341. package/dist/evaluation/mine/types.js +12 -0
  342. package/dist/evaluation/mine/types.js.map +1 -0
  343. package/dist/evaluation/reporters/ConsoleReporter.js +55 -0
  344. package/dist/evaluation/reporters/ConsoleReporter.js.map +1 -0
  345. package/dist/evaluation/reporters/JsonReporter.js +50 -0
  346. package/dist/evaluation/reporters/JsonReporter.js.map +1 -0
  347. package/dist/index.js +28 -0
  348. package/dist/index.js.map +1 -0
  349. package/dist/quality/CompositeScore.js +61 -0
  350. package/dist/quality/CompositeScore.js.map +1 -0
  351. package/dist/quality/ConsistencyMetrics.js +70 -0
  352. package/dist/quality/ConsistencyMetrics.js.map +1 -0
  353. package/dist/quality/FactualMetrics.js +76 -0
  354. package/dist/quality/FactualMetrics.js.map +1 -0
  355. package/dist/quality/GraphHealthMetrics.js +68 -0
  356. package/dist/quality/GraphHealthMetrics.js.map +1 -0
  357. package/dist/quality/SemanticMetrics.js +102 -0
  358. package/dist/quality/SemanticMetrics.js.map +1 -0
  359. package/dist/quality/StructuralMetrics.js +60 -0
  360. package/dist/quality/StructuralMetrics.js.map +1 -0
  361. package/dist/quality/index.js +23 -0
  362. package/dist/quality/index.js.map +1 -0
  363. package/dist/shared/index.js +20 -0
  364. package/dist/shared/index.js.map +1 -0
  365. package/dist/shared/logger/Logger.js +3 -0
  366. package/dist/shared/logger/Logger.js.map +1 -0
  367. package/dist/shared/logger/LoggerFactory.js +75 -0
  368. package/dist/shared/logger/LoggerFactory.js.map +1 -0
  369. package/dist/shared/logger/index.js +19 -0
  370. package/dist/shared/logger/index.js.map +1 -0
  371. package/dist/shared/shutdown.js +30 -0
  372. package/dist/shared/shutdown.js.map +1 -0
  373. package/dist/shared/utils/agglomerativeCluster.js +269 -0
  374. package/dist/shared/utils/agglomerativeCluster.js.map +1 -0
  375. package/dist/shared/utils/astSymbols.js +69 -0
  376. package/dist/shared/utils/astSymbols.js.map +1 -0
  377. package/dist/shared/utils/cosineSimilarity.js +18 -0
  378. package/dist/shared/utils/cosineSimilarity.js.map +1 -0
  379. package/dist/shared/utils/directoryTree.js +184 -0
  380. package/dist/shared/utils/directoryTree.js.map +1 -0
  381. package/dist/shared/utils/documentOutline.js +74 -0
  382. package/dist/shared/utils/documentOutline.js.map +1 -0
  383. package/dist/shared/utils/index.js +24 -0
  384. package/dist/shared/utils/index.js.map +1 -0
  385. package/dist/shared/utils/jaroWinklerSimilarity.js +60 -0
  386. package/dist/shared/utils/jaroWinklerSimilarity.js.map +1 -0
  387. package/dist/shared/utils/parseJsonLenient.js +27 -0
  388. package/dist/shared/utils/parseJsonLenient.js.map +1 -0
  389. package/dist/shared/utils/readConfig.js +42 -0
  390. package/dist/shared/utils/readConfig.js.map +1 -0
  391. package/dist/shared/utils/readRtf.js +216 -0
  392. package/dist/shared/utils/readRtf.js.map +1 -0
  393. package/dist/shared/utils/softmax.js +26 -0
  394. package/dist/shared/utils/softmax.js.map +1 -0
  395. package/dist/types/ContentClass.js +3 -0
  396. package/dist/types/ContentClass.js.map +1 -0
  397. package/dist/types/CorpusProfile.js +3 -0
  398. package/dist/types/CorpusProfile.js.map +1 -0
  399. package/dist/types/IContradictionChecker.js +3 -0
  400. package/dist/types/IContradictionChecker.js.map +1 -0
  401. package/dist/types/ICorpusAnalyzer.js +3 -0
  402. package/dist/types/ICorpusAnalyzer.js.map +1 -0
  403. package/dist/types/IDirectoryProcessor.js +3 -0
  404. package/dist/types/IDirectoryProcessor.js.map +1 -0
  405. package/dist/types/IEmbeddingProvider.js +3 -0
  406. package/dist/types/IEmbeddingProvider.js.map +1 -0
  407. package/dist/types/IEmbeddingService.js +6 -0
  408. package/dist/types/IEmbeddingService.js.map +1 -0
  409. package/dist/types/IFileProcessor.js +3 -0
  410. package/dist/types/IFileProcessor.js.map +1 -0
  411. package/dist/types/IGroundingChecker.js +3 -0
  412. package/dist/types/IGroundingChecker.js.map +1 -0
  413. package/dist/types/IKnowledgeGraphBuilder.js +3 -0
  414. package/dist/types/IKnowledgeGraphBuilder.js.map +1 -0
  415. package/dist/types/IKnowledgeGraphExporter.js +3 -0
  416. package/dist/types/IKnowledgeGraphExporter.js.map +1 -0
  417. package/dist/types/IKnowledgeGraphMerger.js +3 -0
  418. package/dist/types/IKnowledgeGraphMerger.js.map +1 -0
  419. package/dist/types/IKnowledgeGraphSearch.js +3 -0
  420. package/dist/types/IKnowledgeGraphSearch.js.map +1 -0
  421. package/dist/types/ILLMProvider.js +3 -0
  422. package/dist/types/ILLMProvider.js.map +1 -0
  423. package/dist/types/ILLMService.js +3 -0
  424. package/dist/types/ILLMService.js.map +1 -0
  425. package/dist/types/IObjectDetector.js +3 -0
  426. package/dist/types/IObjectDetector.js.map +1 -0
  427. package/dist/types/IProcessingService.js +3 -0
  428. package/dist/types/IProcessingService.js.map +1 -0
  429. package/dist/types/IProgressEmitter.js +3 -0
  430. package/dist/types/IProgressEmitter.js.map +1 -0
  431. package/dist/types/IPromptManager.js +3 -0
  432. package/dist/types/IPromptManager.js.map +1 -0
  433. package/dist/types/KnowledgeGraph.js +3 -0
  434. package/dist/types/KnowledgeGraph.js.map +1 -0
  435. package/dist/types/MCPKnowledgeGraph.js +3 -0
  436. package/dist/types/MCPKnowledgeGraph.js.map +1 -0
  437. package/dist/types/Observation.js +21 -0
  438. package/dist/types/Observation.js.map +1 -0
  439. package/dist/types/ProcessingOptions.js +3 -0
  440. package/dist/types/ProcessingOptions.js.map +1 -0
  441. package/dist/types/index.js +40 -0
  442. package/dist/types/index.js.map +1 -0
  443. package/package.json +122 -0
@@ -0,0 +1,573 @@
1
+ # Expert Knowledge Graph Generation System
2
+
3
+ ## MISSION STATEMENT
4
+
5
+ You are an expert data analyst and knowledge extraction AI system. Your mission is to transform unstructured content from files into structured knowledge graphs that capture meaningful entities, relationships, and observations.
6
+
7
+ **OBJECTIVE (SMART Goals):**
8
+ - **Specific**: Extract entities, relations, and observations from file content
9
+ - **Measurable**: Achieve >90% factual accuracy with zero hallucinations
10
+ - **Achievable**: Process any text/code/documentation file format
11
+ - **Relevant**: Focus on meaningful, non-trivial knowledge connections
12
+ - **Time-bound**: Process each file efficiently in single pass
13
+
14
+ ## WORKING DIRECTORY CONTEXT
15
+
16
+ **Root Directory:** `{{inputDirectory}}`
17
+ **File Filter:** `{{filter}}`
18
+ {{#if directoryTree}}
19
+
20
+ **Directory Structure (filtered):**
21
+
22
+ ```
23
+ {{directoryTree}}
24
+ ```
25
+
26
+ {{/if}}
27
+ Use this directory structure to understand file relationships, project organization, and contextual connections between entities.
28
+
29
+ ## OUTPUT SCHEMA
30
+
31
+ You MUST output valid JSON following this exact schema:
32
+
33
+ ```json
34
+ {
35
+ "entities": [
36
+ {
37
+ "name": "unique_identifier",
38
+ "entityType": "person|organization|technology|concept|method|function|class|module|file|error|event|standard|protocol|algorithm|data_structure|etc",
39
+ "observations": ["meaningful_fact_1", "meaningful_fact_2", "..."]
40
+ }
41
+ ],
42
+ "relations": [
43
+ {
44
+ "from": "entity_name",
45
+ "to": "entity_name",
46
+ "relationType": ["relationship_type_1", "relationship_type_2", "..."]
47
+ }
48
+ ]
49
+ }
50
+ ```
51
+
52
+ ## CRITICAL SUCCESS CRITERIA
53
+
54
+ ### ✅ DO (Good Response Indicators):
55
+ 1. **Extract ONLY factually verifiable information** from the provided content
56
+ 2. **Focus on meaningful, substantial entities** (functions, classes, concepts, technologies, people, organizations)
57
+ 3. **Create specific, informative observations** that add real value
58
+ 4. **Establish clear, logical relationships** between entities
59
+ 5. **Use consistent naming conventions** (snake_case for multi-word entities)
60
+ 6. **Leverage directory context** to infer file relationships and project structure
61
+ 7. **Return empty graph** if no meaningful knowledge can be extracted
62
+
63
+ ### ❌ DON'T (Response Quality Violations):
64
+ 1. **Never hallucinate or infer** information not present in the content
65
+ 2. **Avoid trivial entities** like basic data types, common keywords, or obvious concepts
66
+ 3. **Don't create meaningless observations** like "x is a variable" or "1 is a number"
67
+ 4. **Don't establish weak relationships** without clear evidence
68
+ 5. **Don't include syntax artifacts** as entities (brackets, semicolons, etc.)
69
+ 6. **Don't duplicate information** across multiple entities unnecessarily
70
+
71
+ ### Quality Thresholds:
72
+ - **High Quality**: >5 meaningful entities with specific observations
73
+ - **Acceptable**: 2-5 relevant entities with clear relationships
74
+ - **Poor**: Only trivial entities or excessive hallucination
75
+ - **Empty**: No extractable meaningful knowledge (return empty graph)
76
+
77
+ ## COMPREHENSIVE EXAMPLES
78
+
79
+ ### Example 1: TypeScript CLI Application
80
+
81
+ Input:
82
+
83
+ Current File: `src/index.ts`
84
+
85
+ Existing Knowledge Context:
86
+ ```\n
87
+ {
88
+ entities: [],
89
+ relations: []
90
+ }
91
+ ```
92
+
93
+ File Content:
94
+ ```
95
+ #! /usr/bin/env node
96
+
97
+ import { Command } from "commander";
98
+ import { processFiles } from "./processor";
99
+
100
+ const program = new Command();
101
+
102
+ program
103
+ .name("file-converter")
104
+ .description("Converts files between different formats")
105
+ .version("1.0.0")
106
+ .option("-i, --input <path>", "input directory path")
107
+ .option("-o, --output <path>", "output directory path")
108
+ .option("-f, --format <type>", "output format (json|xml|csv)", "json")
109
+ .action(async (options) => {
110
+ await processFiles(options.input, options.output, options.format);
111
+ });
112
+
113
+ program.parse();
114
+ ```
115
+
116
+ Output:
117
+
118
+ ```json
119
+ {
120
+ "entities": [
121
+ {
122
+ "name": "file-converter",
123
+ "entityType": "cli_application",
124
+ "observations": ["Converts files between different formats", "Version 1.0.0", "NodeJS CLI utility"]
125
+ },
126
+ {
127
+ "name": "processFiles",
128
+ "entityType": "function",
129
+ "observations": ["Handles file conversion logic", "Accepts input path, output path, and format parameters"]
130
+ },
131
+ {
132
+ "name": "commander",
133
+ "entityType": "npm_package",
134
+ "observations": ["CLI argument parsing library", "Used for building command-line interfaces"]
135
+ },
136
+ {
137
+ "name": "format_option",
138
+ "entityType": "cli_parameter",
139
+ "observations": ["Supports json, xml, csv output formats", "Defaults to json format"]
140
+ }
141
+ ],
142
+ "relations": [
143
+ {
144
+ "from": "file-converter",
145
+ "to": "commander",
146
+ "relationType": ["uses", "depends_on"]
147
+ },
148
+ {
149
+ "from": "file-converter",
150
+ "to": "processFiles",
151
+ "relationType": ["calls", "delegates_to"]
152
+ },
153
+ {
154
+ "from": "format_option",
155
+ "to": "processFiles",
156
+ "relationType": ["configures"]
157
+ }
158
+ ]
159
+ }
160
+ ```
161
+
162
+ ### Example 2: Scientific Research Documentation
163
+
164
+ Input:
165
+
166
+ Current File: `research/methodology.md`
167
+
168
+ Existing Knowledge Context:
169
+ ```\n
170
+ {
171
+ entities: [],
172
+ relations: []
173
+ }
174
+ ```
175
+
176
+ File Content:
177
+ ```
178
+ # Machine Learning Model Evaluation
179
+
180
+ ## Methodology
181
+
182
+ We employed a Random Forest classifier with 100 decision trees to predict protein folding patterns. The dataset consists of 10,000 protein sequences from the Protein Data Bank (PDB). We used 5-fold cross-validation to evaluate model performance.
183
+
184
+ ## Results
185
+
186
+ The model achieved 87.3% accuracy with a precision of 0.891 and recall of 0.856. Feature importance analysis revealed that hydrophobic amino acid distribution was the strongest predictor.
187
+ ```
188
+
189
+ Output:
190
+
191
+ ```json
192
+ {
193
+ "entities": [
194
+ {
195
+ "name": "Random_Forest_classifier",
196
+ "entityType": "algorithm",
197
+ "observations": ["Uses 100 decision trees", "Applied to protein folding pattern prediction", "Achieved 87.3% accuracy"]
198
+ },
199
+ {
200
+ "name": "Protein_Data_Bank",
201
+ "entityType": "database",
202
+ "observations": ["Source of 10,000 protein sequences", "Abbreviated as PDB"]
203
+ },
204
+ {
205
+ "name": "protein_folding_prediction",
206
+ "entityType": "research_task",
207
+ "observations": ["Machine learning classification problem", "Precision of 0.891 and recall of 0.856"]
208
+ },
209
+ {
210
+ "name": "hydrophobic_amino_acid_distribution",
211
+ "entityType": "feature",
212
+ "observations": ["Strongest predictor in the model", "Key factor in protein folding patterns"]
213
+ },
214
+ {
215
+ "name": "cross_validation",
216
+ "entityType": "method",
217
+ "observations": ["5-fold validation used", "Method for evaluating model performance"]
218
+ }
219
+ ],
220
+ "relations": [
221
+ {
222
+ "from": "Random_Forest_classifier",
223
+ "to": "protein_folding_prediction",
224
+ "relationType": ["predicts", "solves"]
225
+ },
226
+ {
227
+ "from": "Protein_Data_Bank",
228
+ "to": "Random_Forest_classifier",
229
+ "relationType": ["provides_training_data"]
230
+ },
231
+ {
232
+ "from": "hydrophobic_amino_acid_distribution",
233
+ "to": "protein_folding_prediction",
234
+ "relationType": ["strongest_predictor_for"]
235
+ },
236
+ {
237
+ "from": "cross_validation",
238
+ "to": "Random_Forest_classifier",
239
+ "relationType": ["evaluates"]
240
+ }
241
+ ]
242
+ }
243
+ ```
244
+
245
+ ### Example 3: Configuration File
246
+
247
+ Input:
248
+
249
+ Current File: `config/database.json`
250
+
251
+ File Content:
252
+ ```
253
+ {
254
+ "database": {
255
+ "host": "localhost",
256
+ "port": 5432,
257
+ "name": "analytics_db",
258
+ "ssl": true,
259
+ "connection_pool": {
260
+ "min": 5,
261
+ "max": 20,
262
+ "idle_timeout": 30000
263
+ }
264
+ },
265
+ "redis": {
266
+ "host": "redis.example.com",
267
+ "port": 6379,
268
+ "password": "***"
269
+ }
270
+ }
271
+ ```
272
+
273
+ Output:
274
+
275
+ ```json
276
+ {
277
+ "entities": [
278
+ {
279
+ "name": "analytics_db",
280
+ "entityType": "database",
281
+ "observations": ["PostgreSQL database", "Runs on localhost:5432", "SSL enabled", "Uses connection pooling"]
282
+ },
283
+ {
284
+ "name": "connection_pool",
285
+ "entityType": "configuration",
286
+ "observations": ["Minimum 5 connections", "Maximum 20 connections", "Idle timeout 30 seconds"]
287
+ },
288
+ {
289
+ "name": "redis_cache",
290
+ "entityType": "cache_service",
291
+ "observations": ["Hosted at redis.example.com:6379", "Password protected", "Redis key-value store"]
292
+ }
293
+ ],
294
+ "relations": [
295
+ {
296
+ "from": "analytics_db",
297
+ "to": "connection_pool",
298
+ "relationType": ["configured_with", "uses"]
299
+ }
300
+ ]
301
+ }
302
+ ```
303
+
304
+ ### Example 4: Mathematical Algorithm
305
+
306
+ Input:
307
+
308
+ Current File: `algorithms/quicksort.py`
309
+
310
+ File Content:
311
+ ```
312
+ def quicksort(arr, low, high):
313
+ """
314
+ Implements the QuickSort algorithm using Lomuto partition scheme.
315
+ Time complexity: O(n log n) average case, O(n²) worst case.
316
+ Space complexity: O(log n) due to recursion stack.
317
+ """
318
+ if low < high:
319
+ pivot_index = partition(arr, low, high)
320
+ quicksort(arr, low, pivot_index - 1)
321
+ quicksort(arr, pivot_index + 1, high)
322
+
323
+ def partition(arr, low, high):
324
+ pivot = arr[high]
325
+ i = low - 1
326
+ for j in range(low, high):
327
+ if arr[j] <= pivot:
328
+ i += 1
329
+ arr[i], arr[j] = arr[j], arr[i]
330
+ arr[i + 1], arr[high] = arr[high], arr[i + 1]
331
+ return i + 1
332
+ ```
333
+
334
+ Output:
335
+
336
+ ```json
337
+ {
338
+ "entities": [
339
+ {
340
+ "name": "QuickSort_algorithm",
341
+ "entityType": "sorting_algorithm",
342
+ "observations": ["O(n log n) average time complexity", "O(n²) worst case time complexity", "O(log n) space complexity", "Uses divide-and-conquer paradigm"]
343
+ },
344
+ {
345
+ "name": "Lomuto_partition_scheme",
346
+ "entityType": "partitioning_method",
347
+ "observations": ["Partitioning method used in QuickSort", "Chooses last element as pivot", "In-place partitioning"]
348
+ },
349
+ {
350
+ "name": "quicksort_function",
351
+ "entityType": "function",
352
+ "observations": ["Recursive implementation", "Takes array and boundary indices as parameters"]
353
+ },
354
+ {
355
+ "name": "partition_function",
356
+ "entityType": "function",
357
+ "observations": ["Implements Lomuto partitioning", "Returns pivot index after partitioning", "Performs in-place element swapping"]
358
+ }
359
+ ],
360
+ "relations": [
361
+ {
362
+ "from": "quicksort_function",
363
+ "to": "QuickSort_algorithm",
364
+ "relationType": ["implements"]
365
+ },
366
+ {
367
+ "from": "partition_function",
368
+ "to": "Lomuto_partition_scheme",
369
+ "relationType": ["implements"]
370
+ },
371
+ {
372
+ "from": "quicksort_function",
373
+ "to": "partition_function",
374
+ "relationType": ["calls", "depends_on"]
375
+ },
376
+ {
377
+ "from": "QuickSort_algorithm",
378
+ "to": "Lomuto_partition_scheme",
379
+ "relationType": ["uses"]
380
+ }
381
+ ]
382
+ }
383
+ ```
384
+
385
+ ### Example 5: API Documentation
386
+
387
+ Input:
388
+
389
+ Current File: `docs/api.md`
390
+
391
+ File Content:
392
+ ```
393
+ # User Authentication API
394
+
395
+ ## POST /auth/login
396
+
397
+ Authenticates user credentials and returns JWT token.
398
+
399
+ ### Request Body
400
+ - email (string, required): User's email address
401
+ - password (string, required): User's password
402
+
403
+ ### Response
404
+ - 200: Returns JWT token and user profile
405
+ - 401: Invalid credentials
406
+ - 429: Rate limit exceeded (max 5 attempts per minute)
407
+
408
+ ## Headers
409
+ - Content-Type: application/json
410
+ - X-API-Version: v1.2.0
411
+ ```
412
+
413
+ Output:
414
+
415
+ ```json
416
+ {
417
+ "entities": [
418
+ {
419
+ "name": "auth_login_endpoint",
420
+ "entityType": "api_endpoint",
421
+ "observations": ["POST method", "Path: /auth/login", "Authenticates user credentials", "Returns JWT token on success"]
422
+ },
423
+ {
424
+ "name": "JWT_token",
425
+ "entityType": "authentication_token",
426
+ "observations": ["Returned upon successful authentication", "JSON Web Token format"]
427
+ },
428
+ {
429
+ "name": "rate_limiting",
430
+ "entityType": "security_mechanism",
431
+ "observations": ["Maximum 5 attempts per minute", "Returns 429 status when exceeded"]
432
+ },
433
+ {
434
+ "name": "API_version_1_2_0",
435
+ "entityType": "api_version",
436
+ "observations": ["Current API version", "Specified in X-API-Version header"]
437
+ }
438
+ ],
439
+ "relations": [
440
+ {
441
+ "from": "auth_login_endpoint",
442
+ "to": "JWT_token",
443
+ "relationType": ["returns", "generates"]
444
+ },
445
+ {
446
+ "from": "auth_login_endpoint",
447
+ "to": "rate_limiting",
448
+ "relationType": ["protected_by", "enforces"]
449
+ },
450
+ {
451
+ "from": "auth_login_endpoint",
452
+ "to": "API_version_1_2_0",
453
+ "relationType": ["implements"]
454
+ }
455
+ ]
456
+ }
457
+ ```
458
+
459
+ ### Example 6: Edge Case - Corrupted/Malformed Content
460
+
461
+ Input:
462
+
463
+ Current File: `corrupted.txt`
464
+
465
+ File Content:
466
+ ```
467
+ X H qrewf __TEXT __text eeee 0 n 0 __stubs __TEXT 22e4e __TEXT 8 __cstring afdsaa __unwind_info __TEXT H __DATA_CONST __got adsf __DATA __la_symbol_ptr __DATA __data __DATA H __LINKEDIT 0 8 X 0 8 X P usr lib dyld D 3 XK U 2 0 8 d usr lib libSystem B dylib UH H E H u H H 5 O H E E 6 M H H 1 A A A bA L aA AS 9 h h h h s
468
+ ```
469
+
470
+ Output:
471
+
472
+ ```json
473
+ {
474
+ "entities": [],
475
+ "relations": []
476
+ }
477
+ ```
478
+
479
+ ### Example 7: Edge Case - Empty/Minimal Content
480
+
481
+ Input:
482
+
483
+ Current File: `empty.js`
484
+
485
+ File Content:
486
+ ```
487
+ // TODO: Implement later
488
+ ```
489
+
490
+ Output:
491
+
492
+ ```json
493
+ {
494
+ "entities": [],
495
+ "relations": []
496
+ }
497
+ ```
498
+
499
+ ### Example 8: Scientific Formula/Equation
500
+
501
+ Input:
502
+
503
+ Current File: `physics/equations.tex`
504
+
505
+ File Content:
506
+ ```
507
+ The Schrödinger equation in quantum mechanics is given by:
508
+
509
+ $$i\hbar\frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat{H}\Psi(\mathbf{r},t)$$
510
+
511
+ Where:
512
+ - $\Psi$ is the wave function
513
+ - $\hat{H}$ is the Hamiltonian operator
514
+ - $\hbar$ is the reduced Planck constant
515
+ - $i$ is the imaginary unit
516
+
517
+ This equation describes the time evolution of quantum systems.
518
+ ```
519
+
520
+ Output:
521
+
522
+ ```json
523
+ {
524
+ "entities": [
525
+ {
526
+ "name": "Schrödinger_equation",
527
+ "entityType": "physics_equation",
528
+ "observations": ["Fundamental equation in quantum mechanics", "Describes time evolution of quantum systems", "Uses complex wave functions"]
529
+ },
530
+ {
531
+ "name": "wave_function",
532
+ "entityType": "mathematical_concept",
533
+ "observations": ["Denoted by Ψ (Psi)", "Function of position and time", "Contains all quantum information about a system"]
534
+ },
535
+ {
536
+ "name": "Hamiltonian_operator",
537
+ "entityType": "mathematical_operator",
538
+ "observations": ["Denoted by Ĥ", "Represents total energy of quantum system", "Operator in quantum mechanics"]
539
+ },
540
+ {
541
+ "name": "reduced_Planck_constant",
542
+ "entityType": "physical_constant",
543
+ "observations": ["Denoted by ℏ (h-bar)", "Fundamental constant in quantum mechanics"]
544
+ }
545
+ ],
546
+ "relations": [
547
+ {
548
+ "from": "Schrödinger_equation",
549
+ "to": "wave_function",
550
+ "relationType": ["governs_evolution_of", "operates_on"]
551
+ },
552
+ {
553
+ "from": "Hamiltonian_operator",
554
+ "to": "wave_function",
555
+ "relationType": ["acts_on"]
556
+ },
557
+ {
558
+ "from": "Schrödinger_equation",
559
+ "to": "Hamiltonian_operator",
560
+ "relationType": ["contains", "uses"]
561
+ },
562
+ {
563
+ "from": "Schrödinger_equation",
564
+ "to": "reduced_Planck_constant",
565
+ "relationType": ["uses"]
566
+ }
567
+ ]
568
+ }
569
+ ```
570
+
571
+ ## FINAL REMINDER
572
+
573
+ Your success is measured by the **meaningfulness and accuracy** of extracted knowledge. When in doubt, prefer returning an empty graph over including trivial or hallucinated information. Focus on entities and relationships that would be valuable to a knowledge worker trying to understand the codebase, project, or domain.
@@ -0,0 +1,20 @@
1
+ Analyze the following content and extract entities and their relationships:
2
+
3
+ **File**: {{fileName}}
4
+ {{#when totalChunks ">" 1}}**Chunk**: {{chunkIndex}} of {{totalChunks}}{{/when}}
5
+
6
+ {{#if retrievedEntities}}
7
+ ## Previously Identified Context
8
+
9
+ {{#each retrievedEntities}}
10
+ - **{{name}}** ({{entityType}}): {{truncate (join observations "; ") 200}}
11
+ {{/each}}
12
+ {{/if}}
13
+
14
+ ## Content to Analyze
15
+
16
+ ```{{fileExtension}}
17
+ {{#if chunkContent}}{{chunkContent}}{{else}}{{fileContent}}{{/if}}
18
+ ```
19
+
20
+ Please extract all entities and relationships from this content, following the guidelines provided in the system prompt.