raglib-py 2.1.0__tar.gz → 2.2.0__tar.gz

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 (268) hide show
  1. {raglib_py-2.1.0 → raglib_py-2.2.0}/PKG-INFO +85 -31
  2. {raglib_py-2.1.0 → raglib_py-2.2.0}/README.md +82 -4
  3. {raglib_py-2.1.0 → raglib_py-2.2.0}/pyproject.toml +131 -142
  4. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/__init__.py +134 -126
  5. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/cli.py +22 -1
  6. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/generator.py +247 -234
  7. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/grader.py +4 -2
  8. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/multi_query_retriever.py +32 -0
  9. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/query_expander.py +6 -2
  10. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/sql_tool.py +11 -1
  11. raglib_py-2.2.0/raglib/core/parsing.py +121 -0
  12. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/embedding/embedding_factory.py +19 -4
  13. raglib_py-2.2.0/raglib/embedding/google_embedding.py +78 -0
  14. raglib_py-2.2.0/raglib/embedding/huggingface_embedding.py +62 -0
  15. raglib_py-2.2.0/raglib/embedding/ollama_embedding.py +59 -0
  16. raglib_py-2.2.0/raglib/embedding/openai_embedding.py +106 -0
  17. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/facade.py +1356 -1151
  18. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graph_context/engine.py +12 -2
  19. raglib_py-2.2.0/raglib/graphrag/background.py +182 -0
  20. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/extractor.py +211 -201
  21. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/indexer.py +362 -254
  22. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/search.py +8 -3
  23. raglib_py-2.2.0/raglib/llm/__init__.py +30 -0
  24. raglib_py-2.2.0/raglib/llm/clients.py +714 -0
  25. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/constants.py +40 -39
  26. raglib_py-2.2.0/raglib/llm/http.py +183 -0
  27. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/langchain_adapter.py +22 -171
  28. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/provider_detector.py +23 -16
  29. raglib_py-2.2.0/raglib/llm/providers.py +555 -0
  30. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/resilience.py +205 -195
  31. raglib_py-2.2.0/raglib/providers/duckduckgo_provider.py +125 -0
  32. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/corrective_rag.py +8 -0
  33. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/graph_rag.py +81 -70
  34. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/in_memory_store.py +77 -0
  35. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/pgvector_store.py +7 -7
  36. raglib_py-2.2.0/raglib/vision/anthropic_vision.py +41 -0
  37. raglib_py-2.2.0/raglib/vision/base_vision.py +27 -0
  38. raglib_py-2.2.0/raglib/vision/chat_vision.py +27 -0
  39. raglib_py-2.2.0/raglib/vision/google_vision.py +41 -0
  40. raglib_py-2.2.0/raglib/vision/openai_vision.py +41 -0
  41. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vision/vision_factory.py +2 -2
  42. raglib_py-2.1.0/raglib/core/parsing.py +0 -67
  43. raglib_py-2.1.0/raglib/embedding/google_embedding.py +0 -53
  44. raglib_py-2.1.0/raglib/embedding/huggingface_embedding.py +0 -56
  45. raglib_py-2.1.0/raglib/embedding/ollama_embedding.py +0 -62
  46. raglib_py-2.1.0/raglib/embedding/openai_embedding.py +0 -91
  47. raglib_py-2.1.0/raglib/llm/__init__.py +0 -6
  48. raglib_py-2.1.0/raglib/llm/providers.py +0 -205
  49. raglib_py-2.1.0/raglib/providers/duckduckgo_provider.py +0 -280
  50. raglib_py-2.1.0/raglib/vision/anthropic_vision.py +0 -82
  51. raglib_py-2.1.0/raglib/vision/base_vision.py +0 -16
  52. raglib_py-2.1.0/raglib/vision/google_vision.py +0 -75
  53. raglib_py-2.1.0/raglib/vision/openai_vision.py +0 -77
  54. raglib_py-2.1.0/site/README.md +0 -22
  55. raglib_py-2.1.0/site/node_modules/@babel/code-frame/LICENSE +0 -22
  56. raglib_py-2.1.0/site/node_modules/@babel/code-frame/README.md +0 -19
  57. raglib_py-2.1.0/site/node_modules/@babel/compat-data/LICENSE +0 -22
  58. raglib_py-2.1.0/site/node_modules/@babel/compat-data/README.md +0 -19
  59. raglib_py-2.1.0/site/node_modules/@babel/core/LICENSE +0 -22
  60. raglib_py-2.1.0/site/node_modules/@babel/core/README.md +0 -19
  61. raglib_py-2.1.0/site/node_modules/@babel/generator/LICENSE +0 -22
  62. raglib_py-2.1.0/site/node_modules/@babel/generator/README.md +0 -19
  63. raglib_py-2.1.0/site/node_modules/@babel/helper-compilation-targets/LICENSE +0 -22
  64. raglib_py-2.1.0/site/node_modules/@babel/helper-compilation-targets/README.md +0 -19
  65. raglib_py-2.1.0/site/node_modules/@babel/helper-globals/LICENSE +0 -22
  66. raglib_py-2.1.0/site/node_modules/@babel/helper-globals/README.md +0 -19
  67. raglib_py-2.1.0/site/node_modules/@babel/helper-module-imports/LICENSE +0 -22
  68. raglib_py-2.1.0/site/node_modules/@babel/helper-module-imports/README.md +0 -19
  69. raglib_py-2.1.0/site/node_modules/@babel/helper-module-transforms/LICENSE +0 -22
  70. raglib_py-2.1.0/site/node_modules/@babel/helper-module-transforms/README.md +0 -19
  71. raglib_py-2.1.0/site/node_modules/@babel/helper-plugin-utils/LICENSE +0 -22
  72. raglib_py-2.1.0/site/node_modules/@babel/helper-plugin-utils/README.md +0 -19
  73. raglib_py-2.1.0/site/node_modules/@babel/helper-string-parser/LICENSE +0 -22
  74. raglib_py-2.1.0/site/node_modules/@babel/helper-string-parser/README.md +0 -19
  75. raglib_py-2.1.0/site/node_modules/@babel/helper-validator-identifier/LICENSE +0 -22
  76. raglib_py-2.1.0/site/node_modules/@babel/helper-validator-identifier/README.md +0 -19
  77. raglib_py-2.1.0/site/node_modules/@babel/helper-validator-option/LICENSE +0 -22
  78. raglib_py-2.1.0/site/node_modules/@babel/helper-validator-option/README.md +0 -19
  79. raglib_py-2.1.0/site/node_modules/@babel/helpers/LICENSE +0 -23
  80. raglib_py-2.1.0/site/node_modules/@babel/helpers/README.md +0 -19
  81. raglib_py-2.1.0/site/node_modules/@babel/parser/LICENSE +0 -19
  82. raglib_py-2.1.0/site/node_modules/@babel/parser/README.md +0 -19
  83. raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-self/LICENSE +0 -22
  84. raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-self/README.md +0 -19
  85. raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-source/LICENSE +0 -22
  86. raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-source/README.md +0 -19
  87. raglib_py-2.1.0/site/node_modules/@babel/template/LICENSE +0 -22
  88. raglib_py-2.1.0/site/node_modules/@babel/template/README.md +0 -19
  89. raglib_py-2.1.0/site/node_modules/@babel/traverse/LICENSE +0 -22
  90. raglib_py-2.1.0/site/node_modules/@babel/traverse/README.md +0 -19
  91. raglib_py-2.1.0/site/node_modules/@babel/types/LICENSE +0 -22
  92. raglib_py-2.1.0/site/node_modules/@babel/types/README.md +0 -19
  93. raglib_py-2.1.0/site/node_modules/@esbuild/win32-x64/README.md +0 -3
  94. raglib_py-2.1.0/site/node_modules/@jridgewell/gen-mapping/LICENSE +0 -19
  95. raglib_py-2.1.0/site/node_modules/@jridgewell/gen-mapping/README.md +0 -227
  96. raglib_py-2.1.0/site/node_modules/@jridgewell/remapping/LICENSE +0 -19
  97. raglib_py-2.1.0/site/node_modules/@jridgewell/remapping/README.md +0 -218
  98. raglib_py-2.1.0/site/node_modules/@jridgewell/resolve-uri/LICENSE +0 -19
  99. raglib_py-2.1.0/site/node_modules/@jridgewell/resolve-uri/README.md +0 -40
  100. raglib_py-2.1.0/site/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -19
  101. raglib_py-2.1.0/site/node_modules/@jridgewell/sourcemap-codec/README.md +0 -264
  102. raglib_py-2.1.0/site/node_modules/@jridgewell/trace-mapping/LICENSE +0 -19
  103. raglib_py-2.1.0/site/node_modules/@jridgewell/trace-mapping/README.md +0 -348
  104. raglib_py-2.1.0/site/node_modules/@rolldown/pluginutils/LICENSE +0 -25
  105. raglib_py-2.1.0/site/node_modules/@rollup/rollup-win32-x64-gnu/README.md +0 -3
  106. raglib_py-2.1.0/site/node_modules/@rollup/rollup-win32-x64-msvc/README.md +0 -3
  107. raglib_py-2.1.0/site/node_modules/@types/babel__core/LICENSE +0 -21
  108. raglib_py-2.1.0/site/node_modules/@types/babel__core/README.md +0 -15
  109. raglib_py-2.1.0/site/node_modules/@types/babel__generator/LICENSE +0 -21
  110. raglib_py-2.1.0/site/node_modules/@types/babel__generator/README.md +0 -15
  111. raglib_py-2.1.0/site/node_modules/@types/babel__template/LICENSE +0 -21
  112. raglib_py-2.1.0/site/node_modules/@types/babel__template/README.md +0 -15
  113. raglib_py-2.1.0/site/node_modules/@types/babel__traverse/LICENSE +0 -21
  114. raglib_py-2.1.0/site/node_modules/@types/babel__traverse/README.md +0 -15
  115. raglib_py-2.1.0/site/node_modules/@types/estree/LICENSE +0 -21
  116. raglib_py-2.1.0/site/node_modules/@types/estree/README.md +0 -15
  117. raglib_py-2.1.0/site/node_modules/@types/prop-types/LICENSE +0 -21
  118. raglib_py-2.1.0/site/node_modules/@types/prop-types/README.md +0 -15
  119. raglib_py-2.1.0/site/node_modules/@types/react/LICENSE +0 -21
  120. raglib_py-2.1.0/site/node_modules/@types/react/README.md +0 -15
  121. raglib_py-2.1.0/site/node_modules/@types/react-dom/LICENSE +0 -21
  122. raglib_py-2.1.0/site/node_modules/@types/react-dom/README.md +0 -15
  123. raglib_py-2.1.0/site/node_modules/@vitejs/plugin-react/LICENSE +0 -21
  124. raglib_py-2.1.0/site/node_modules/@vitejs/plugin-react/README.md +0 -142
  125. raglib_py-2.1.0/site/node_modules/baseline-browser-mapping/README.md +0 -545
  126. raglib_py-2.1.0/site/node_modules/browserslist/LICENSE +0 -20
  127. raglib_py-2.1.0/site/node_modules/browserslist/README.md +0 -66
  128. raglib_py-2.1.0/site/node_modules/caniuse-lite/LICENSE +0 -395
  129. raglib_py-2.1.0/site/node_modules/caniuse-lite/README.md +0 -3
  130. raglib_py-2.1.0/site/node_modules/convert-source-map/LICENSE +0 -23
  131. raglib_py-2.1.0/site/node_modules/convert-source-map/README.md +0 -206
  132. raglib_py-2.1.0/site/node_modules/csstype/LICENSE +0 -19
  133. raglib_py-2.1.0/site/node_modules/csstype/README.md +0 -291
  134. raglib_py-2.1.0/site/node_modules/debug/LICENSE +0 -20
  135. raglib_py-2.1.0/site/node_modules/debug/README.md +0 -481
  136. raglib_py-2.1.0/site/node_modules/electron-to-chromium/LICENSE +0 -5
  137. raglib_py-2.1.0/site/node_modules/electron-to-chromium/README.md +0 -186
  138. raglib_py-2.1.0/site/node_modules/esbuild/README.md +0 -3
  139. raglib_py-2.1.0/site/node_modules/gensync/LICENSE +0 -7
  140. raglib_py-2.1.0/site/node_modules/gensync/README.md +0 -196
  141. raglib_py-2.1.0/site/node_modules/js-tokens/LICENSE +0 -21
  142. raglib_py-2.1.0/site/node_modules/js-tokens/README.md +0 -240
  143. raglib_py-2.1.0/site/node_modules/jsesc/README.md +0 -422
  144. raglib_py-2.1.0/site/node_modules/json5/README.md +0 -282
  145. raglib_py-2.1.0/site/node_modules/loose-envify/LICENSE +0 -21
  146. raglib_py-2.1.0/site/node_modules/loose-envify/README.md +0 -45
  147. raglib_py-2.1.0/site/node_modules/lru-cache/LICENSE +0 -15
  148. raglib_py-2.1.0/site/node_modules/lru-cache/README.md +0 -166
  149. raglib_py-2.1.0/site/node_modules/nanoid/LICENSE +0 -20
  150. raglib_py-2.1.0/site/node_modules/nanoid/README.md +0 -39
  151. raglib_py-2.1.0/site/node_modules/node-releases/LICENSE +0 -21
  152. raglib_py-2.1.0/site/node_modules/node-releases/README.md +0 -32
  153. raglib_py-2.1.0/site/node_modules/picocolors/LICENSE +0 -15
  154. raglib_py-2.1.0/site/node_modules/picocolors/README.md +0 -21
  155. raglib_py-2.1.0/site/node_modules/postcss/LICENSE +0 -20
  156. raglib_py-2.1.0/site/node_modules/postcss/README.md +0 -27
  157. raglib_py-2.1.0/site/node_modules/react/LICENSE +0 -21
  158. raglib_py-2.1.0/site/node_modules/react/README.md +0 -37
  159. raglib_py-2.1.0/site/node_modules/react-dom/LICENSE +0 -21
  160. raglib_py-2.1.0/site/node_modules/react-dom/README.md +0 -60
  161. raglib_py-2.1.0/site/node_modules/react-refresh/LICENSE +0 -21
  162. raglib_py-2.1.0/site/node_modules/react-refresh/README.md +0 -5
  163. raglib_py-2.1.0/site/node_modules/rollup/README.md +0 -134
  164. raglib_py-2.1.0/site/node_modules/scheduler/LICENSE +0 -21
  165. raglib_py-2.1.0/site/node_modules/scheduler/README.md +0 -9
  166. raglib_py-2.1.0/site/node_modules/semver/LICENSE +0 -15
  167. raglib_py-2.1.0/site/node_modules/semver/README.md +0 -443
  168. raglib_py-2.1.0/site/node_modules/source-map-js/LICENSE +0 -28
  169. raglib_py-2.1.0/site/node_modules/source-map-js/README.md +0 -765
  170. raglib_py-2.1.0/site/node_modules/typescript/README.md +0 -50
  171. raglib_py-2.1.0/site/node_modules/update-browserslist-db/LICENSE +0 -20
  172. raglib_py-2.1.0/site/node_modules/update-browserslist-db/README.md +0 -41
  173. raglib_py-2.1.0/site/node_modules/vite/README.md +0 -20
  174. raglib_py-2.1.0/site/node_modules/yallist/LICENSE +0 -15
  175. raglib_py-2.1.0/site/node_modules/yallist/README.md +0 -204
  176. {raglib_py-2.1.0 → raglib_py-2.2.0}/.gitignore +0 -0
  177. {raglib_py-2.1.0 → raglib_py-2.2.0}/LICENSE +0 -0
  178. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/__main__.py +0 -0
  179. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/__init__.py +0 -0
  180. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/bm25.py +0 -0
  181. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/context_reducer.py +0 -0
  182. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/decision.py +0 -0
  183. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/deduplicator.py +0 -0
  184. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/evaluator.py +0 -0
  185. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/hybrid_retriever.py +0 -0
  186. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/memory.py +0 -0
  187. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/multi_hop_retriever.py +0 -0
  188. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/planner.py +0 -0
  189. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/query_rewriter.py +0 -0
  190. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/refiner.py +0 -0
  191. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/reflection.py +0 -0
  192. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/reranker.py +0 -0
  193. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/retriever.py +0 -0
  194. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/router_retriever.py +0 -0
  195. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/tools.py +0 -0
  196. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/components/web_retriever.py +0 -0
  197. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/constants.py +0 -0
  198. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/__init__.py +0 -0
  199. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/base.py +0 -0
  200. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/concurrency.py +0 -0
  201. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/fusion.py +0 -0
  202. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/intents.py +0 -0
  203. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/runtime.py +0 -0
  204. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/text.py +0 -0
  205. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/core/tracing.py +0 -0
  206. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/embedding/__init__.py +0 -0
  207. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/embedding/base_embedding.py +0 -0
  208. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/embedding/cached_embedding.py +0 -0
  209. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/embedding/mock_embedding.py +0 -0
  210. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/eval/__init__.py +0 -0
  211. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graph_context/__init__.py +0 -0
  212. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graph_context/schemas.py +0 -0
  213. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/__init__.py +0 -0
  214. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/communities.py +0 -0
  215. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/schemas.py +0 -0
  216. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/store/__init__.py +0 -0
  217. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/store/base.py +0 -0
  218. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/store/neo4j_store.py +0 -0
  219. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/graphrag/store/networkx_store.py +0 -0
  220. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/base_client.py +0 -0
  221. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/llm/mock_client.py +0 -0
  222. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/__init__.py +0 -0
  223. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/chunk_splitter.py +0 -0
  224. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/document_loader.py +0 -0
  225. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/exceptions.py +0 -0
  226. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/html_text.py +0 -0
  227. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/pdf_loader.py +0 -0
  228. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/pptx_loader.py +0 -0
  229. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/structured_loaders.py +0 -0
  230. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/text_loader.py +0 -0
  231. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/web_loader.py +0 -0
  232. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/loaders/word_loader.py +0 -0
  233. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/preprocessing/__init__.py +0 -0
  234. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/preprocessing/chunk_splitter.py +0 -0
  235. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/__init__.py +0 -0
  236. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/base_provider.py +0 -0
  237. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/bing_provider.py +0 -0
  238. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/brave_provider.py +0 -0
  239. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/exa_provider.py +0 -0
  240. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/factory.py +0 -0
  241. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/google_cse_provider.py +0 -0
  242. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/searxng_provider.py +0 -0
  243. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/serpapi_provider.py +0 -0
  244. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/providers/tavily_provider.py +0 -0
  245. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/quick.py +0 -0
  246. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/__init__.py +0 -0
  247. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/advanced_rag.py +0 -0
  248. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/agentic_rag.py +0 -0
  249. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/hybrid_rag.py +0 -0
  250. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/memory_rag.py +0 -0
  251. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/multi_hop_rag.py +0 -0
  252. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/multi_query_rag.py +0 -0
  253. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/naive_rag.py +0 -0
  254. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/routing_rag.py +0 -0
  255. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/self_rag.py +0 -0
  256. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/tool_augmented_rag.py +0 -0
  257. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/rag_types/web_rag.py +0 -0
  258. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/schemas.py +0 -0
  259. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/session/__init__.py +0 -0
  260. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/session/interactive.py +0 -0
  261. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/__init__.py +0 -0
  262. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/base_store.py +0 -0
  263. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/chroma_store.py +0 -0
  264. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/factory.py +0 -0
  265. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vectorstores/qdrant_store.py +0 -0
  266. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vision/__init__.py +0 -0
  267. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/vision/mock_vision.py +0 -0
  268. {raglib_py-2.1.0 → raglib_py-2.2.0}/raglib/visualize.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: raglib-py
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines
5
5
  Project-URL: Homepage, https://github.com/himanshuhs9011/raglib
