flashrag-dev 0.1.4.dev20250111__tar.gz → 0.1.4.dev20250113__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 (61) hide show
  1. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/PKG-INFO +64 -11
  2. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/README.md +63 -10
  3. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/refiner/refiner.py +1 -1
  4. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/utils.py +9 -1
  5. flashrag_dev-0.1.4.dev20250113/flashrag/version.py +1 -0
  6. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag_dev.egg-info/PKG-INFO +64 -11
  7. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag_dev.egg-info/requires.txt +6 -0
  8. flashrag_dev-0.1.4.dev20250111/flashrag/version.py +0 -1
  9. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/LICENSE +0 -0
  10. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/__init__.py +0 -0
  11. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/config/__init__.py +0 -0
  12. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/config/basic_config.yaml +0 -0
  13. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/config/config.py +0 -0
  14. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/dataset/__init__.py +0 -0
  15. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/dataset/dataset.py +0 -0
  16. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/dataset/utils.py +0 -0
  17. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/evaluator/__init__.py +0 -0
  18. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/evaluator/_bleu.py +0 -0
  19. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/evaluator/evaluator.py +0 -0
  20. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/evaluator/metrics.py +0 -0
  21. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/evaluator/utils.py +0 -0
  22. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/__init__.py +0 -0
  23. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/fid.py +0 -0
  24. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/generator.py +0 -0
  25. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/multimodal_generator.py +0 -0
  26. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/openai_generator.py +0 -0
  27. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/stop_word_criteria.py +0 -0
  28. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/generator/utils.py +0 -0
  29. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/judger/__init__.py +0 -0
  30. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/judger/judger.py +0 -0
  31. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/__init__.py +0 -0
  32. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/active_pipeline.py +0 -0
  33. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/branching_pipeline.py +0 -0
  34. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/mm_pipeline.py +0 -0
  35. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/pipeline.py +0 -0
  36. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/pipeline/replug_utils.py +0 -0
  37. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/prompt/__init__.py +0 -0
  38. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/prompt/base_prompt.py +0 -0
  39. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/prompt/mm_prompt.py +0 -0
  40. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/prompt/selfask_examplars.py +0 -0
  41. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/prompt/trace_examplars.py +0 -0
  42. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/refiner/__init__.py +0 -0
  43. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/refiner/kg_refiner.py +0 -0
  44. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/refiner/llmlingua_compressor.py +0 -0
  45. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/refiner/selective_context_compressor.py +0 -0
  46. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/__init__.py +0 -0
  47. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/__main__.py +0 -0
  48. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/encoder.py +0 -0
  49. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/index_builder.py +0 -0
  50. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/reranker.py +0 -0
  51. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/retriever/retriever.py +0 -0
  52. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/utils/__init__.py +0 -0
  53. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/utils/constants.py +0 -0
  54. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/utils/pred_parse.py +0 -0
  55. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag/utils/utils.py +0 -0
  56. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag_dev.egg-info/SOURCES.txt +0 -0
  57. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag_dev.egg-info/dependency_links.txt +0 -0
  58. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/flashrag_dev.egg-info/top_level.txt +0 -0
  59. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/pyproject.toml +0 -0
  60. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/setup.cfg +0 -0
  61. {flashrag_dev-0.1.4.dev20250111 → flashrag_dev-0.1.4.dev20250113}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flashrag_dev
3
- Version: 0.1.4.dev20250111
3
+ Version: 0.1.4.dev20250113
4
4
  Summary: A library for efficient Retrieval-Augmented Generation research
5
5
  Home-page: https://github.com/RUC-NLPIR/FlashRAG
6
6
  Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
@@ -32,19 +32,24 @@ License-File: LICENSE
32
32
  <a href="#sparkles-features">Features</a> |
33
33
  <a href="#rocket-quick-start">Quick-Start</a> |
34
34
  <a href="#gear-components"> Components</a> |
35
+ <a href="#art-flashrag-ui"> FlashRAG-UI</a> |
35
36
  <a href="#robot-supporting-methods"> Supporting Methods</a> |
36
37
  <a href="#notebook-supporting-datasets--document-corpus"> Supporting Datasets</a> |
37
38
  <a href="#raised_hands-additional-faqs"> FAQs</a>
38
39
  </p>
39
40
 
40
41
  </h4>
41
- FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 15 state-of-the-art RAG algorithms.
42
+
43
+
44
+ FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 16 state-of-the-art RAG algorithms.
42
45
 
43
46
  <p align="center">
44
47
  <img src="asset/framework.jpg">
45
48
  </p>
46
49
 
