AutoRAG 0.0.2__tar.gz → 0.0.4__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 (192) hide show
  1. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/PKG-INFO +2 -2
  2. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/SOURCES.txt +12 -1
  3. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/PKG-INFO +2 -2
  4. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/README.md +1 -1
  5. AutoRAG-0.0.4/autorag/VERSION +1 -0
  6. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/__init__.py +2 -3
  7. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/deploy.py +21 -0
  8. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/generator/base.py +2 -1
  9. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/generator/llama_index_llm.py +7 -2
  10. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagecompressor/base.py +1 -1
  11. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagecompressor/tree_summarize.py +7 -2
  12. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/queryexpansion/base.py +7 -1
  13. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/queryexpansion/hyde.py +7 -3
  14. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/queryexpansion/query_decompose.py +7 -3
  15. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/hybrid_cc.py +2 -1
  16. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/run.py +28 -19
  17. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/vectordb.py +7 -2
  18. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/utils/util.py +20 -0
  19. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/conf.py +1 -1
  20. AutoRAG-0.0.4/docs/source/data_creation/tutorial.md +1 -0
  21. AutoRAG-0.0.4/docs/source/index.rst +45 -0
  22. AutoRAG-0.0.4/docs/source/install.md +1 -0
  23. AutoRAG-0.0.4/docs/source/modules/index.md +1 -0
  24. AutoRAG-0.0.4/docs/source/optimization/optimization.md +3 -0
  25. AutoRAG-0.0.4/docs/source/resources/samsung_sundae.jpeg +0 -0
  26. AutoRAG-0.0.4/docs/source/tutorial.md +1 -0
  27. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/pyproject.toml +7 -5
  28. AutoRAG-0.0.4/sample_dataset/README.md +25 -0
  29. AutoRAG-0.0.4/sample_dataset/eli5/load_eli5_dataset.py +30 -0
  30. AutoRAG-0.0.4/sample_dataset/msmarco/load_msmarco_dataset.py +30 -0
  31. AutoRAG-0.0.4/sample_dataset/triviaqa/load_triviaqa_dataset.py +30 -0
  32. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/generator/test_run_generator_node.py +4 -3
  33. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagecompressor/test_run_passage_compressor_node.py +2 -2
  34. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/queryexpansion/test_query_expansion_run.py +3 -3
  35. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_hybrid_cc.py +11 -1
  36. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_run_retrieval_node.py +46 -1
  37. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/test_deploy.py +24 -1
  38. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/test_evaluator.py +46 -1
  39. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/utils/test_util.py +16 -1
  40. AutoRAG-0.0.4/tests/resources/qa_test_data_sample.parquet +0 -0
  41. AutoRAG-0.0.2/VERSION +0 -1
  42. AutoRAG-0.0.2/docs/source/index.rst +0 -22
  43. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/.github/dependabot.yml +0 -0
  44. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/.github/workflows/sphinx.yml +0 -0
  45. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/.github/workflows/test.yml +0 -0
  46. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/.gitignore +0 -0
  47. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/dependency_links.txt +0 -0
  48. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/entry_points.txt +0 -0
  49. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/requires.txt +0 -0
  50. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/AutoRAG.egg-info/top_level.txt +0 -0
  51. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/LICENSE +0 -0
  52. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/data/__init__.py +0 -0
  53. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/__init__.py +0 -0
  54. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/generation.py +0 -0
  55. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/metric/__init__.py +0 -0
  56. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/metric/generation.py +0 -0
  57. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/metric/retrieval.py +0 -0
  58. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/metric/retrieval_contents.py +0 -0
  59. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/retrieval.py +0 -0
  60. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluate/retrieval_contents.py +0 -0
  61. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/evaluator.py +0 -0
  62. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/node_line.py +0 -0
  63. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/__init__.py +0 -0
  64. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/generator/__init__.py +0 -0
  65. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/generator/run.py +0 -0
  66. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagecompressor/__init__.py +0 -0
  67. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagecompressor/run.py +0 -0
  68. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/__init__.py +0 -0
  69. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/base.py +0 -0
  70. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/monot5.py +0 -0
  71. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/run.py +0 -0
  72. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/tart/__init__.py +0 -0
  73. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/tart/modeling_enc_t5.py +0 -0
  74. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/tart/tart.py +0 -0
  75. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/tart/tokenization_enc_t5.py +0 -0
  76. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/passagereranker/upr.py +0 -0
  77. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/promptmaker/__init__.py +0 -0
  78. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/promptmaker/base.py +0 -0
  79. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/promptmaker/fstring.py +0 -0
  80. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/promptmaker/run.py +0 -0
  81. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/queryexpansion/__init__.py +0 -0
  82. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/queryexpansion/run.py +0 -0
  83. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/__init__.py +0 -0
  84. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/base.py +0 -0
  85. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/bm25.py +0 -0
  86. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/nodes/retrieval/hybrid_rrf.py +0 -0
  87. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/schema/__init__.py +0 -0
  88. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/schema/module.py +0 -0
  89. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/schema/node.py +0 -0
  90. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/strategy.py +0 -0
  91. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/support.py +0 -0
  92. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/utils/__init__.py +0 -0
  93. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/autorag/utils/preprocess.py +0 -0
  94. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/dev_requirements.txt +0 -0
  95. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/Makefile +0 -0
  96. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/make.bat +0 -0
  97. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/requirements.txt +0 -0
  98. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.data.rst +0 -0
  99. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.evaluate.metric.rst +0 -0
  100. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.evaluate.rst +0 -0
  101. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.generator.rst +0 -0
  102. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.passagecompressor.rst +0 -0
  103. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.passagereranker.rst +0 -0
  104. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.passagereranker.tart.rst +0 -0
  105. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.promptmaker.rst +0 -0
  106. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.queryexpansion.rst +0 -0
  107. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.retrieval.rst +0 -0
  108. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.nodes.rst +0 -0
  109. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.rst +0 -0
  110. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.schema.rst +0 -0
  111. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/autorag.utils.rst +0 -0
  112. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/docs/source/api_spec/modules.rst +0 -0
  113. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/requirements.txt +0 -0
  114. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/setup.cfg +0 -0
  115. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/metric/test_generation_metric.py +0 -0
  116. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/metric/test_retrieval_contents_metric.py +0 -0
  117. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/metric/test_retrieval_metric.py +0 -0
  118. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/test_generation_evaluate.py +0 -0
  119. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/test_retrieval_contents_evaluate.py +0 -0
  120. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/evaluate/test_retrieval_evaluate.py +0 -0
  121. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/generator/test_llama_index_llm.py +0 -0
  122. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagecompressor/test_tree_summarize.py +0 -0
  123. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagereranker/test_monot5.py +0 -0
  124. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagereranker/test_passage_reranker_base.py +0 -0
  125. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagereranker/test_passage_reranker_run.py +0 -0
  126. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagereranker/test_tart.py +0 -0
  127. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/passagereranker/test_upr.py +0 -0
  128. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/promptmaker/test_fstring.py +0 -0
  129. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/promptmaker/test_prompt_maker_run.py +0 -0
  130. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/queryexpansion/test_hyde.py +0 -0
  131. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/queryexpansion/test_query_decompose.py +0 -0
  132. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/queryexpansion/test_query_expansion_base.py +0 -0
  133. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_bm25.py +0 -0
  134. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_hybrid_rrf.py +0 -0
  135. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_retrieval_base.py +0 -0
  136. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/nodes/retrieval/test_vectordb.py +0 -0
  137. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/schema/test_module_schema.py +0 -0
  138. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/schema/test_node_schema.py +0 -0
  139. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/test_strategy.py +0 -0
  140. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/test_support.py +0 -0
  141. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/autorag/utils/test_preprocess.py +0 -0
  142. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/conftest.py +0 -0
  143. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/corpus_data_sample.parquet +0 -0
  144. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/full.yaml +0 -0
  145. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/qa_data_sample.parquet +0 -0
  146. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/config.yaml +0 -0
  147. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/0.parquet +0 -0
  148. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/1.parquet +0 -0
  149. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/2.parquet +0 -0
  150. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/3.parquet +0 -0
  151. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/4.parquet +0 -0
  152. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/5.parquet +0 -0
  153. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/best_5.parquet +0 -0
  154. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/generator/summary.csv +0 -0
  155. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/prompt_maker/0.parquet +0 -0
  156. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/prompt_maker/1.parquet +0 -0
  157. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/prompt_maker/best_0.parquet +0 -0
  158. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/prompt_maker/summary.csv +0 -0
  159. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/post_retrieve_node_line/summary.csv +0 -0
  160. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/query_expansion/0.parquet +0 -0
  161. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/query_expansion/1.parquet +0 -0
  162. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/query_expansion/2.parquet +0 -0
  163. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/query_expansion/best_0.parquet +0 -0
  164. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/query_expansion/summary.csv +0 -0
  165. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/pre_retrieve_node_line/summary.csv +0 -0
  166. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_compressor/0.parquet +0 -0
  167. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_compressor/best_0.parquet +0 -0
  168. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_compressor/summary.csv +0 -0
  169. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_reranker/0.parquet +0 -0
  170. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_reranker/1.parquet +0 -0
  171. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_reranker/best_0.parquet +0 -0
  172. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/passage_reranker/summary.csv +0 -0
  173. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/retrieval/0.parquet +0 -0
  174. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/retrieval/1.parquet +0 -0
  175. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/retrieval/best_0.parquet +0 -0
  176. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/retrieval/summary.csv +0 -0
  177. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/retrieve_node_line/summary.csv +0 -0
  178. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/0/summary.csv +0 -0
  179. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/data/corpus.parquet +0 -0
  180. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/data/qa.parquet +0 -0
  181. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/bm25.pkl +0 -0
  182. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/chroma/6595d304-5270-4d9f-a267-c191366804ce/data_level0.bin +0 -0
  183. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/chroma/6595d304-5270-4d9f-a267-c191366804ce/header.bin +0 -0
  184. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/chroma/6595d304-5270-4d9f-a267-c191366804ce/length.bin +0 -0
  185. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/chroma/6595d304-5270-4d9f-a267-c191366804ce/link_lists.bin +0 -0
  186. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/resources/chroma/chroma.sqlite3 +0 -0
  187. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/result_project/trial.json +0 -0
  188. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/sample_project/data/corpus.parquet +0 -0
  189. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/sample_project/data/qa.parquet +0 -0
  190. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/sample_project/resources/bm25.pkl +0 -0
  191. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/simple.yaml +0 -0
  192. {AutoRAG-0.0.2 → AutoRAG-0.0.4}/tests/resources/test_bm25_retrieval.pkl +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AutoRAG
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Automatically Evaluate RAG pipelines with your own data. Find optimal structure for new RAG product.
5
5
  Author-email: Marker-Inc <vkehfdl1@gmail.com>