6
6
  Project-URL: Documentation, https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md
@@ -44,13 +44,6 @@ Requires-Python: >=3.9
44
44
  Provides-Extra: all
45
45
  Requires-Dist: chromadb>=0.5.0; extra == 'all'
46
46
  Requires-Dist: ddgs>=6.0.0; extra == 'all'
47
- Requires-Dist: langchain-anthropic>=0.1.0; extra == 'all'
48
- Requires-Dist: langchain-core>=0.2.0; extra == 'all'
49
- Requires-Dist: langchain-google-genai>=1.0.0; extra == 'all'
50
- Requires-Dist: langchain-groq>=0.1.0; extra == 'all'
51
- Requires-Dist: langchain-huggingface>=0.0.3; extra == 'all'
52
- Requires-Dist: langchain-ollama>=0.1.0; extra == 'all'
53
- Requires-Dist: langchain-openai>=0.1.0; extra == 'all'
54
47
  Requires-Dist: networkx>=3.0; extra == 'all'
55
48
  Requires-Dist: numpy>=1.24; extra == 'all'
56
49
  Requires-Dist: openpyxl>=3.1; extra == 'all'
@@ -60,15 +53,7 @@ Requires-Dist: python-pptx>=0.6.21; extra == 'all'
60
53
  Requires-Dist: sentence-transformers>=2.6.0; extra == 'all'