47
- With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components.
50
+ With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components. Besides, we provide an easy-to-use UI:
51
+
52
+ https://github.com/user-attachments/assets/8ca00873-5df2-48a7-b853-89e7b18bc6e9
48
53
 
49
54
  <p>
50
55
  <a href="https://trendshift.io/repositories/10454" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10454" alt="RUC-NLPIR%2FFlashRAG | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
@@ -57,6 +62,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
57
62
  - [Installation](#wrench-installation)
58
63
  - [Quick Start](#rocket-quick-start)
59
64
  - [Components](#gear-components)
65
+ - [FlashRAG-UI](#art-flashrag-ui)
60
66
  - [Supporting Methods](#robot-supporting-methods)
61
67
  - [Supporting Datasets & Document Corpus](#notebook-supporting-datasets--document-corpus)
62
68
  - [Additional FAQs](#raised_hands-additional-faqs)
@@ -69,7 +75,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
69
75
 
70
76
  - **Comprehensive Benchmark Datasets**: A collection of 36 pre-processed RAG benchmark datasets to test and validate RAG models' performances.
71
77
 
72
- - **Pre-implemented Advanced RAG Algorithms**: Features 15 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
78
+ - **Pre-implemented Advanced RAG Algorithms**: Features 16 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
73
79
 
74
80
  - **Efficient Preprocessing Stage**: Simplifies the RAG workflow preparation by providing various scripts like corpus processing for retrieval, retrieval index building, and pre-retrieval of documents.
75
81
 
@@ -89,6 +95,9 @@ FlashRAG is still under development and there are many issues and room for impro
89
95
  - [ ] Enhance code adaptability and readability
90
96
 
91
97
  ## :page_with_curl: Changelog
98
+ [25/01/12] Introduce <strong>FlashRAG-UI</strong>, an easy to use interface. You can easily and quickly configure and experience the supported RAG methods and evaluate them on the benchmarks.
99
+
100
+ [25/01/11] We have added support for a new method [<u>RQRAG</u>](https://arxiv.org/abs/2404.00610) method, see it in [**reproduce_experiment**](docs/reproduce_experiment.md).
92
101
 
93
102
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/multi_retriever_usage.md).
94
103
 
@@ -100,15 +109,15 @@ FlashRAG is still under development and there are many issues and room for impro
100
109
 
101
110
  [24/09/24] We have released a version based on the MindSpore framework that supports Chinese hardware platforms. Please refer to [FlashRAG MindSpore](https://github.com/RUC-NLPIR/FlashRAG-MindSpore) for details.
102
111
 
112
+ <details>
113
+ <summary>Show more</summary>
114
+
103
115
  [24/09/18] Due to the complexity and limitations of installing Pyserini in certain environments, we have introduced a lightweight `BM25s` package as an alternative (faster and easier to use). The retriever based on Pyserini will be deprecated in future versions. To use retriever with `bm25s`, just set `bm25_backend` to `bm25s` in config.
104
116
 
105
117
  [24/09/09] We add support for a new method [<u>Adaptive-RAG</u>](https://aclanthology.org/2024.naacl-long.389.pdf), which can automatically select the RAG process to execute based on the type of query. See it result in [<u>result table</u>](#robot-supporting-methods).
106
118
 
107
119
  [24/08/02] We add support for a new method [<u>Spring</u>](https://arxiv.org/abs/2405.19670), significantly improve the performance of LLM by adding only a few token embeddings. See it result in [<u>result table</u>](#robot-supporting-methods).
108
120
 
109
- <details>
110
- <summary>Show more</summary>
111
-
112
121
  [24/07/17] Due to some unknown issues with HuggingFace, our original dataset link has been invalid. We have updated it. Please check the [new link](https://huggingface.co/datasets/RUC-NLPIR/FlashRAG_datasets/) if you encounter any problems.
113
122
 
114
123
  [24/07/06] We add support for a new method: [<u>Trace</u>](https://arxiv.org/abs/2406.11460), which refine text by constructing a knowledge graph. See it [<u>results</u>](#robot-supporting-methods) and [<u>details</u>](./docs/baseline_details.md).
@@ -182,9 +191,8 @@ From the official Faiss repository ([source](https://github.com/facebookresearch
182
191
  To build an index, you first need to save your corpus as a `jsonl` file with each line representing a document.
183
192
 
184
193
  ```jsonl
185
- {"id": "0", "contents": "content"}
186
- {"id": "1", "contents": "content"}
187
- ...
194
+ {"id": "0", "contents": "..."}
195
+ {"id": "1", "contents": "..."}
188
196
  ```
189
197
 
190
198
  If you want to use Wikipedia as your corpus, you can refer to our documentation [Processing Wikipedia](./docs/process-wiki.md) to convert it into an indexable format.
@@ -492,6 +500,49 @@ In each category, we have implemented corresponding common pipelines. Some pipel
492
500
  </tbody>
493
501
  </table>
494
502
 
503
+ ## :art: FlashRAG-UI
504
+ <p>With <strong>FlashRAG-UI</strong>, you can easily and quickly configure and experience the supported RAG methods through our meticulously designed visual interface, and evaluate these methods on benchmarks, making complex research work more efficient!</p>
505
+
506
+ ### :star2: Features
507
+ - **One-Click Configuration Loading**
508
+ - You can load parameters and configuration files for various RAG methods through simple clicks, selections, and inputs.</li>
509
+ - Supports preview interface for intuitive parameter settings.</li>
510
+ - Provides save functionality to easily store configurations for future use.</li>
511
+ - **Quick Method Experience**
512
+ - Quickly load corpora and index files to explore the characteristics and application scenarios of various RAG methods.</li>
513
+ - Supports loading and switching different components and hyperparameters, seamlessly connecting different RAG Pipelines to quickly experience their performance and differences!</li>
514
+ - **Efficient Benchmark Reproduction**
515
+ - Easily reproduce the built-in baseline methods and carefully collected benchmarks on FlashRAG-UI.</li>
516
+ - Use cutting-edge research tools directly without complex settings, providing a smooth experience for your research work!</li>
517
+
518
+ <details>
519
+ <summary>Show more</summary>
520
+ <table align="center">
521
+ <tr>
522
+ <td align="center">
523
+ <img src="./asset/demo_en1.jpg" alt="Image 1" width="505"/>
524
+ </td>
525
+ <td align="center">
526
+ <img src="./asset/demo_en2.jpg" alt="Image 2" width="505"/>
527
+ </td>
528
+ </tr>
529
+ <tr>
530
+ <td align="center">
531
+ <img src="./asset/demo_en4.png" alt="Image 3" width="500"/>
532
+ </td>
533
+ <td align="center">
534
+ <img src="./asset/demo_en3.jpg" alt="Image 4" width="500"/>
535
+ </td>
536
+ </tr>
537
+ </table>
538
+ </details>
539
+
540
+ #### Experience our meticulously designed FlashRAG-UI—both user-friendly and visually appealing:
541
+ ```bash
542
+ cd webui
543
+ python interface.py
544
+ ```
545
+
495
546
  ## :robot: Supporting Methods
496
547
 
497
548
  We have implemented 15 works with a consistent setting of:
@@ -525,6 +576,8 @@ It’s important to note that, to ensure consistency, we have utilized a uniform
525
576
  | [FLARE](https://arxiv.org/abs/2305.06983) | Loop | 22.5 | 55.8 | 28.0 | 33.9 | 20.7 | 20.2 | |
526
577
  | [Iter-Retgen](https://arxiv.org/abs/2305.15294), [ITRG](https://arxiv.org/abs/2310.05149) | Loop | 36.8 | 60.1 | 38.3 | 21.6 | 37.9 | 18.2 | |
527
578
  | [IRCoT](https://aclanthology.org/2023.acl-long.557.pdf) | Loop | 33.3 | 56.9 | 41.5 | 32.4 | 45.6 | 20.7 | |
579
+ | [RQRAG](https://arxiv.org/abs/2404.00610) | Loop | 32.6 | 52.5 | 33.5 | 35.8 | 46.4 | 26.2 | Use trained rqrag-llama2-7B |
580
+
528
581
 
529
582
  ## :notebook: Supporting Datasets & Document Corpus
530
583
 
@@ -589,7 +642,7 @@ Below is the list of datasets along with the corresponding sample sizes:
589
642
  Our toolkit supports jsonl format for retrieval document collections, with the following structure:
590
643
 
591
644
  ```jsonl
592
- {"id":"0", "contents": "...."}
645
+ {"id":"0", "contents": "..."}
593
646
  {"id":"1", "contents": "..."}
594
647
  ```
595
648
 
@@ -15,19 +15,24 @@
15
15
  <a href="#sparkles-features">Features</a> |
16
16
  <a href="#rocket-quick-start">Quick-Start</a> |
17
17
  <a href="#gear-components"> Components</a> |
18
+ <a href="#art-flashrag-ui"> FlashRAG-UI</a> |
18
19
  <a href="#robot-supporting-methods"> Supporting Methods</a> |
19
20
  <a href="#notebook-supporting-datasets--document-corpus"> Supporting Datasets</a> |
20
21
  <a href="#raised_hands-additional-faqs"> FAQs</a>
21
22
  </p>
22
23
 
23
24
  </h4>
24
- FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 15 state-of-the-art RAG algorithms.
25
+
26
+
27
+ FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 16 state-of-the-art RAG algorithms.
25
28
 
26
29
  <p align="center">
27
30
  <img src="asset/framework.jpg">
28
31
  </p>
29
32
 
30
- With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components.
33
+ With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components. Besides, we provide an easy-to-use UI:
34
+
35
+ https://github.com/user-attachments/assets/8ca00873-5df2-48a7-b853-89e7b18bc6e9
31
36
 
32
37
  <p>
33
38
  <a href="https://trendshift.io/repositories/10454" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10454" alt="RUC-NLPIR%2FFlashRAG | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
@@ -40,6 +45,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
40
45
  - [Installation](#wrench-installation)
41
46
  - [Quick Start](#rocket-quick-start)
42
47
  - [Components](#gear-components)
48
+ - [FlashRAG-UI](#art-flashrag-ui)
43
49
  - [Supporting Methods](#robot-supporting-methods)
44
50
  - [Supporting Datasets & Document Corpus](#notebook-supporting-datasets--document-corpus)
45
51
  - [Additional FAQs](#raised_hands-additional-faqs)
@@ -52,7 +58,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
52
58
 
53
59
  - **Comprehensive Benchmark Datasets**: A collection of 36 pre-processed RAG benchmark datasets to test and validate RAG models' performances.
54
60
 
55
- - **Pre-implemented Advanced RAG Algorithms**: Features 15 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
61
+ - **Pre-implemented Advanced RAG Algorithms**: Features 16 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
56
62
 
57
63
  - **Efficient Preprocessing Stage**: Simplifies the RAG workflow preparation by providing various scripts like corpus processing for retrieval, retrieval index building, and pre-retrieval of documents.
58
64
 
@@ -72,6 +78,9 @@ FlashRAG is still under development and there are many issues and room for impro
72
78
  - [ ] Enhance code adaptability and readability
73
79
 
74
80
  ## :page_with_curl: Changelog
81
+ [25/01/12] Introduce <strong>FlashRAG-UI</strong>, an easy to use interface. You can easily and quickly configure and experience the supported RAG methods and evaluate them on the benchmarks.
82
+
83
+ [25/01/11] We have added support for a new method [<u>RQRAG</u>](https://arxiv.org/abs/2404.00610) method, see it in [**reproduce_experiment**](docs/reproduce_experiment.md).
75
84
 
76
85
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/multi_retriever_usage.md).
77
86
 
@@ -83,15 +92,15 @@ FlashRAG is still under development and there are many issues and room for impro
83
92
 
84
93
  [24/09/24] We have released a version based on the MindSpore framework that supports Chinese hardware platforms. Please refer to [FlashRAG MindSpore](https://github.com/RUC-NLPIR/FlashRAG-MindSpore) for details.
85
94
 
95
+ <details>
96
+ <summary>Show more</summary>
97
+
86
98
  [24/09/18] Due to the complexity and limitations of installing Pyserini in certain environments, we have introduced a lightweight `BM25s` package as an alternative (faster and easier to use). The retriever based on Pyserini will be deprecated in future versions. To use retriever with `bm25s`, just set `bm25_backend` to `bm25s` in config.
87
99
 
88
100
  [24/09/09] We add support for a new method [<u>Adaptive-RAG</u>](https://aclanthology.org/2024.naacl-long.389.pdf), which can automatically select the RAG process to execute based on the type of query. See it result in [<u>result table</u>](#robot-supporting-methods).
89
101
 
90
102
  [24/08/02] We add support for a new method [<u>Spring</u>](https://arxiv.org/abs/2405.19670), significantly improve the performance of LLM by adding only a few token embeddings. See it result in [<u>result table</u>](#robot-supporting-methods).
91
103
 
92
- <details>
93
- <summary>Show more</summary>
94
-
95
104
  [24/07/17] Due to some unknown issues with HuggingFace, our original dataset link has been invalid. We have updated it. Please check the [new link](https://huggingface.co/datasets/RUC-NLPIR/FlashRAG_datasets/) if you encounter any problems.
96
105
 
97
106
  [24/07/06] We add support for a new method: [<u>Trace</u>](https://arxiv.org/abs/2406.11460), which refine text by constructing a knowledge graph. See it [<u>results</u>](#robot-supporting-methods) and [<u>details</u>](./docs/baseline_details.md).
@@ -165,9 +174,8 @@ From the official Faiss repository ([source](https://github.com/facebookresearch
165
174
  To build an index, you first need to save your corpus as a `jsonl` file with each line representing a document.
166
175
 
167
176
  ```jsonl
168
- {"id": "0", "contents": "content"}
169
- {"id": "1", "contents": "content"}
170
- ...
177
+ {"id": "0", "contents": "..."}
178
+ {"id": "1", "contents": "..."}
171
179
  ```
172
180
 
173
181
  If you want to use Wikipedia as your corpus, you can refer to our documentation [Processing Wikipedia](./docs/process-wiki.md) to convert it into an indexable format.
@@ -475,6 +483,49 @@ In each category, we have implemented corresponding common pipelines. Some pipel
475
483
  </tbody>
476
484
  </table>
477
485
 
486
+ ## :art: FlashRAG-UI
487
+ <p>With <strong>FlashRAG-UI</strong>, you can easily and quickly configure and experience the supported RAG methods through our meticulously designed visual interface, and evaluate these methods on benchmarks, making complex research work more efficient!</p>
488
+
489
+ ### :star2: Features
490
+ - **One-Click Configuration Loading**
491
+ - You can load parameters and configuration files for various RAG methods through simple clicks, selections, and inputs.</li>
492
+ - Supports preview interface for intuitive parameter settings.</li>
493
+ - Provides save functionality to easily store configurations for future use.</li>
494
+ - **Quick Method Experience**
495
+ - Quickly load corpora and index files to explore the characteristics and application scenarios of various RAG methods.</li>
496
+ - Supports loading and switching different components and hyperparameters, seamlessly connecting different RAG Pipelines to quickly experience their performance and differences!</li>
497
+ - **Efficient Benchmark Reproduction**
498
+ - Easily reproduce the built-in baseline methods and carefully collected benchmarks on FlashRAG-UI.</li>
499
+ - Use cutting-edge research tools directly without complex settings, providing a smooth experience for your research work!</li>
500
+
501
+ <details>
502
+ <summary>Show more</summary>
503
+ <table align="center">
504
+ <tr>
505
+ <td align="center">
506
+ <img src="./asset/demo_en1.jpg" alt="Image 1" width="505"/>
507
+ </td>
508
+ <td align="center">
509
+ <img src="./asset/demo_en2.jpg" alt="Image 2" width="505"/>
510
+ </td>
511
+ </tr>
512
+ <tr>
513
+ <td align="center">
514
+ <img src="./asset/demo_en4.png" alt="Image 3" width="500"/>
515
+ </td>
516
+ <td align="center">
517
+ <img src="./asset/demo_en3.jpg" alt="Image 4" width="500"/>
518
+ </td>
519
+ </tr>
520
+ </table>
521
+ </details>
522
+
523
+ #### Experience our meticulously designed FlashRAG-UI—both user-friendly and visually appealing:
524
+ ```bash
525
+ cd webui
526
+ python interface.py
527
+ ```
528
+
478
529
  ## :robot: Supporting Methods
479
530
 
480
531
  We have implemented 15 works with a consistent setting of:
@@ -508,6 +559,8 @@ It’s important to note that, to ensure consistency, we have utilized a uniform
508
559
  | [FLARE](https://arxiv.org/abs/2305.06983) | Loop | 22.5 | 55.8 | 28.0 | 33.9 | 20.7 | 20.2 | |
509
560
  | [Iter-Retgen](https://arxiv.org/abs/2305.15294), [ITRG](https://arxiv.org/abs/2310.05149) | Loop | 36.8 | 60.1 | 38.3 | 21.6 | 37.9 | 18.2 | |
510
561
  | [IRCoT](https://aclanthology.org/2023.acl-long.557.pdf) | Loop | 33.3 | 56.9 | 41.5 | 32.4 | 45.6 | 20.7 | |
562
+ | [RQRAG](https://arxiv.org/abs/2404.00610) | Loop | 32.6 | 52.5 | 33.5 | 35.8 | 46.4 | 26.2 | Use trained rqrag-llama2-7B |
563
+
511
564
 
512
565
  ## :notebook: Supporting Datasets & Document Corpus
513
566
 
@@ -572,7 +625,7 @@ Below is the list of datasets along with the corresponding sample sizes:
572
625
  Our toolkit supports jsonl format for retrieval document collections, with the following structure:
573
626
 
574
627
  ```jsonl
575
- {"id":"0", "contents": "...."}
628
+ {"id":"0", "contents": "..."}
576
629
  {"id":"1", "contents": "..."}
577
630
  ```
578
631
 
@@ -73,7 +73,6 @@ class LLMLinguaRefiner(BaseRefiner):
73
73
  output = []
74
74
  for item in tqdm(dataset, desc="Refining process: "):
75
75
  question = item.question
76
- retrieval_result = item.retrieval_result
77
76
  # TODO: suit more cases
78
77
  if self.input_prompt_flag:
79
78
  input_prompt = item.prompt
@@ -88,6 +87,7 @@ class LLMLinguaRefiner(BaseRefiner):
88
87
  **self.compress_config,
89
88
  )
90
89
  else:
90
+ retrieval_result = item.retrieval_result
91
91
  docs = self.format_reference(retrieval_result).split("\n")
92
92
  docs = [i for i in docs if i != ""]
93
93
  item_output = self.refiner.compress_prompt(
@@ -5,6 +5,7 @@ from typing import Dict, Any, Union, List, Dict
5
5
  import numpy as np
6
6
  import datasets
7
7
  import re
8
+ import langid
8
9
  from transformers import AutoTokenizer, AutoModel, AutoConfig
9
10
 
10
11
  def convert_numpy(obj: Union[Dict, list, np.ndarray, np.generic]) -> Any:
@@ -27,7 +28,14 @@ def judge_zh(input_str: str):
27
28
  assert isinstance(input_str, str), input_str
28
29
  if len(input_str) == 0:
29
30
  return False
30
- return bool(re.search(r'[\u4e00-\u9fff]', input_str))
31
+ detect_result = langid.classify(input_str)
32
+ if detect_result[0] == 'zh':
33
+ return True
34
+ else:
35
+ return False
36
+ #return bool(re.search(r'[\u4e00-\u9fff]', input_str))
37
+
38
+
31
39
  def convert_numpy(obj: Union[Dict, list, np.ndarray, np.generic]) -> Any:
32
40
  """Recursively convert numpy objects in nested dictionaries or lists to native Python types."""
33
41
  if isinstance(obj, dict):
@@ -0,0 +1 @@
1
+ __version__ = "0.1.4dev20250113"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flashrag-dev
3
- Version: 0.1.4.dev20250111
3
+ Version: 0.1.4.dev20250113
4
4
  Summary: A library for efficient Retrieval-Augmented Generation research
5
5
  Home-page: https://github.com/RUC-NLPIR/FlashRAG
6
6
  Author: Jiajie Jin, Yutao Zhu, Chenghao Zhang, Xinyu Yang, Zhicheng Dou
@@ -32,19 +32,24 @@ License-File: LICENSE
32
32
  <a href="#sparkles-features">Features</a> |
33
33
  <a href="#rocket-quick-start">Quick-Start</a> |
34
34
  <a href="#gear-components"> Components</a> |
35
+ <a href="#art-flashrag-ui"> FlashRAG-UI</a> |
35
36
  <a href="#robot-supporting-methods"> Supporting Methods</a> |
36
37
  <a href="#notebook-supporting-datasets--document-corpus"> Supporting Datasets</a> |
37
38
  <a href="#raised_hands-additional-faqs"> FAQs</a>
38
39
  </p>
39
40
 
40
41
  </h4>
41
- FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 15 state-of-the-art RAG algorithms.
42
+
43
+
44
+ FlashRAG is a Python toolkit for the reproduction and development of Retrieval Augmented Generation (RAG) research. Our toolkit includes 36 pre-processed benchmark RAG datasets and 16 state-of-the-art RAG algorithms.
42
45
 
43
46
  <p align="center">
44
47
  <img src="asset/framework.jpg">
45
48
  </p>
46
49
 
47
- With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components.
50
+ With FlashRAG and provided resources, you can effortlessly reproduce existing SOTA works in the RAG domain or implement your custom RAG processes and components. Besides, we provide an easy-to-use UI:
51
+
52
+ https://github.com/user-attachments/assets/8ca00873-5df2-48a7-b853-89e7b18bc6e9
48
53
 
49
54
  <p>
50
55
  <a href="https://trendshift.io/repositories/10454" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10454" alt="RUC-NLPIR%2FFlashRAG | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
@@ -57,6 +62,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
57
62
  - [Installation](#wrench-installation)
58
63
  - [Quick Start](#rocket-quick-start)
59
64
  - [Components](#gear-components)
65
+ - [FlashRAG-UI](#art-flashrag-ui)
60
66
  - [Supporting Methods](#robot-supporting-methods)
61
67
  - [Supporting Datasets & Document Corpus](#notebook-supporting-datasets--document-corpus)
62
68
  - [Additional FAQs](#raised_hands-additional-faqs)
@@ -69,7 +75,7 @@ With FlashRAG and provided resources, you can effortlessly reproduce existing SO
69
75
 
70
76
  - **Comprehensive Benchmark Datasets**: A collection of 36 pre-processed RAG benchmark datasets to test and validate RAG models' performances.
71
77
 
72
- - **Pre-implemented Advanced RAG Algorithms**: Features 15 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
78
+ - **Pre-implemented Advanced RAG Algorithms**: Features 16 advancing RAG algorithms with reported results, based on our framework. Easily reproducing results under different settings.
73
79
 
74
80
  - **Efficient Preprocessing Stage**: Simplifies the RAG workflow preparation by providing various scripts like corpus processing for retrieval, retrieval index building, and pre-retrieval of documents.
75
81
 
@@ -89,6 +95,9 @@ FlashRAG is still under development and there are many issues and room for impro
89
95
  - [ ] Enhance code adaptability and readability
90
96
 
91
97
  ## :page_with_curl: Changelog
98
+ [25/01/12] Introduce <strong>FlashRAG-UI</strong>, an easy to use interface. You can easily and quickly configure and experience the supported RAG methods and evaluate them on the benchmarks.
99
+
100
+ [25/01/11] We have added support for a new method [<u>RQRAG</u>](https://arxiv.org/abs/2404.00610) method, see it in [**reproduce_experiment**](docs/reproduce_experiment.md).
92
101
 
93
102
  [25/01/07] We have currently support the aggregation of multiple retrievers, see it in [**multi retriever usage**](https://github.com/RUC-NLPIR/FlashRAG/blob/main/docs/multi_retriever_usage.md).
94
103
 
@@ -100,15 +109,15 @@ FlashRAG is still under development and there are many issues and room for impro
100
109
 
101
110
  [24/09/24] We have released a version based on the MindSpore framework that supports Chinese hardware platforms. Please refer to [FlashRAG MindSpore](https://github.com/RUC-NLPIR/FlashRAG-MindSpore) for details.
102
111
 
112
+ <details>
113
+ <summary>Show more</summary>
114
+
103
115
  [24/09/18] Due to the complexity and limitations of installing Pyserini in certain environments, we have introduced a lightweight `BM25s` package as an alternative (faster and easier to use). The retriever based on Pyserini will be deprecated in future versions. To use retriever with `bm25s`, just set `bm25_backend` to `bm25s` in config.
104
116
 
105
117
  [24/09/09] We add support for a new method [<u>Adaptive-RAG</u>](https://aclanthology.org/2024.naacl-long.389.pdf), which can automatically select the RAG process to execute based on the type of query. See it result in [<u>result table</u>](#robot-supporting-methods).
106
118
 
107
119
  [24/08/02] We add support for a new method [<u>Spring</u>](https://arxiv.org/abs/2405.19670), significantly improve the performance of LLM by adding only a few token embeddings. See it result in [<u>result table</u>](#robot-supporting-methods).
108
120
 
109
- <details>
110
- <summary>Show more</summary>
111
-
112
121
  [24/07/17] Due to some unknown issues with HuggingFace, our original dataset link has been invalid. We have updated it. Please check the [new link](https://huggingface.co/datasets/RUC-NLPIR/FlashRAG_datasets/) if you encounter any problems.
113
122
 
114
123
  [24/07/06] We add support for a new method: [<u>Trace</u>](https://arxiv.org/abs/2406.11460), which refine text by constructing a knowledge graph. See it [<u>results</u>](#robot-supporting-methods) and [<u>details</u>](./docs/baseline_details.md).
@@ -182,9 +191,8 @@ From the official Faiss repository ([source](https://github.com/facebookresearch
182
191
  To build an index, you first need to save your corpus as a `jsonl` file with each line representing a document.
183
192
 
184
193
  ```jsonl
185
- {"id": "0", "contents": "content"}
186
- {"id": "1", "contents": "content"}
187
- ...
194
+ {"id": "0", "contents": "..."}
195
+ {"id": "1", "contents": "..."}
188
196
  ```
189
197
 
190
198
  If you want to use Wikipedia as your corpus, you can refer to our documentation [Processing Wikipedia](./docs/process-wiki.md) to convert it into an indexable format.
@@ -492,6 +500,49 @@ In each category, we have implemented corresponding common pipelines. Some pipel
492
500
  </tbody>
493
501
  </table>
494
502
 
503
+ ## :art: FlashRAG-UI
504
+ <p>With <strong>FlashRAG-UI</strong>, you can easily and quickly configure and experience the supported RAG methods through our meticulously designed visual interface, and evaluate these methods on benchmarks, making complex research work more efficient!</p>
505
+
506
+ ### :star2: Features
507
+ - **One-Click Configuration Loading**
508
+ - You can load parameters and configuration files for various RAG methods through simple clicks, selections, and inputs.</li>
509
+ - Supports preview interface for intuitive parameter settings.</li>
510
+ - Provides save functionality to easily store configurations for future use.</li>
511
+ - **Quick Method Experience**
512
+ - Quickly load corpora and index files to explore the characteristics and application scenarios of various RAG methods.</li>
513
+ - Supports loading and switching different components and hyperparameters, seamlessly connecting different RAG Pipelines to quickly experience their performance and differences!</li>
514
+ - **Efficient Benchmark Reproduction**
515
+ - Easily reproduce the built-in baseline methods and carefully collected benchmarks on FlashRAG-UI.</li>
516
+ - Use cutting-edge research tools directly without complex settings, providing a smooth experience for your research work!</li>
517
+
518
+ <details>
519
+ <summary>Show more</summary>
520
+ <table align="center">
521
+ <tr>
522
+ <td align="center">
523
+ <img src="./asset/demo_en1.jpg" alt="Image 1" width="505"/>
524
+ </td>
525
+ <td align="center">
526
+ <img src="./asset/demo_en2.jpg" alt="Image 2" width="505"/>
527
+ </td>
528
+ </tr>
529
+ <tr>
530
+ <td align="center">
531
+ <img src="./asset/demo_en4.png" alt="Image 3" width="500"/>
532
+ </td>
533
+ <td align="center">
534
+ <img src="./asset/demo_en3.jpg" alt="Image 4" width="500"/>
535
+ </td>
536
+ </tr>
537
+ </table>
538
+ </details>
539
+
540
+ #### Experience our meticulously designed FlashRAG-UI—both user-friendly and visually appealing:
541
+ ```bash
542
+ cd webui
543
+ python interface.py
544
+ ```
545
+
495
546
  ## :robot: Supporting Methods
496
547
 
497
548
  We have implemented 15 works with a consistent setting of:
@@ -525,6 +576,8 @@ It’s important to note that, to ensure consistency, we have utilized a uniform
525
576
  | [FLARE](https://arxiv.org/abs/2305.06983) | Loop | 22.5 | 55.8 | 28.0 | 33.9 | 20.7 | 20.2 | |
526
577
  | [Iter-Retgen](https://arxiv.org/abs/2305.15294), [ITRG](https://arxiv.org/abs/2310.05149) | Loop | 36.8 | 60.1 | 38.3 | 21.6 | 37.9 | 18.2 | |
527
578
  | [IRCoT](https://aclanthology.org/2023.acl-long.557.pdf) | Loop | 33.3 | 56.9 | 41.5 | 32.4 | 45.6 | 20.7 | |
579
+ | [RQRAG](https://arxiv.org/abs/2404.00610) | Loop | 32.6 | 52.5 | 33.5 | 35.8 | 46.4 | 26.2 | Use trained rqrag-llama2-7B |
580
+
528
581
 
529
582
  ## :notebook: Supporting Datasets & Document Corpus
530
583
 
@@ -589,7 +642,7 @@ Below is the list of datasets along with the corresponding sample sizes:
589
642
  Our toolkit supports jsonl format for retrieval document collections, with the following structure:
590
643
 
591
644
  ```jsonl
592
- {"id":"0", "contents": "...."}
645
+ {"id":"0", "contents": "..."}
593
646
  {"id":"1", "contents": "..."}
594
647
  ```
595
648
 
@@ -2,6 +2,7 @@ datasets
2
2
  base58
3
3
  nltk
4
4
  numpy
5
+ langid
5
6
  openai
6
7
  peft
7
8
  PyYAML
@@ -16,12 +17,14 @@ bm25s[core]==0.2.0
16
17
  fschat
17
18
  streamlit
18
19
  chonkie>=0.4.0
20
+ gradio==5.9.1
19
21
 
20
22
  [core]
21
23
  datasets
22
24
  base58
23
25
  nltk
24
26
  numpy
27
+ langid
25
28
  openai
26
29
  peft
27
30
  PyYAML
@@ -36,12 +39,14 @@ bm25s[core]==0.2.0
36
39
  fschat
37
40
  streamlit
38
41
  chonkie>=0.4.0
42
+ gradio==5.9.1
39
43
 
40
44
  [full]
41
45
  datasets
42
46
  base58
43
47
  nltk
44
48
  numpy
49
+ langid
45
50
  openai
46
51
  peft
47
52
  PyYAML
@@ -56,6 +61,7 @@ bm25s[core]==0.2.0
56
61
  fschat
57
62
  streamlit
58
63
  chonkie>=0.4.0
64
+ gradio==5.9.1
59
65
  pyserini
60
66
  sentence-transformers>=3.0.1
61
67
  vllm==0.5.5
@@ -1 +0,0 @@
1
- __version__ = "0.1.4dev20250111"