6
6
  License: Apache License
@@ -310,7 +310,7 @@ For evaluation, you need to prepare just three files.
310
310
 
311
311
  There is a template for your evaluation data for using AutoRAG.
312
312
  Check out the evaluation data rule at [here]().
313
- Plus, you can get example datasets for testing AutoRAG at [here]().
313
+ Plus, you can get example datasets for testing AutoRAG at [here](./sample_dataset).
314
314
 
315
315
  ### Evaluate your data to various RAG modules
316
316
 
@@ -1,7 +1,6 @@
1
1
  .gitignore
2
2
  LICENSE
3
3
  README.md
4
- VERSION
5
4
  dev_requirements.txt
6
5
  pyproject.toml
7
6
  requirements.txt
@@ -14,6 +13,7 @@ AutoRAG.egg-info/dependency_links.txt
14
13
  AutoRAG.egg-info/entry_points.txt
15
14
  AutoRAG.egg-info/requires.txt
16
15
  AutoRAG.egg-info/top_level.txt
16
+ autorag/VERSION
17
17
  autorag/__init__.py
18
18
  autorag/deploy.py
19
19
  autorag/evaluator.py
@@ -74,6 +74,8 @@ docs/make.bat
74
74
  docs/requirements.txt
75
75
  docs/source/conf.py