61
54
  Requires-Dist: tiktoken>=0.5.0; extra == 'all'
62
55
  Provides-Extra: all-llm
63
- Requires-Dist: langchain-anthropic>=0.1.0; extra == 'all-llm'
64
- Requires-Dist: langchain-core>=0.2.0; extra == 'all-llm'
65
- Requires-Dist: langchain-google-genai>=1.0.0; extra == 'all-llm'
66
- Requires-Dist: langchain-groq>=0.1.0; extra == 'all-llm'
67
- Requires-Dist: langchain-ollama>=0.1.0; extra == 'all-llm'
68
- Requires-Dist: langchain-openai>=0.1.0; extra == 'all-llm'
69
56
  Provides-Extra: anthropic
70
- Requires-Dist: langchain-anthropic>=0.1.0; extra == 'anthropic'
71
- Requires-Dist: langchain-core>=0.2.0; extra == 'anthropic'
72
57
  Provides-Extra: chroma
73
58
  Requires-Dist: chromadb>=0.5.0; extra == 'chroma'
74
59
  Provides-Extra: cohere
@@ -87,16 +72,13 @@ Provides-Extra: fast
87
72
  Requires-Dist: numpy>=1.24; extra == 'fast'
88
73
  Requires-Dist: tiktoken>=0.5.0; extra == 'fast'
