adam-community 1.0.9__py3-none-any.whl → 1.0.10__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.
- adam_community/__version__.py +1 -1
- adam_community/util.py +27 -12
- {adam_community-1.0.9.dist-info → adam_community-1.0.10.dist-info}/METADATA +1 -1
- {adam_community-1.0.9.dist-info → adam_community-1.0.10.dist-info}/RECORD +7 -7
- {adam_community-1.0.9.dist-info → adam_community-1.0.10.dist-info}/WHEEL +0 -0
- {adam_community-1.0.9.dist-info → adam_community-1.0.10.dist-info}/entry_points.txt +0 -0
- {adam_community-1.0.9.dist-info → adam_community-1.0.10.dist-info}/top_level.txt +0 -0
adam_community/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.10"
|
adam_community/util.py
CHANGED
|
@@ -19,8 +19,31 @@ ADAM_TASK_ID = os.getenv('ADAM_TASK_ID')
|
|
|
19
19
|
ADAM_USER_ID = os.getenv('ADAM_USER_ID')
|
|
20
20
|
CONDA_ENV = os.getenv('CONDA_ENV')
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
def _build_akb_query_command(query: str, collection: str) -> str:
|
|
24
|
+
"""
|
|
25
|
+
构建 akb 查询命令,包含目录存在性检查
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
query: 查询字符串
|
|
29
|
+
collection: 知识库名称
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
完整的 bash 命令字符串
|
|
33
|
+
"""
|
|
34
|
+
collection_dir = f"/share/programs/akb/database/{collection}"
|
|
35
|
+
|
|
36
|
+
return f"""if [ ! -d "{collection_dir}" ]; then
|
|
37
|
+
echo "知识库目录不存在: {collection_dir}"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
akb simple-query \\
|
|
41
|
+
-i {collection_dir}/{collection}.index \\
|
|
42
|
+
-m /share/programs/BAAI/bge-m3 \\
|
|
43
|
+
-p {collection_dir}/{collection}.parquet \\
|
|
44
|
+
-l 5 \\
|
|
45
|
+
-f json -q "{query}\""""
|
|
46
|
+
|
|
24
47
|
|
|
25
48
|
class RAG:
|
|
26
49
|
"""
|
|
@@ -31,17 +54,9 @@ class RAG:
|
|
|
31
54
|
"""
|
|
32
55
|
|
|
33
56
|
def call(self, query: str, collection: str):
|
|
34
|
-
|
|
35
|
-
if collection not in collections:
|
|
36
|
-
raise ValueError(f"知识库名称必须是下面之一:{collections}")
|
|
37
|
-
|
|
38
|
-
cmd = f"""akb simple-query \
|
|
39
|
-
-i /share/programs/akb/database/{collection}/{collection}.index \
|
|
40
|
-
-m /share/programs/BAAI/bge-m3 \
|
|
41
|
-
-p /share/programs/akb/database/{collection}/{collection}.parquet \
|
|
42
|
-
-l 5 \
|
|
43
|
-
-f json -q \"{query}\""""
|
|
57
|
+
cmd = _build_akb_query_command(query, collection)
|
|
44
58
|
logger.info(f"搜索知识库 {collection}: {query}")
|
|
59
|
+
|
|
45
60
|
try:
|
|
46
61
|
result = run(cmd, shell='/bin/bash', check=True, text=True, capture_output=True)
|
|
47
62
|
except CalledProcessError as e:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
adam_community/__init__.py,sha256=vAmF9VQR6D4peppH0hnrHDmZK5cFeFPh11GIsTKUXhE,429
|
|
2
|
-
adam_community/__version__.py,sha256=
|
|
2
|
+
adam_community/__version__.py,sha256=5vGk-8GWz6jojEu9w36UP5aNA0LuiwgbNSJ8Umn2rLA,23
|
|
3
3
|
adam_community/tool.py,sha256=CCzWosxtuZ0yk7mupmnlgMpO59jr1hl-a_brSGIqhDI,4867
|
|
4
|
-
adam_community/util.py,sha256=
|
|
4
|
+
adam_community/util.py,sha256=fkZn0HMM7Hk2e_UnF8rARvp1vvHMcnKRi1L0wHEFgGo,11177
|
|
5
5
|
adam_community/cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
6
6
|
adam_community/cli/build.py,sha256=uPS_UUMLAAWQJlMfQ0S6Ed6UIeZ_1eeXfViPmvzvD_E,11214
|
|
7
7
|
adam_community/cli/cli.py,sha256=L_V09KMWuasgdce6zrB2yNOpCl8G7k7C_oKWvLEzS5k,2810
|
|
@@ -19,8 +19,8 @@ adam_community/cli/templates/input.json.j2,sha256=LRkIhPln3BnmPRrFebsjUa5t9vcED_
|
|
|
19
19
|
adam_community/cli/templates/kit_python.py.j2,sha256=fVQ8EVDMaxPCv9CzYjjoV8NLJMmtVCx5tFaM9eO7f8M,2788
|
|
20
20
|
adam_community/cli/templates/long_description.md.j2,sha256=Rj6hcuNzEL0Sp17GQVCRJyNytxO22KcKFvEnZlGpevE,1385
|
|
21
21
|
adam_community/cli/templates/toolbox_python.py.j2,sha256=EOnmsJUvQRrcO7K7c88kI42gMmcM0Z4ab46qwOJXbH8,4192
|
|
22
|
-
adam_community-1.0.
|
|
23
|
-
adam_community-1.0.
|
|
24
|
-
adam_community-1.0.
|
|
25
|
-
adam_community-1.0.
|
|
26
|
-
adam_community-1.0.
|
|
22
|
+
adam_community-1.0.10.dist-info/METADATA,sha256=DQn1WGLxp9K-U2rWzKSzl4I6ILHtI95tfqkMU3SG2jY,2172
|
|
23
|
+
adam_community-1.0.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
24
|
+
adam_community-1.0.10.dist-info/entry_points.txt,sha256=4I7yRkn7cHwPY8-fWQLeAvKjc24zUy8Z65VsZNs0Wos,56
|
|
25
|
+
adam_community-1.0.10.dist-info/top_level.txt,sha256=MS8jbePXKZChih9kGizNVX0I1MFZFGWBMCIW_r86qhU,15
|
|
26
|
+
adam_community-1.0.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|