76
76
  docs/source/index.rst
77
+ docs/source/install.md
78
+ docs/source/tutorial.md
77
79
  docs/source/api_spec/autorag.data.rst
78
80
  docs/source/api_spec/autorag.evaluate.metric.rst
79
81
  docs/source/api_spec/autorag.evaluate.rst
@@ -89,6 +91,14 @@ docs/source/api_spec/autorag.rst
89
91
  docs/source/api_spec/autorag.schema.rst
90
92
  docs/source/api_spec/autorag.utils.rst
91
93
  docs/source/api_spec/modules.rst
94
+ docs/source/data_creation/tutorial.md
95
+ docs/source/modules/index.md
96
+ docs/source/optimization/optimization.md
97
+ docs/source/resources/samsung_sundae.jpeg
98
+ sample_dataset/README.md
99
+ sample_dataset/eli5/load_eli5_dataset.py
100
+ sample_dataset/msmarco/load_msmarco_dataset.py
101
+ sample_dataset/triviaqa/load_triviaqa_dataset.py
92
102
  tests/conftest.py
93
103
  tests/autorag/test_deploy.py
94
104
  tests/autorag/test_evaluator.py
@@ -128,6 +138,7 @@ tests/autorag/utils/test_util.py
128
138
  tests/resources/corpus_data_sample.parquet
129
139
  tests/resources/full.yaml
130
140
  tests/resources/qa_data_sample.parquet
141
+ tests/resources/qa_test_data_sample.parquet
131
142
  tests/resources/simple.yaml
132
143
  tests/resources/test_bm25_retrieval.pkl
133
144
  tests/resources/result_project/trial.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: AutoRAG
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Automatically Evaluate RAG pipelines with your own data. Find optimal structure for new RAG product.
5
5
  Author-email: Marker-Inc <vkehfdl1@gmail.com>
6
6
  License: Apache License
@@ -310,7 +310,7 @@ For evaluation, you need to prepare just three files.
310
310
 
311
311
  There is a template for your evaluation data for using AutoRAG.
312
312
  Check out the evaluation data rule at [here]().
313
- Plus, you can get example datasets for testing AutoRAG at [here]().
313
+ Plus, you can get example datasets for testing AutoRAG at [here](./sample_dataset).
314
314
 
315
315
  ### Evaluate your data to various RAG modules
316
316
 
@@ -66,7 +66,7 @@ For evaluation, you need to prepare just three files.
66
66
 
67
67
  There is a template for your evaluation data for using AutoRAG.
68
68
  Check out the evaluation data rule at [here]().
69
- Plus, you can get example datasets for testing AutoRAG at [here]().
69
+ Plus, you can get example datasets for testing AutoRAG at [here](./sample_dataset).
70
70
 
71
71
  ### Evaluate your data to various RAG modules
72
72
 
@@ -0,0 +1 @@
1
+ 0.0.4
@@ -10,8 +10,7 @@ from llama_index.embeddings.openai import OpenAIEmbeddingModelType
10
10
  from llama_index.llms import OpenAI, Anthropic, AzureOpenAI, HuggingFaceLLM, LangChainLLM, GradientBaseModelLLM, \
11
11
  GradientModelAdapterLLM, LiteLLM, LlamaCPP, OpenAILike, OpenLLM, PaLM, PredibaseLLM, Replicate, Xinference
12
12
 
13
- root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
14
- version_path = os.path.join(root_path, 'VERSION')
13
+ version_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'VERSION')
15
14
 
16
15
  with open(version_path, 'r') as f:
17
16
  __version__ = f.read().strip()