89
74
  Provides-Extra: google
90
- Requires-Dist: langchain-core>=0.2.0; extra == 'google'
91
- Requires-Dist: langchain-google-genai>=1.0.0; extra == 'google'
92
75
  Provides-Extra: graph
93
76
  Requires-Dist: networkx>=3.0; extra == 'graph'
94
77
  Provides-Extra: groq
95
- Requires-Dist: langchain-core>=0.2.0; extra == 'groq'
96
- Requires-Dist: langchain-groq>=0.1.0; extra == 'groq'
97
78
  Provides-Extra: hf
98
- Requires-Dist: langchain-huggingface>=0.0.3; extra == 'hf'
99
79
  Requires-Dist: sentence-transformers>=2.6.0; extra == 'hf'
80
+ Provides-Extra: langchain
81
+ Requires-Dist: langchain-core>=0.2.0; extra == 'langchain'
100
82
  Provides-Extra: leiden
101
83
  Requires-Dist: graspologic>=3.3; extra == 'leiden'
102
84
  Requires-Dist: networkx>=3.0; extra == 'leiden'
@@ -107,14 +89,8 @@ Provides-Extra: ocr
107
89
  Requires-Dist: pillow>=10.0.0; extra == 'ocr'
108
90
  Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
109
91
  Provides-Extra: ollama
110
- Requires-Dist: langchain-core>=0.2.0; extra == 'ollama'
111
- Requires-Dist: langchain-ollama>=0.1.0; extra == 'ollama'
112
92
  Provides-Extra: openai
113
- Requires-Dist: langchain-core>=0.2.0; extra == 'openai'
114
- Requires-Dist: langchain-openai>=0.1.0; extra == 'openai'
115
93
  Provides-Extra: openrouter
116
- Requires-Dist: langchain-core>=0.2.0; extra == 'openrouter'
117
- Requires-Dist: langchain-openai>=0.1.0; extra == 'openrouter'
118
94
  Provides-Extra: pdf
119
95
  Requires-Dist: pymupdf>=1.23.0; extra == 'pdf'
120
96
  Provides-Extra: pgvector
@@ -184,7 +160,8 @@ pip install raglib-py
184
160
  pip install "raglib-py[all]"
185
161
 
186
162
  # Or pick what you need:
187
- pip install "raglib-py[openai]" # also: anthropic, groq, google, ollama
163
+ # Chat and embedding providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq, Ollama, ...) need no extra:
164
+ # raglib calls their HTTP APIs directly. The [openai], [anthropic], ... extras still install (as no-ops).
188
165
  pip install "raglib-py[hf]" # local HuggingFace / SentenceTransformers embeddings
189
166
  pip install "raglib-py[rerank]" # cross-encoder reranker (bge-reranker)
190
167
  pip install "raglib-py[fast]" # numpy vector math + tiktoken token counting
@@ -544,6 +521,14 @@ rag.save("./graph_index") # graph + extraction cache + vectors
544
521
 
545
522
  Neo4j: `RAG(..., rag_type="graph", graph_store="neo4j", graph_kwargs={"store_options": {"uri": "bolt://localhost:7687", "user": "neo4j", "password": "...", "namespace": "papers"}})`.
546
523
 
524
+ **Indexing cost.** Building the graph takes one LLM call per chunk, plus one per community report. That is thousands of calls for a few hundred long documents, and indexing is the dominant GraphRAG cost. Use a cheaper or faster model for it with `graph_llm`; answers still use `llm`:
525
+
526
+ ```python
527
+ rag = RAG("docs/", rag_type="graph", llm="openai/gpt-4.1", graph_llm="openai/gpt-4.1-nano")
528
+ ```
529
+
530
+ `graph_llm` builds the graph (entity extraction, community reports, the global-search map step). Its key comes from `chat_api_key` only when it is the same provider, otherwise from its environment variable. With a reasoning model, turning thinking off for extraction is about 10× faster (see *Custom Providers*, `extra_body`).
531
+
547
532
  To give **agentic** or **routing** pipelines a `graph_search` tool / route, pass `enable_graph=True`.
548
533
 
549
534
  ---
@@ -664,11 +649,13 @@ Hosted OpenAI-compatible APIs only need `pip install "raglib-py[openai]"`.
664
649
  | **xAI Grok** | `"xai"` / `"grok"` | `grok-3-mini` | `XAI_API_KEY` | – |
665
650
  | **Perplexity** | `"perplexity"` | `sonar` | `PERPLEXITY_API_KEY` | – |
666
651
  | **Cerebras** | `"cerebras"` | `llama-3.3-70b` | `CEREBRAS_API_KEY` | – |
652
+ | **NVIDIA NIM** (build.nvidia.com or self-hosted via `NVIDIA_BASE_URL`) | `"nvidia"` / `"nim"` | `nvidia/nemotron-3.5-lightning-30b-a3b` | `NVIDIA_API_KEY` | yes (`nvidia/nemotron-3-embed-1b`); OCR with `nvidia/nemotron-3.5-super-vl-120b-a12b` |
667
653
  | **Azure OpenAI** | `"azure/<deployment>"` | – | `AZURE_OPENAI_API_KEY` + `AZURE_OPENAI_ENDPOINT` | yes (deployment) |
668
654
  | **Ollama** (local) | `"ollama"` | `llama3.1` | – | yes |
669
655
  | **LM Studio** (local) | `"lmstudio/<model>"` | – | – | with `embedding_model` |
670
656
  | **vLLM** (self-hosted) | `"vllm/<model>"` + `chat_base_url` | – | – | with `embedding_model` |
671
657
  | **Any OpenAI-compatible API** | `"openai_compatible/<model>"` + `chat_base_url` | – | `OPENAI_COMPATIBLE_API_KEY` | with `embedding_model` |
658
+ | **Your own provider** (`register_provider` / JSON file) | `"<id>/<model>"` | first listed model | your choice | with `embedding_model` |
672
659
  | **Any LangChain chat model / `BaseLLMClient`** | the object | – | – | – |
