modular-rag-simple 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,83 @@
1
+ Metadata-Version: 2.4
2
+ Name: modular_rag_simple
3
+ Version: 0.1.0
4
+ Summary: A simple modular RAG retrieval class based on LangChain
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: chromadb
8
+ Requires-Dist: langchain-chroma
9
+ Requires-Dist: langchain-community
10
+ Requires-Dist: langchain-core
11
+ Requires-Dist: langchain-openai
12
+ Requires-Dist: langchain-classic
13
+ Requires-Dist: jieba
14
+ Requires-Dist: rank-bm25
15
+ Requires-Dist: python-dotenv
16
+ Requires-Dist: dashscope
17
+ Provides-Extra: publish
18
+ Requires-Dist: build; extra == "publish"
19
+ Requires-Dist: twine; extra == "publish"
20
+
21
+ # modular_rag_simple
22
+
23
+ 提供一个 `ModulaRag` 类,可以对向量数据库内容进行查询并返回llm回答。
24
+
25
+ Python 3.11 及以上。
26
+
27
+ ## 安装
28
+
29
+ ```bash
30
+ pip install modular_rag_simple
31
+ ```
32
+
33
+ ## 使用
34
+
35
+ ```python
36
+ from modular_rag_simple import ModularRag
37
+
38
+ rag = ModularRag({
39
+ "persist_directory": "./chroma_db",
40
+ "collection_name": "study",
41
+ "embedding_model": "text-embedding-v4",
42
+ "top_k": 5,
43
+ "recall_top_k": 20,
44
+ "pre_retrieval": {
45
+ "enabled": False,
46
+ "rewrite_query": False,
47
+ "hyde": False,
48
+ "model": "qwen-plus",
49
+ },
50
+ "hybrid_retrieval": {
51
+ "enabled": True,
52
+ "weights": [0.5, 0.5],
53
+ },
54
+ "post_retrieval": {
55
+ "enabled": True,
56
+ "deduplicate": True,
57
+ "rerank": False,
58
+ "rerank_model": "qwen3-rerank",
59
+ "similarity_filter": False,
60
+ "similarity_threshold": 0.4,
61
+ "compress_context": False,
62
+ "llm_model": "qwen-plus",
63
+ "reorder": False,
64
+ },
65
+ })
66
+
67
+ results = rag.search("公司打卡时间?")
68
+ for document in results:
69
+ print(document.metadata)
70
+ print(document.page_content)
71
+ ```
72
+
73
+ ## 环境变量
74
+
75
+ 需要配置通义 API Key:
76
+
77
+ ```bash
78
+ export DASHSCOPE_API_KEY="你的 API Key"
79
+ 或
80
+ setx DASHSCOPE_API_KEY="你的 API Key"
81
+ ```
82
+
83
+ `persist_directory` 指向已经完成入库的 Chroma 数据库。这个包当前只提供在线检索,不包含你的个人知识库数据,也不会自动创建或导入知识库。
@@ -0,0 +1,4 @@
1
+ modular_rag_simple-0.1.0.dist-info/METADATA,sha256=q4HTQqcGTf804_MnYYQmpGr6crxcLZmkb23r6xaXzHQ,2130
2
+ modular_rag_simple-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
3
+ modular_rag_simple-0.1.0.dist-info/top_level.txt,sha256=O-qFzdfAhe5_bM75hPBZD-zNaHIq179w71NGmxR-2ss,19
4
+ modular_rag_simple-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ modular_rag_simple