@@ -47,7 +46,7 @@ generator_models = {
47
46
 
48
47
  rich_format = "[%(filename)s:%(lineno)s] >> %(message)s"
49
48
  logging.basicConfig(
50
- level="NOTSET",
49
+ level="INFO",
51
50
  format=rich_format,
52
51
  handlers=[RichHandler(rich_tracebacks=True)]
53
52
  )
@@ -27,6 +27,20 @@ def extract_node_line_names(config_dict: Dict) -> List[str]:
27
27
  return [node_line['node_line_name'] for node_line in config_dict['node_lines']]
28
28
 
29
29
 
30
+ def extract_node_strategy(config_dict: Dict) -> Dict:
31
+ """
32
+ Extract node strategies with the given config dictionary.
33
+ The return value is a dictionary of node type and its strategy.
34
+
35
+ :param config_dict: The yaml configuration dict for the pipeline.
36
+ You can load this to access trail_folder/config.yaml.
37
+ :return: Key is node_type and value is strategy dict.
38
+ """
39
+ return {node['node_type']: node.get('strategy', {})
40
+ for node_line in config_dict['node_lines']
41
+ for node in node_line['nodes']}
42
+
43
+
30
44
  def summary_df_to_yaml(summary_df: pd.DataFrame, config_dict: Dict) -> Dict:
31
45
  """
32
46
  Convert trial summary dataframe to config yaml file.
@@ -41,6 +55,12 @@ def summary_df_to_yaml(summary_df: pd.DataFrame, config_dict: Dict) -> Dict:
41
55
  # summary_df columns : 'node_line_name', 'node_type', 'best_module_filename',
42
56
  # 'best_module_name', 'best_module_params', 'best_execution_time'
43
57
  node_line_names = extract_node_line_names(config_dict)
58
+ node_strategies = extract_node_strategy(config_dict)
59
+ strategy_df = pd.DataFrame({
60
+ 'node_type': list(node_strategies.keys()),
61
+ 'strategy': list(node_strategies.values())
62
+ })
63
+ summary_df = summary_df.merge(strategy_df, on='node_type', how='left')
44
64
  summary_df['categorical_node_line_name'] = pd.Categorical(summary_df['node_line_name'], categories=node_line_names,
45
65
  ordered=True)
46
66
  summary_df = summary_df.sort_values(by='categorical_node_line_name')
@@ -52,6 +72,7 @@ def summary_df_to_yaml(summary_df: pd.DataFrame, config_dict: Dict) -> Dict:
52
72
  'nodes': [
53
73
  {
54
74
  'node_type': row['node_type'],
75
+ 'strategy': row['strategy'],
55
76
  'modules': [{
56
77
  'module_type': row['best_module_name'],
57
78
  **row['best_module_params']
@@ -34,6 +34,7 @@ def generator_node(func):
34
34
  if llm not in generator_models:
35
35
  raise ValueError(f"{llm} is not a valid llm name. Please check the llm name."
36
36
  "You can check valid llm names from autorag.generator_models.")
37
+ batch = kwargs.pop('batch', 16)
37
38
  llm_instance = generator_models[llm](**kwargs)
38
- return func(prompts=prompts, llm=llm_instance)
39
+ return func(prompts=prompts, llm=llm_instance, batch=batch)
39
40
  return wrapper
@@ -5,16 +5,21 @@ from llama_index.llms.base import BaseLLM
5
5
  from transformers import AutoTokenizer
6
6
 
7
7
  from autorag.nodes.generator.base import generator_node
8
+ from autorag.utils.util import process_batch
8
9
 
9
10
 
10
11
  @generator_node
11
- def llama_index_llm(prompts: List[str], llm: BaseLLM) -> Tuple[List[str], List[List[int]], List[List[float]]]:
12
+ def llama_index_llm(prompts: List[str], llm: BaseLLM, batch: int = 16) -> Tuple[List[str], List[List[int]], List[List[float]]]:
12
13
  """
13
14
  Llama Index LLM module.
14
15
  It gets the LLM instance from llama index, and returns generated text by the input prompt.
15
16
  It does not generate the right log probs, but it returns the pseudo log probs,
16
17
  which is not meant to be used for other modules.
17
18
 
19
+ :param prompts: A list of prompts.
20
+ :param llm: A llama index LLM instance.
21
+ :param batch: The batch size for llm.
22
+ Set low if you face some errors.
18
23
  :return: A tuple of three elements.
19
24
  The first element is a list of generated text.
20
25
  The second element is a list of generated text's token ids, used tokenizer is GPT2Tokenizer.
@@ -22,7 +27,7 @@ def llama_index_llm(prompts: List[str], llm: BaseLLM) -> Tuple[List[str], List[L
22
27
  """
23
28
  tasks = [llm.acomplete(prompt) for prompt in prompts]
24
29
  loop = asyncio.get_event_loop()
25
- results = loop.run_until_complete(asyncio.gather(*tasks))
30
+ results = loop.run_until_complete(process_batch(tasks, batch_size=batch))
26
31
 
27
32
  generated_texts = list(map(lambda x: x.text, results))
28
33
  tokenizer = AutoTokenizer.from_pretrained("gpt2", use_fast=False)
@@ -27,7 +27,7 @@ def passage_compressor_node(func):
27
27
  retrieve_scores = previous_result['retrieve_scores'].tolist()
28
28
 
29
29
  if func.__name__ == 'tree_summarize':
30
- param_list = ['prompt', 'chat_prompt', 'context_window', 'num_output']
30
+ param_list = ['prompt', 'chat_prompt', 'context_window', 'num_output', 'batch']
31
31
  param_dict = dict(filter(lambda x: x[0] in param_list, kwargs.items()))
32
32
  kwargs_dict = dict(filter(lambda x: x[0] not in param_list, kwargs.items()))
33
33
  llm_name = kwargs_dict.pop('llm')
@@ -8,6 +8,7 @@ from llama_index.prompts.utils import is_chat_model
8
8
  from llama_index.response_synthesizers import TreeSummarize
9
9
 
10
10
  from autorag.nodes.passagecompressor.base import passage_compressor_node
11
+ from autorag.utils.util import process_batch
11
12
 
12
13
 
13
14
  @passage_compressor_node
@@ -20,11 +21,12 @@ def tree_summarize(queries: List[str],
20
21
  chat_prompt: Optional[str] = None,
21
22
  context_window: Optional[int] = None,
22
23
  num_output: int = 1,
24
+ batch: int = 16,
23
25
  ) -> List[str]:
24
26
  """
25
27
  Recursively merge retrieved texts and summarizes them in a bottom-up fashion.
26
28
  This function is a wrapper for llama_index.response_synthesizers.TreeSummarize.
27
- For more information, visit https://docs.llamaindex.ai/en/stable/examples/response_synthesizers/tree_summarize.html.
29
+ For more information, visit https://docs.llamaindex.ai/en/latest/examples/response_synthesizers/tree_summarize.html.
28
30
 
29
31
  :param queries: The queries for retrieved passages.
30
32
  :param contents: The contents of retrieved passages.
@@ -45,6 +47,9 @@ def tree_summarize(queries: List[str],
45
47
  Default is None. When it is None, it will use a llama index default context window.
46
48
  :param num_output: The amount of summarization output.
47
49
  Default is 1.
50
+ :param batch: The batch size for llm.
51
+ Set low if you face some errors.
52
+ Default is 16.
48
53
  :return: The list of compressed texts.
49
54
  """
50
55
  if prompt is not None and not is_chat_model(llm):
@@ -61,5 +66,5 @@ def tree_summarize(queries: List[str],
61
66
  use_async=True)
62
67
  tasks = [summarizer.aget_response(query, content) for query, content in zip(queries, contents)]
63
68
  loop = asyncio.get_event_loop()
64
- results = loop.run_until_complete(asyncio.gather(*tasks))
69
+ results = loop.run_until_complete(process_batch(tasks, batch_size=batch))
65
70
  return results
@@ -35,6 +35,12 @@ def query_expansion_node(func):
35
35
  else:
36
36
  prompt = ""
37
37
 
38
+ # pop batch from kwargs
39
+ if "batch" in kwargs.keys():
40
+ batch = kwargs.pop("batch")
41
+ else:
42
+ batch = 16
43
+
38
44
  # set llm model for query expansion
39
45
  if llm_str in generator_models:
40
46
  llm = generator_models[llm_str](**kwargs)
@@ -43,7 +49,7 @@ def query_expansion_node(func):
43
49
  raise KeyError(f"llm_str {llm_str} does not exist.")
44
50
 
45
51
  # run query expansion function
46
- expanded_queries = func(queries=queries, llm=llm, prompt=prompt)
52
+ expanded_queries = func(queries=queries, llm=llm, prompt=prompt, batch=batch)
47
53
 
48
54
  return expanded_queries
49
55
 
@@ -4,13 +4,15 @@ from typing import List
4
4
  from llama_index.llms.llm import BaseLLM
5
5
 
6
6
  from autorag.nodes.queryexpansion.base import query_expansion_node
7
+ from autorag.utils.util import process_batch
7
8
 
8
9
  hyde_prompt = "Please write a passage to answer the question"
9
10
 
10
11
 
11
12
  @query_expansion_node
12
13
  def hyde(queries: List[str], llm: BaseLLM,
13
- prompt: str = hyde_prompt) -> List[List[str]]:
14
+ prompt: str = hyde_prompt,
15
+ batch: int = 16) -> List[List[str]]:
14
16
  """
15
17
  HyDE, which inspired by "Precise Zero-shot Dense Retrieval without Relevance Labels" (https://arxiv.org/pdf/2212.10496.pdf)
16
18
  LLM model creates hypothetical passage.
@@ -18,12 +20,14 @@ def hyde(queries: List[str], llm: BaseLLM,
18
20
  :param queries: List[str], queries to retrieve.
19
21
  :param llm: llm to use for hypothetical passage generation.
20
22
  :param prompt: prompt to use when generating hypothetical passage
23
+ :param batch: Batch size for llm.
24
+ Default is 16.
21
25
  :return: List[List[str]], List of hyde results.
22
26
  """
23
27
  # Run async query_decompose_pure function
24
28
  tasks = [hyde_pure(query, llm, prompt) for query in queries]
25
29
  loop = asyncio.get_event_loop()
26
- results = loop.run_until_complete(asyncio.gather(*tasks))
30
+ results = loop.run_until_complete(process_batch(tasks, batch_size=batch))
27
31
  return results
28
32
 
29
33
 
@@ -32,5 +36,5 @@ async def hyde_pure(query: str, llm: BaseLLM,
32
36
  if prompt is "":
33
37
  prompt = hyde_prompt
34
38
  full_prompt = prompt + f"\nQuestion: {query}\nPassage:"
35
- hyde_answer = llm.complete(full_prompt)
39
+ hyde_answer = await llm.acomplete(full_prompt)
36
40
  return [hyde_answer.text]
@@ -4,6 +4,7 @@ from typing import List
4
4
  from llama_index.llms.llm import BaseLLM
5
5
 
6
6
  from autorag.nodes.queryexpansion.base import query_expansion_node
7
+ from autorag.utils.util import process_batch
7
8
 
8
9
  decompose_prompt = """Decompose a question in self-contained sub-questions. Use \"The question needs no decomposition\" when no decomposition is needed.
9
10
 
@@ -54,19 +55,22 @@ decompose_prompt = """Decompose a question in self-contained sub-questions. Use
54
55
 
55
56
  @query_expansion_node
56
57
  def query_decompose(queries: List[str], llm: BaseLLM,
57
- prompt: str = decompose_prompt) -> List[List[str]]:
58
+ prompt: str = decompose_prompt,
59
+ batch: int = 16) -> List[List[str]]:
58
60
  """
59
61
  decompose query to little piece of questions.
60
62
  :param queries: List[str], queries to decompose.
61
63
  :param llm: BaseLLM, language model to use.
62
64
  :param prompt: str, prompt to use for query decomposition.
63
65
  default prompt comes from Visconde's StrategyQA few-shot prompt.
66
+ :param batch: int, batch size for llm.
67
+ Default is 16.
64
68
  :return: List[List[str]], list of decomposed query. Return input query if query is not decomposable.
65
69
  """
66
70
  # Run async query_decompose_pure function
67
71
  tasks = [query_decompose_pure(query, llm, prompt) for query in queries]
68
72
  loop = asyncio.get_event_loop()
69
- results = loop.run_until_complete(asyncio.gather(*tasks))
73
+ results = loop.run_until_complete(process_batch(tasks, batch_size=batch))
70
74
  return results
71
75
 
72
76
 
@@ -83,7 +87,7 @@ async def query_decompose_pure(query: str, llm: BaseLLM,
83
87
  if prompt == "":
84
88
  prompt = decompose_prompt
85
89
  full_prompt = "prompt: " + prompt + "\n\n" "question: " + query
86
- answer = llm.complete(full_prompt)
90
+ answer = await llm.acomplete(full_prompt)
87
91
  if answer.text == "the question needs no decomposition.":
88
92
  return [query]
89
93
  try:
@@ -55,8 +55,9 @@ def hybrid_cc(
55
55
 
56
56
  def cc_pure(ids: Tuple, scores: Tuple, weights: Tuple, top_k: int) -> Tuple[
57
57
  List[str], List[float]]:
58
- df = pd.concat([pd.Series(dict(zip(_id, score))) for _id, score in zip(ids, scores)], axis=1, join="inner")
58
+ df = pd.concat([pd.Series(dict(zip(_id, score))) for _id, score in zip(ids, scores)], axis=1)
59
59
  normalized_scores = (df - df.min()) / (df.max() - df.min())
60
+ normalized_scores = normalized_scores.fillna(0)
60
61
  normalized_scores['weighted_sum'] = normalized_scores.mul(weights).sum(axis=1)
61
62
  normalized_scores = normalized_scores.sort_values(by='weighted_sum', ascending=False)
62
63
  return normalized_scores.index.tolist()[:top_k], normalized_scores['weighted_sum'][:top_k].tolist()
@@ -68,28 +68,37 @@ def run_retrieval_node(modules: List[Callable],
68
68
 
69
69
  # run retrieval modules except hybrid
70
70
  hybrid_module_names = ['hybrid_rrf', 'hybrid_cc']
71
- non_hybrid_modules, non_hybrid_module_params = zip(*filter(lambda x: x[0].__name__ not in hybrid_module_names,
72
- zip(modules, module_params)))
73
71
  filename_first = 0
74
- non_hybrid_results, non_hybrid_times, non_hybrid_summary_df = run_and_save(non_hybrid_modules,
75
- non_hybrid_module_params, filename_first)
76
- filename_first += len(non_hybrid_modules)
72
+ if any([module.__name__ not in hybrid_module_names for module in modules]):
73
+ non_hybrid_modules, non_hybrid_module_params = zip(*filter(lambda x: x[0].__name__ not in hybrid_module_names,
74
+ zip(modules, module_params)))
75
+ non_hybrid_results, non_hybrid_times, non_hybrid_summary_df = run_and_save(non_hybrid_modules,
76
+ non_hybrid_module_params, filename_first)
77
+ filename_first += len(non_hybrid_modules)
78
+ else:
79
+ non_hybrid_results, non_hybrid_times, non_hybrid_summary_df = [], [], pd.DataFrame()
77
80
 
78
81
  if any([module.__name__ in hybrid_module_names for module in modules]):
79
82
  hybrid_modules, hybrid_module_params = zip(*filter(lambda x: x[0].__name__ in hybrid_module_names,
80
83
  zip(modules, module_params)))
81
- target_modules = list(map(lambda x: x.pop('target_modules'), hybrid_module_params))
82
- target_filenames = list(map(lambda x: select_result_for_hybrid(save_dir, x), target_modules))
83
- ids_scores = list(map(lambda x: get_ids_and_scores(save_dir, x), target_filenames))
84
- target_module_params = list(map(lambda x: get_module_params(save_dir, x), target_filenames))
85
- hybrid_module_params = list(map(lambda x: {**x[0], **x[1]}, zip(hybrid_module_params, ids_scores)))
86
- real_hybrid_times = list(map(lambda filename: get_hybrid_execution_times(save_dir, filename), target_filenames))
87
- hybrid_results, hybrid_times, hybrid_summary_df = run_and_save(hybrid_modules, hybrid_module_params,
88
- filename_first)
89
- filename_first += len(hybrid_modules)
90
- hybrid_times = real_hybrid_times.copy()
91
- hybrid_summary_df['execution_time'] = hybrid_times
92
- hybrid_summary_df = edit_summary_df_params(hybrid_summary_df, target_modules, target_module_params)
84
+ if all(['target_module_params' in x for x in hybrid_module_params]):
85
+ # If target_module_params are already given, run hybrid retrieval directly
86
+ hybrid_results, hybrid_times, hybrid_summary_df = run_and_save(hybrid_modules, hybrid_module_params,
87
+ filename_first)
88
+ filename_first += len(hybrid_modules)
89
+ else:
90
+ target_modules = list(map(lambda x: x.pop('target_modules'), hybrid_module_params))
91
+ target_filenames = list(map(lambda x: select_result_for_hybrid(save_dir, x), target_modules))
92
+ ids_scores = list(map(lambda x: get_ids_and_scores(save_dir, x), target_filenames))
93
+ target_module_params = list(map(lambda x: get_module_params(save_dir, x), target_filenames))
94
+ hybrid_module_params = list(map(lambda x: {**x[0], **x[1]}, zip(hybrid_module_params, ids_scores)))
95
+ real_hybrid_times = list(map(lambda filename: get_hybrid_execution_times(save_dir, filename), target_filenames))
96
+ hybrid_results, hybrid_times, hybrid_summary_df = run_and_save(hybrid_modules, hybrid_module_params,
97
+ filename_first)
98
+ filename_first += len(hybrid_modules)
99
+ hybrid_times = real_hybrid_times.copy()
100
+ hybrid_summary_df['execution_time'] = hybrid_times
101
+ hybrid_summary_df = edit_summary_df_params(hybrid_summary_df, target_modules, target_module_params)
93
102
  else:
94
103
  hybrid_results, hybrid_times, hybrid_summary_df = [], [], pd.DataFrame()
95
104
 
@@ -161,11 +170,11 @@ def select_result_for_hybrid(node_dir: str, target_modules: Tuple) -> List[str]:
161
170
  return best_filenames
162
171
 
163
172
 
164
- def get_module_params(node_dir: str, filenames: List[str]) -> List[Dict]:
173
+ def get_module_params(node_dir: str, filenames: List[str]) -> Tuple[Dict]:
165
174
  summary_df = load_summary_file(os.path.join(node_dir, "summary.csv"))
166
175
  best_results = summary_df[summary_df['filename'].isin(filenames)]
167
176
  module_params = best_results['module_params'].tolist()
168
- return module_params
177
+ return tuple(module_params)
169
178
 
170
179
 
171
180
  def edit_summary_df_params(summary_df: pd.DataFrame, target_modules, target_module_params) -> pd.DataFrame:
@@ -7,11 +7,13 @@ from llama_index.embeddings import BaseEmbedding
7
7
 
8
8
  from autorag.nodes.retrieval.base import retrieval_node, evenly_distribute_passages
9
9
  from autorag.utils import validate_corpus_dataset
10
+ from autorag.utils.util import process_batch
10
11
 
11
12
 
12
13
  @retrieval_node
13
14
  def vectordb(queries: List[List[str]], top_k: int, collection: chromadb.Collection,
14
- embedding_model: BaseEmbedding) -> Tuple[List[List[str]], List[List[float]]]:
15
+ embedding_model: BaseEmbedding,
16
+ batch: int = 128) -> Tuple[List[List[str]], List[List[float]]]:
15
17
  """
16
18
  VectorDB retrieval function.
17
19
  You have to get chroma collection that is already ingested.
@@ -22,6 +24,9 @@ def vectordb(queries: List[List[str]], top_k: int, collection: chromadb.Collecti
22
24
  :param top_k: The number of passages to be retrieved.
23
25
  :param collection: A chroma collection instance that will be used to retrieve passages.
24
26
  :param embedding_model: An embedding model instance that will be used to embed queries.
27
+ :param batch: The number of queries to be processed in parallel.
28
+ This is used to prevent API error at the query embedding.
29
+ Default is 128.
25
30
 
26
31
  :return: The 2-d list contains a list of passage ids that retrieved from vectordb and 2-d list of its scores.
27
32
  It will be a length of queries. And each element has a length of top_k.
@@ -32,7 +37,7 @@ def vectordb(queries: List[List[str]], top_k: int, collection: chromadb.Collecti
32
37
  # run async vector_db_pure function
33
38
  tasks = [vectordb_pure(input_queries, top_k, collection, embedding_model) for input_queries in queries]
34
39
  loop = asyncio.get_event_loop()
35
- results = loop.run_until_complete(asyncio.gather(*tasks))
40
+ results = loop.run_until_complete(process_batch(tasks, batch_size=batch))
36
41
  id_result = list(map(lambda x: x[0], results))
37
42
  score_result = list(map(lambda x: x[1], results))
38
43
  return id_result, score_result
@@ -1,4 +1,5 @@
1
1
  import ast
2
+ import asyncio
2
3
  import functools
3
4
  import itertools
4
5
  import os
@@ -200,3 +201,22 @@ def convert_string_to_tuple_in_dict(d):
200
201
  d[key] = ast.literal_eval(value)
201
202
 
202
203
  return d
204
+
205
+
206
+ async def process_batch(tasks, batch_size: int = 64) -> List[Any]:
207
+ """
208
+ Processes tasks in batches asynchronously.
209
+
210
+ :param tasks: A list of no-argument functions or coroutines to be executed.
211
+ :param batch_size: The number of tasks to process in a single batch.
212
+ Default is 64.
213
+ :return: A list of results from the processed tasks.
214
+ """
215
+ results = []
216
+
217
+ for i in range(0, len(tasks), batch_size):
218
+ batch = tasks[i:i + batch_size]
219
+ batch_results = await asyncio.gather(*batch)
220
+ results.extend(batch_results)
221
+
222
+ return results
@@ -10,7 +10,7 @@ project = 'AutoRAG'
10
10
  copyright = '2024, Marker-Inc'
11
11
  author = 'Marker-Inc'
12
12
 
13
- with open('../../VERSION') as f:
13
+ with open('../../autorag/VERSION') as f:
14
14
  version = f.read().strip()
15
15
 
16
16
  # -- General configuration ---------------------------------------------------
@@ -0,0 +1 @@
1
+ # Start creating your own evaluation data
@@ -0,0 +1,45 @@
1
+ .. AutoRAG documentation master file, created by
2
+ sphinx-quickstart on Wed Jan 17 20:55:21 2024.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ AutoRAG documentation
7
+ ===================================
8
+
9
+ .. toctree::
10
+ :maxdepth: 1
11
+ :caption: Getting Started
12
+ :hidden:
13
+
14
+ install.md
15
+ tutorial.md
16
+
17
+ .. toctree::
18
+ :maxdepth: 2
19
+ :caption: Data Creation
20
+ :hidden:
21
+
22
+ data_creation/tutorial.md
23
+
24
+
25
+ .. toctree::
26
+ :maxdepth: 2
27
+ :caption: Optimization
28
+ :hidden:
29
+
30
+ optimization/optimization.md
31
+
32
+ .. toctree::
33
+ :maxdepth: 2
34
+ :caption: Available Modules
35
+ :hidden:
36
+
37
+ modules/index.md
38
+
39
+ .. toctree::
40
+ :maxdepth: 1
41
+ :caption: API Reference
42
+ :hidden:
43
+
44
+ api_spec/modules
45
+
@@ -0,0 +1 @@
1
+ # Installation
@@ -0,0 +1 @@
1
+ # Available Module List
@@ -0,0 +1,3 @@
1
+ # How optimization works
2
+
3
+ ![Sundae](../resources/samsung_sundae.jpeg)
@@ -0,0 +1 @@
1
+ # Tutorial
@@ -5,13 +5,13 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "AutoRAG"
7
7
  authors = [
8
- {name = "Marker-Inc", email = "vkehfdl1@gmail.com"}
8
+ { name = "Marker-Inc", email = "vkehfdl1@gmail.com" }
9
9
  ]
10
10
  description = 'Automatically Evaluate RAG pipelines with your own data. Find optimal structure for new RAG product.'
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.8"
13
13
  keywords = ['RAG', 'AutoRAG', 'autorag', 'rag-evaluation', 'evaluation', 'rag-auto', 'AutoML', 'AutoML-RAG']
14
- license = {file = "LICENSE"}
14
+ license = { file = "LICENSE" }
15
15
  classifiers = [
16
16
  "Intended Audience :: Developers",
17
17
  "Intended Audience :: Information Technology",
@@ -23,13 +23,15 @@ classifiers = [
23
23
  "Topic :: Software Development :: Libraries",
24
24
  "Topic :: Software Development :: Libraries :: Python Modules",
25
25
  ]
26
- urls = {Homepage = "https://github.com/Marker-Inc-Korea/AutoRAG"}
26
+ urls = { Homepage = "https://github.com/Marker-Inc-Korea/AutoRAG" }
27
27
  dynamic = ["version", "dependencies"]
28
28
 
29
29
  [tool.setuptools.dynamic]
30
- version = {file = ["VERSION"]}
31
- dependencies = {file = ["requirements.txt"]}
30
+ version = { file = ["autorag/VERSION"] }
31
+ dependencies = { file = ["requirements.txt"] }
32
32
 
33
+ [tool.setuptools]
34
+ include-package-data = true
33
35
 
34
36
  [tool.setuptools.packages.find]
35
37
  where = ["."]
@@ -0,0 +1,25 @@
1
+ # sample_dataset handling
2
+
3
+ The sample_dataset folder does not includes a `qa.parquet`, `corpus.parquet` file that is significantly large and cannot be uploaded directly to Git due to size limitations.
4
+
5
+ To prepare and use datasets available in the sample_dataset folder, specifically `triviaqa`, `msmarco` and `eli5`, you can follow the outlined methods below.
6
+
7
+ ## Usage
8
+
9
+ The example provided uses `triviaqa`, but the same approach applies to `msmarco` and `eli5`.
10
+
11
+ ### 1. Run with a specified save path
12
+ To execute the Python script from the terminal and save the dataset to a specified path, use the command:
13
+
14
+ ```bash
15
+ python ./sample_dataset/triviaqa/load_triviaqa_dataset.py --save_path /path/to/save/dataset
16
+ ```
17
+ This runs the `load_triviaqa_dataset.py` script located in the `./sample_dataset/triviaqa/` directory,
18
+ using the `--save_path` argument to specify the dataset's save location.
19
+
20
+ ### 2. Run without specifying a save path
21
+ If you run the script without the `--save_path` argument, the dataset will be saved to a default location, which is the directory containing the `load_triviaqa_dataset.py` file, essentially `./sample_dataset/triviaqa/`:
22
+ ```bash
23
+ python ./sample_dataset/triviaqa/load_triviaqa_dataset.py
24
+ ```
25
+ This behavior allows for a straightforward execution without needing to specify a path, making it convenient for quick tests or when working directly within the target directory.