673
660
  | **Mock (offline)** | `"mock"` or `offline=True` | templated | – | mock |
674
661
 
@@ -688,6 +675,73 @@ rag = RAG("docs/", llm="vllm/Qwen/Qwen2.5-7B-Instruct", chat_base_url="http://gp
688
675
 
689
676
  All provider calls get a timeout (`llm_timeout`), retries with jittered exponential backoff on rate limits / 5xx (`llm_max_retries`) and an LRU response cache (`llm_cache`).
690
677
 
678
+ raglib needs no SDK and no LangChain for any of these providers. `raglib.llm.clients` speaks the three wire protocols directly with the Python standard library: **OpenAI Chat Completions** (OpenAI, Azure, Groq, Ollama, OpenRouter and every other compatible API), **Anthropic Messages** and **Gemini `generateContent`**, including SSE streaming, JSON mode and real token usage. Build one directly with `from raglib.llm import build_chat_client; llm = build_chat_client("anthropic")`. A LangChain chat model you already have still works: pass it as `chat_llm=` and raglib wraps it with its retries and usage tracking.
679
+
680
+ ### Custom Providers (any third-party or self-hosted API)
681
+
682
+ Register any provider that speaks one of the three supported APIs (`openai` Chat Completions, `anthropic` Messages, `gemini` generateContent), then use it like a built-in one:
683
+
684
+ ```python
685
+ from raglib import RAG, register_provider
686
+
687
+ register_provider(
688
+ "myprovider", # lowercase letters, numbers, - or _
689
+ name="My AI Provider", # shown by `raglib providers`
690
+ api="openai", # "openai" | "anthropic" | "gemini"
691
+ base_url="https://api.myprovider.com/v1",
692
+ api_key="{env:MYPROVIDER_API_KEY}", # optional; leave out when auth is in headers
693
+ headers={"X-Team": "{env:MY_TEAM_ID}"}, # optional extra headers ({env:NAME} is expanded)
694
+ models=[
695
+ {"id": "model-id", "name": "Display Name"},
696
+ {"id": "model-r1", "name": "Reasoner", "reasoning": True},
697
+ {"id": "model-vl", "name": "Vision", "image": True},
698
+ ],
699
+ embedding_model="embed-v1", # optional: semantic search through the same provider
700
+ )
701
+
702
+ rag = RAG("docs/", llm="myprovider/model-id") # or llm="myprovider" for the first listed model
703
+ ```
704
+
705
+ | Model flag | Effect |
706
+ | :--- | :--- |
707
+ | `reasoning: true` | No `temperature` is sent (many reasoning endpoints reject it). A leading `<think>...</think>` block is removed from answers and streams for every model, so citations and JSON parsing keep working. |
708
+ | `image: true` | The model can read scanned PDF pages: it is used for OCR when it is the chat model, or with `vision_llm="myprovider/model-vl"`. |
709
+
710
+ Models you don't list still work (`llm="myprovider/any-model"`). The list sets the default model and the flags.
711
+
712
+ Reasoning models spend completion tokens on thinking before they answer. A small `llm_max_tokens` can be used up entirely by the thinking, which leaves the answer empty, so leave it unset or generous for these models.
713
+
714
+ More options for servers with their own conventions:
715
+
716
+ | Option | Example | Use |
717
+ | :--- | :--- | :--- |
718
+ | `extra_body` | `{"chat_template_kwargs": {"enable_thinking": False}}` | Extra JSON fields for every chat request (vLLM / NVIDIA NIM sampling or template options). Turning thinking off for NVIDIA Nemotron cut a lookup answer from 357 to 10 completion tokens and from 2.7 s to 0.5 s in testing. |
719
+ | `embedding_input_types` | `["passage", "query"]` | Asymmetric embedding models that require an `input_type` field: documents get the first value, search queries the second. |
720
+ | `embedding_params` | `{"truncate": "END"}` | Extra JSON fields for embedding requests. |
721
+ | `stream_usage` | `true` | The server accepts `stream_options.include_usage`, so streamed answers report real token counts. |
722
+
723
+ **From a JSON file** (no code). Use `load_providers("providers.json")`, set `RAGLIB_PROVIDERS_FILE=providers.json`, or pass `raglib ask ... --providers providers.json`:
724
+
725
+ ```json
726
+ {
727
+ "providers": {
728
+ "myprovider": {
729
+ "name": "My AI Provider",
730
+ "api": "openai",
731
+ "base_url": "https://api.myprovider.com/v1",
732
+ "api_key": "{env:MYPROVIDER_API_KEY}",
733
+ "headers": {"X-Team": "search"},
734
+ "models": {
735
+ "model-id": {"name": "Display Name", "reasoning": false, "image": false}
736
+ },
737
+ "embedding_model": "embed-v1"
738
+ }
739
+ }
740
+ }
741
+ ```
742
+
743
+ Keep keys out of the file with `{env:NAME}`; raglib warns when a file holds a literal key. A key given for one provider is never sent to another provider's host. Built-in provider ids can't be redefined, and `raglib providers` lists custom providers with their models.
744
+
691
745
  ### Supported Embedding Providers (`embedding_llm`)
692
746
 
693
747
  | Provider | `embedding_llm` Value | Default Model | Notes |
@@ -774,13 +828,13 @@ rag.chat() # interactive terminal session with memory
774
828
  ```python
775
829
  from raglib import RAG
776
830
  from raglib.eval import evaluate
777
- from raglib.llm.langchain_adapter import LangChainAdapter
831
+ from raglib.llm import build_chat_client
778
832
 
779
833
  rag = RAG("docs/", chat_llm="openai", embedding_llm="openai")
780
834
  dataset = [
781
835
  {"question": "What is the refund window?", "relevant_ids": ["docs/refunds.md"], "reference": "30 days"},
782
836
  ]
783
- judge = LangChainAdapter.build("openai", model_name="gpt-4.1") # use a strong judge model
837
+ judge = build_chat_client("openai", model_name="gpt-4.1") # use a strong judge model
784
838
  report = evaluate(rag, dataset, judge_llm=judge, k=5)
785
839
  print(report) # hit_rate@5, mrr@5, recall@5, ndcg@5, faithfulness, answer_relevance, context_precision, correctness, latency_ms
786
840
  ```
@@ -810,7 +864,7 @@ corpus = [
810
864
  Document(id="d2", content="Corrective RAG grades chunks and refines knowledge strips."),
811
865
  ]
812
866
 
813
- llm = MockLLMClient() # use LangChainAdapter.build("openai") in production
867
+ llm = MockLLMClient() # use build_chat_client("openai") in production
814
868
  pipeline = CorrectiveRAG(
815
869
  retriever=Retriever(documents=corpus, top_k=4), # BM25 only; pass embedding=... for hybrid
816
870
  grader=RelevanceGrader(llm_client=llm),
@@ -47,7 +47,8 @@ pip install raglib-py
47
47
  pip install "raglib-py[all]"
48
48
 
49
49
  # Or pick what you need:
50
- pip install "raglib-py[openai]" # also: anthropic, groq, google, ollama
50
+ # Chat and embedding providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq, Ollama, ...) need no extra:
51
+ # raglib calls their HTTP APIs directly. The [openai], [anthropic], ... extras still install (as no-ops).
51
52
  pip install "raglib-py[hf]" # local HuggingFace / SentenceTransformers embeddings
52
53
  pip install "raglib-py[rerank]" # cross-encoder reranker (bge-reranker)
53
54
  pip install "raglib-py[fast]" # numpy vector math + tiktoken token counting
@@ -407,6 +408,14 @@ rag.save("./graph_index") # graph + extraction cache + vectors
407
408
 
408
409
  Neo4j: `RAG(..., rag_type="graph", graph_store="neo4j", graph_kwargs={"store_options": {"uri": "bolt://localhost:7687", "user": "neo4j", "password": "...", "namespace": "papers"}})`.
409
410
 
411
+ **Indexing cost.** Building the graph takes one LLM call per chunk, plus one per community report. That is thousands of calls for a few hundred long documents, and indexing is the dominant GraphRAG cost. Use a cheaper or faster model for it with `graph_llm`; answers still use `llm`:
412
+
413
+ ```python
414
+ rag = RAG("docs/", rag_type="graph", llm="openai/gpt-4.1", graph_llm="openai/gpt-4.1-nano")
415
+ ```
416
+
417
+ `graph_llm` builds the graph (entity extraction, community reports, the global-search map step). Its key comes from `chat_api_key` only when it is the same provider, otherwise from its environment variable. With a reasoning model, turning thinking off for extraction is about 10× faster (see *Custom Providers*, `extra_body`).
418
+
410
419
  To give **agentic** or **routing** pipelines a `graph_search` tool / route, pass `enable_graph=True`.
411
420
 
412
421
  ---
@@ -527,11 +536,13 @@ Hosted OpenAI-compatible APIs only need `pip install "raglib-py[openai]"`.
527
536
  | **xAI Grok** | `"xai"` / `"grok"` | `grok-3-mini` | `XAI_API_KEY` | – |
528
537
  | **Perplexity** | `"perplexity"` | `sonar` | `PERPLEXITY_API_KEY` | – |
529
538
  | **Cerebras** | `"cerebras"` | `llama-3.3-70b` | `CEREBRAS_API_KEY` | – |
539
+ | **NVIDIA NIM** (build.nvidia.com or self-hosted via `NVIDIA_BASE_URL`) | `"nvidia"` / `"nim"` | `nvidia/nemotron-3.5-lightning-30b-a3b` | `NVIDIA_API_KEY` | yes (`nvidia/nemotron-3-embed-1b`); OCR with `nvidia/nemotron-3.5-super-vl-120b-a12b` |
530
540
  | **Azure OpenAI** | `"azure/<deployment>"` | – | `AZURE_OPENAI_API_KEY` + `AZURE_OPENAI_ENDPOINT` | yes (deployment) |
531
541
  | **Ollama** (local) | `"ollama"` | `llama3.1` | – | yes |
532
542
  | **LM Studio** (local) | `"lmstudio/<model>"` | – | – | with `embedding_model` |
533
543
  | **vLLM** (self-hosted) | `"vllm/<model>"` + `chat_base_url` | – | – | with `embedding_model` |
534
544
  | **Any OpenAI-compatible API** | `"openai_compatible/<model>"` + `chat_base_url` | – | `OPENAI_COMPATIBLE_API_KEY` | with `embedding_model` |
545
+ | **Your own provider** (`register_provider` / JSON file) | `"<id>/<model>"` | first listed model | your choice | with `embedding_model` |
535
546
  | **Any LangChain chat model / `BaseLLMClient`** | the object | – | – | – |
536
547
  | **Mock (offline)** | `"mock"` or `offline=True` | templated | – | mock |
537
548
 
@@ -551,6 +562,73 @@ rag = RAG("docs/", llm="vllm/Qwen/Qwen2.5-7B-Instruct", chat_base_url="http://gp
551
562
 
552
563
  All provider calls get a timeout (`llm_timeout`), retries with jittered exponential backoff on rate limits / 5xx (`llm_max_retries`) and an LRU response cache (`llm_cache`).
553
564
 
565
+ raglib needs no SDK and no LangChain for any of these providers. `raglib.llm.clients` speaks the three wire protocols directly with the Python standard library: **OpenAI Chat Completions** (OpenAI, Azure, Groq, Ollama, OpenRouter and every other compatible API), **Anthropic Messages** and **Gemini `generateContent`**, including SSE streaming, JSON mode and real token usage. Build one directly with `from raglib.llm import build_chat_client; llm = build_chat_client("anthropic")`. A LangChain chat model you already have still works: pass it as `chat_llm=` and raglib wraps it with its retries and usage tracking.
566
+
567
+ ### Custom Providers (any third-party or self-hosted API)
568
+
569
+ Register any provider that speaks one of the three supported APIs (`openai` Chat Completions, `anthropic` Messages, `gemini` generateContent), then use it like a built-in one:
570
+
571
+ ```python
572
+ from raglib import RAG, register_provider
573
+
574
+ register_provider(
575
+ "myprovider", # lowercase letters, numbers, - or _
576
+ name="My AI Provider", # shown by `raglib providers`
577
+ api="openai", # "openai" | "anthropic" | "gemini"
578
+ base_url="https://api.myprovider.com/v1",
579
+ api_key="{env:MYPROVIDER_API_KEY}", # optional; leave out when auth is in headers
580
+ headers={"X-Team": "{env:MY_TEAM_ID}"}, # optional extra headers ({env:NAME} is expanded)
581
+ models=[
582
+ {"id": "model-id", "name": "Display Name"},
583
+ {"id": "model-r1", "name": "Reasoner", "reasoning": True},
584
+ {"id": "model-vl", "name": "Vision", "image": True},
585
+ ],
586
+ embedding_model="embed-v1", # optional: semantic search through the same provider
587
+ )
588
+
589
+ rag = RAG("docs/", llm="myprovider/model-id") # or llm="myprovider" for the first listed model
590
+ ```
591
+
592
+ | Model flag | Effect |
593
+ | :--- | :--- |
594
+ | `reasoning: true` | No `temperature` is sent (many reasoning endpoints reject it). A leading `<think>...</think>` block is removed from answers and streams for every model, so citations and JSON parsing keep working. |
595
+ | `image: true` | The model can read scanned PDF pages: it is used for OCR when it is the chat model, or with `vision_llm="myprovider/model-vl"`. |
596
+
597
+ Models you don't list still work (`llm="myprovider/any-model"`). The list sets the default model and the flags.
598
+
599
+ Reasoning models spend completion tokens on thinking before they answer. A small `llm_max_tokens` can be used up entirely by the thinking, which leaves the answer empty, so leave it unset or generous for these models.
600
+
601
+ More options for servers with their own conventions:
602
+
603
+ | Option | Example | Use |
604
+ | :--- | :--- | :--- |
605
+ | `extra_body` | `{"chat_template_kwargs": {"enable_thinking": False}}` | Extra JSON fields for every chat request (vLLM / NVIDIA NIM sampling or template options). Turning thinking off for NVIDIA Nemotron cut a lookup answer from 357 to 10 completion tokens and from 2.7 s to 0.5 s in testing. |
606
+ | `embedding_input_types` | `["passage", "query"]` | Asymmetric embedding models that require an `input_type` field: documents get the first value, search queries the second. |
607
+ | `embedding_params` | `{"truncate": "END"}` | Extra JSON fields for embedding requests. |
608
+ | `stream_usage` | `true` | The server accepts `stream_options.include_usage`, so streamed answers report real token counts. |
609
+
610
+ **From a JSON file** (no code). Use `load_providers("providers.json")`, set `RAGLIB_PROVIDERS_FILE=providers.json`, or pass `raglib ask ... --providers providers.json`:
611
+
612
+ ```json
613
+ {
614
+ "providers": {
615
+ "myprovider": {
616
+ "name": "My AI Provider",
617
+ "api": "openai",
618
+ "base_url": "https://api.myprovider.com/v1",
619
+ "api_key": "{env:MYPROVIDER_API_KEY}",
620
+ "headers": {"X-Team": "search"},
621
+ "models": {
622
+ "model-id": {"name": "Display Name", "reasoning": false, "image": false}
623
+ },
624
+ "embedding_model": "embed-v1"
625
+ }
626
+ }
627
+ }
628
+ ```
629
+
630
+ Keep keys out of the file with `{env:NAME}`; raglib warns when a file holds a literal key. A key given for one provider is never sent to another provider's host. Built-in provider ids can't be redefined, and `raglib providers` lists custom providers with their models.
631
+
554
632
  ### Supported Embedding Providers (`embedding_llm`)
555
633
 
556
634
  | Provider | `embedding_llm` Value | Default Model | Notes |
@@ -637,13 +715,13 @@ rag.chat() # interactive terminal session with memory
637
715
  ```python
638
716
  from raglib import RAG
639
717
  from raglib.eval import evaluate
640
- from raglib.llm.langchain_adapter import LangChainAdapter
718
+ from raglib.llm import build_chat_client
641
719
 
642
720
  rag = RAG("docs/", chat_llm="openai", embedding_llm="openai")
643
721
  dataset = [
644
722
  {"question": "What is the refund window?", "relevant_ids": ["docs/refunds.md"], "reference": "30 days"},
645
723
  ]
646
- judge = LangChainAdapter.build("openai", model_name="gpt-4.1") # use a strong judge model
724
+ judge = build_chat_client("openai", model_name="gpt-4.1") # use a strong judge model
647
725
  report = evaluate(rag, dataset, judge_llm=judge, k=5)
648
726
  print(report) # hit_rate@5, mrr@5, recall@5, ndcg@5, faithfulness, answer_relevance, context_precision, correctness, latency_ms
649
727
  ```
@@ -673,7 +751,7 @@ corpus = [
673
751
  Document(id="d2", content="Corrective RAG grades chunks and refines knowledge strips."),
674
752
  ]
675
753
 
676
- llm = MockLLMClient() # use LangChainAdapter.build("openai") in production
754
+ llm = MockLLMClient() # use build_chat_client("openai") in production
677
755
  pipeline = CorrectiveRAG(
678
756
  retriever=Retriever(documents=corpus, top_k=4), # BM25 only; pass embedding=... for hybrid
679
757
  grader=RelevanceGrader(llm_client=llm),
@@ -1,142 +1,131 @@
1
- [build-system]
2
- requires = ["hatchling>=1.25.0"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "raglib-py"
7
- version = "2.1.0"
8
- description = "Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines"
9
- readme = "README.md"
10
- license = { file = "LICENSE" }
11
- authors = [
12
- { name = "raglib maintainers" }
13
- ]
14
- requires-python = ">=3.9"
15
- # The core is pure Python (BM25, in-memory vectors, all pipelines). Everything else is an extra.
16
- dependencies = []
17
- keywords = ["rag", "llm", "retrieval", "ai", "nlp", "vector-search", "graphrag", "hybrid-search"]
18
- classifiers = [
19
- "Development Status :: 4 - Beta",
20
- "Intended Audience :: Developers",
21
- "License :: OSI Approved :: MIT License",
22
- "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.9",
24
- "Programming Language :: Python :: 3.10",
25
- "Programming Language :: Python :: 3.11",
26
- "Programming Language :: Python :: 3.12",
27
- "Programming Language :: Python :: 3.13",
28
- "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
- ]
30
-
31
- [project.scripts]
32
- raglib = "raglib.cli:main"
33
-
34
- [project.urls]
35
- Homepage = "https://github.com/himanshuhs9011/raglib"
36
- Documentation = "https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md"
37
- Repository = "https://github.com/himanshuhs9011/raglib"
38
- "Bug Tracker" = "https://github.com/himanshuhs9011/raglib/issues"
39
-
40
- [project.optional-dependencies]
41
- # chat / embedding providers
42
- # "openai" also covers OpenRouter, DeepSeek, Mistral, Together, Fireworks, xAI, Perplexity,
43
- # Cerebras, Azure OpenAI, LM Studio, vLLM and any other OpenAI-compatible API.
44
- openai = ["langchain-core>=0.2.0", "langchain-openai>=0.1.0"]
45
- openrouter = ["langchain-core>=0.2.0", "langchain-openai>=0.1.0"]
46
- anthropic = ["langchain-core>=0.2.0", "langchain-anthropic>=0.1.0"]
47
- groq = ["langchain-core>=0.2.0", "langchain-groq>=0.1.0"]
48
- google = ["langchain-core>=0.2.0", "langchain-google-genai>=1.0.0"]
49
- ollama = ["langchain-core>=0.2.0", "langchain-ollama>=0.1.0"]
50
- hf = ["langchain-huggingface>=0.0.3", "sentence-transformers>=2.6.0"]
51
- # retrieval quality
52
- rerank = ["sentence-transformers>=2.6.0"]
53
- cohere = ["cohere>=5.0.0"]
54
- fast = ["numpy>=1.24", "tiktoken>=0.5.0"]
55
- # storage
56
- chroma = ["chromadb>=0.5.0"]
57
- qdrant = ["qdrant-client>=1.10.0"]
58
- pgvector = ["psycopg[binary]>=3.1"]
59
- graph = ["networkx>=3.0"]
60
- leiden = ["networkx>=3.0", "graspologic>=3.3"]
61
- neo4j = ["neo4j>=5.0", "networkx>=3.0"]
62
- # loaders
63
- pdf = ["PyMuPDF>=1.23.0"]
64
- docx = ["python-docx>=1.0.0"]
65
- pptx = ["python-pptx>=0.6.21"]
66
- xlsx = ["openpyxl>=3.1"]
67
- ocr = ["pytesseract>=0.3.10", "Pillow>=10.0.0"]
68
- # web search
69
- web = ["ddgs>=6.0.0"]
70
- tavily = ["tavily-python>=0.2.0"]
71
- serpapi = ["google-search-results>=2.4.0"]
72
- # bundles
73
- all-llm = [
74
- "langchain-core>=0.2.0",
75
- "langchain-openai>=0.1.0",
76
- "langchain-anthropic>=0.1.0",
77
- "langchain-groq>=0.1.0",
78
- "langchain-google-genai>=1.0.0",
79
- "langchain-ollama>=0.1.0",
80
- ]
81
- all = [
82
- "langchain-core>=0.2.0",
83
- "langchain-openai>=0.1.0",
84
- "langchain-anthropic>=0.1.0",
85
- "langchain-groq>=0.1.0",
86
- "langchain-google-genai>=1.0.0",
87
- "langchain-ollama>=0.1.0",
88
- "langchain-huggingface>=0.0.3",
89
- "sentence-transformers>=2.6.0",
90
- "numpy>=1.24",
91
- "tiktoken>=0.5.0",
92
- "chromadb>=0.5.0",
93
- "networkx>=3.0",
94
- "PyMuPDF>=1.23.0",
95
- "python-docx>=1.0.0",
96
- "python-pptx>=0.6.21",
97
- "openpyxl>=3.1",
98
- "ddgs>=6.0.0",
99
- ]
100
- dev = [
101
- "pytest>=7.4.0",
102
- "pytest-cov>=4.1.0",
103
- "ruff>=0.5.0",
104
- "build>=1.0.0",
105
- "twine>=4.0.0",
106
- "networkx>=3.0",
107
- "mypy>=1.8",
108
- ]
109
-
110
- [tool.hatch.build.targets.wheel]
111
- packages = ["raglib"]
112
-
113
- [tool.hatch.build.targets.sdist]
114
- include = [
115
- "raglib/**/*.py",
116
- "README.md",
117
- "LICENSE",
118
- "pyproject.toml",
119
- ]
120
-
121
- [tool.ruff]
122
- target-version = "py39"
123
- line-length = 130
124
- extend-exclude = ["site", "dist"]
125
-
126
- [tool.ruff.lint]
127
- # pyflakes, pycodestyle errors, import sorting, bugbear-lite. Pyupgrade (UP) rules are off:
128
- # typing.List/Optional are kept deliberately for Python 3.9 support.
129
- select = ["E", "F", "I", "B006", "B008", "B904"]
130
- ignore = ["E501", "E731", "E741", "E402"]
131
-
132
- [tool.mypy]
133
- python_version = "3.9"
134
- ignore_missing_imports = true
135
- warn_unused_ignores = false
136
- no_implicit_optional = false
137
- check_untyped_defs = false
138
-
139
- [tool.pytest.ini_options]
140
- markers = [
141
- "e2e: End-to-end tests for the raglib facade and pipelines",
142
- ]
1
+ [build-system]
2
+ requires = ["hatchling>=1.25.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "raglib-py"
7
+ version = "2.2.0"
8
+ description = "Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines"
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ authors = [
12
+ { name = "raglib maintainers" }
13
+ ]
14
+ requires-python = ">=3.9"
15
+ # The core is pure Python (BM25, in-memory vectors, all pipelines). Everything else is an extra.
16
+ dependencies = []
17
+ keywords = ["rag", "llm", "retrieval", "ai", "nlp", "vector-search", "graphrag", "hybrid-search"]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ ]
30
+
31
+ [project.scripts]
32
+ raglib = "raglib.cli:main"
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/himanshuhs9011/raglib"
36
+ Documentation = "https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md"
37
+ Repository = "https://github.com/himanshuhs9011/raglib"
38
+ "Bug Tracker" = "https://github.com/himanshuhs9011/raglib/issues"
39
+
40
+ [project.optional-dependencies]
41
+ # chat / embedding providers
42
+ # Every hosted provider is reached with raglib's own HTTP clients (standard library only), so
43
+ # these extras are empty. They are kept so existing `pip install raglib-py[openai]` lines still work.
44
+ openai = []
45
+ openrouter = []
46
+ anthropic = []
47
+ groq = []
48
+ google = []
49
+ ollama = []
50
+ hf = ["sentence-transformers>=2.6.0"]
51
+ # wrap your own LangChain chat model: RAG(chat_llm=ChatOpenAI(...))
52
+ langchain = ["langchain-core>=0.2.0"]
53
+ # retrieval quality
54
+ rerank = ["sentence-transformers>=2.6.0"]
55
+ cohere = ["cohere>=5.0.0"]
56
+ fast = ["numpy>=1.24", "tiktoken>=0.5.0"]
57
+ # storage
58
+ chroma = ["chromadb>=0.5.0"]
59
+ qdrant = ["qdrant-client>=1.10.0"]
60
+ pgvector = ["psycopg[binary]>=3.1"]
61
+ graph = ["networkx>=3.0"]
62
+ leiden = ["networkx>=3.0", "graspologic>=3.3"]
63
+ neo4j = ["neo4j>=5.0", "networkx>=3.0"]
64
+ # loaders
65
+ pdf = ["PyMuPDF>=1.23.0"]
66
+ docx = ["python-docx>=1.0.0"]
67
+ pptx = ["python-pptx>=0.6.21"]
68
+ xlsx = ["openpyxl>=3.1"]
69
+ ocr = ["pytesseract>=0.3.10", "Pillow>=10.0.0"]
70
+ # web search
71
+ web = ["ddgs>=6.0.0"]
72
+ tavily = ["tavily-python>=0.2.0"]
73
+ serpapi = ["google-search-results>=2.4.0"]
74
+ # bundles
75
+ all-llm = []
76
+ all = [
77
+ "sentence-transformers>=2.6.0",
78
+ "numpy>=1.24",
79
+ "tiktoken>=0.5.0",
80
+ "chromadb>=0.5.0",
81
+ "networkx>=3.0",
82
+ "PyMuPDF>=1.23.0",
83
+ "python-docx>=1.0.0",
84
+ "python-pptx>=0.6.21",
85
+ "openpyxl>=3.1",
86
+ "ddgs>=6.0.0",
87
+ ]
88
+ dev = [
89
+ "pytest>=7.4.0",
90
+ "pytest-cov>=4.1.0",
91
+ "ruff>=0.5.0",
92
+ "build>=1.0.0",
93
+ "twine>=4.0.0",
94
+ "networkx>=3.0",
95
+ "mypy>=1.8",
96
+ ]
97
+
98
+ [tool.hatch.build.targets.wheel]
99
+ packages = ["raglib"]
100
+
101
+ [tool.hatch.build.targets.sdist]
102
+ # Leading "/" anchors to the project root; a bare "README.md" also matched files in site/node_modules.
103
+ include = [
104
+ "/raglib/**/*.py",
105
+ "/README.md",
106
+ "/LICENSE",
107
+ "/pyproject.toml",
108
+ ]
109
+
110
+ [tool.ruff]
111
+ target-version = "py39"
112
+ line-length = 130
113
+ extend-exclude = ["site", "dist"]
114
+
115
+ [tool.ruff.lint]
116
+ # pyflakes, pycodestyle errors, import sorting, bugbear-lite. Pyupgrade (UP) rules are off:
117
+ # typing.List/Optional are kept deliberately for Python 3.9 support.
118
+ select = ["E", "F", "I", "B006", "B008", "B904"]
119
+ ignore = ["E501", "E731", "E741", "E402"]
120
+
121
+ [tool.mypy]
122
+ python_version = "3.9"
123
+ ignore_missing_imports = true
124
+ warn_unused_ignores = false
125
+ no_implicit_optional = false
126
+ check_untyped_defs = false
127
+
128
+ [tool.pytest.ini_options]
129
+ markers = [
130
+ "e2e: End-to-end tests for the raglib facade and pipelines",
131
+ ]