Skip to content

Commit 8a9e927

Browse files
authored
fix(builder): add 0.8 config (#610)
* change 0.8.0 config * add open benchmark * add open benchmark * add open benchmark * fix concept commit * fix concept commit
1 parent 1c99bd4 commit 8a9e927

21 files changed

Lines changed: 391 additions & 331 deletions

File tree

kag/common/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ def init_env(config_file: str = None):
261261
else:
262262
msg = "Done init config from local file"
263263
logger.debug(msg)
264-
os.environ[KAGConstants.ENV_KAG_PROJECT_ID] = str(KAG_PROJECT_CONF.project_id)
265-
os.environ[KAGConstants.ENV_KAG_PROJECT_HOST_ADDR] = str(KAG_PROJECT_CONF.host_addr)
264+
if KAG_PROJECT_CONF.project_id:
265+
os.environ[KAGConstants.ENV_KAG_PROJECT_ID] = str(KAG_PROJECT_CONF.project_id)
266+
if KAG_PROJECT_CONF.host_addr:
267+
os.environ[KAGConstants.ENV_KAG_PROJECT_HOST_ADDR] = str(
268+
KAG_PROJECT_CONF.host_addr
269+
)
266270
if len(KAG_CONFIG.all_config) > 0:
267271
dump_flag = os.getenv(KAGConstants.ENV_KAG_DEBUG_DUMP_CONFIG)
268272
if dump_flag is not None and dump_flag.strip() == "1":

kag/examples/FinAlibaba/kag_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ kag_solver_pipeline:
179179
executors:
180180
- *retriever
181181
generator:
182-
type: llm_generator
182+
type: llm_index_generator
183183
llm_client: *chat_llm
184184
generated_prompt:
185185
type: default_multi_hop_generator

kag/examples/baike/kag_config.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ graph_api: &graph_api
7474
type: openspg_graph_api #kag.solver.tools.graph_api.impl.openspg_graph_api.OpenSPGGraphApi
7575

7676

77+
7778
kg_cs: &kg_cs
7879
type: kg_cs_open_spg
80+
priority: 0
7981
path_select:
8082
type: exact_one_hop_select
8183
graph_api: *graph_api
@@ -87,9 +89,14 @@ kg_cs: &kg_cs
8789
recognition_threshold: 0.9
8890
exclude_types:
8991
- Chunk
92+
- AtomicQuery
93+
- KnowledgeUnit
94+
- Summary
95+
- Outline
96+
- Doc
9097

9198
kg_fr: &kg_fr
92-
type: kg_fr_open_spg
99+
type: kg_fr_knowledge_unit
93100
top_k: 20
94101
graph_api: *graph_api
95102
search_api: *search_api
@@ -111,12 +118,18 @@ kg_fr: &kg_fr
111118
recognition_threshold: 0.8
112119
exclude_types:
113120
- Chunk
121+
- AtomicQuery
122+
- KnowledgeUnit
123+
- Summary
124+
- Outline
125+
- Doc
114126

115127
rc: &rc
116128
type: rc_open_spg
117129
vector_chunk_retriever:
118-
type: vector_chunk_retriever_legacy
130+
type: vector_chunk_retriever
119131
vectorize_model: *vectorize_model
132+
score_threshold: 0.65
120133
search_api: *search_api
121134
graph_api: *graph_api
122135
search_api: *search_api
@@ -135,12 +148,16 @@ kag_hybrid_executor: &kag_hybrid_executor_conf
135148

136149
kag_output_executor: &kag_output_executor_conf
137150
type: kag_output_executor
151+
llm_module: *chat_llm
152+
138153
kag_deduce_executor: &kag_deduce_executor_conf
139154
type: kag_deduce_executor
155+
llm_module: *chat_llm
140156

141157
py_code_based_math_executor: &py_code_based_math_executor_conf
142158
type: py_code_based_math_executor
143-
llm: *openie_llm
159+
llm: *chat_llm
160+
144161

145162
kag_solver_pipeline:
146163
type: kag_static_pipeline
@@ -157,7 +174,7 @@ kag_solver_pipeline:
157174
- *kag_deduce_executor_conf
158175
- *kag_output_executor_conf
159176
generator:
160-
type: llm_generator
177+
type: llm_index_generator
161178
llm_client: *chat_llm
162179
generated_prompt:
163180
type: default_refer_generator_prompt
Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,122 @@
11
namespace BaiKe
22

3+
SemanticConcept(语义概念): EntityType
4+
properties:
5+
desc(内容): Text
6+
index: Text
7+
isA(上位): SemanticConcept
8+
39
ArtificialObject(人造物体): EntityType
410
properties:
511
desc(描述): Text
612
index: TextAndVector
7-
semanticType(语义类型): Text
8-
index: Text
13+
semanticType(语义类型): SemanticConcept
14+
synonyms(同义词): ArtificialObject
15+
officialName(标准名): ArtificialObject
916

1017
Astronomy(天文学): EntityType
1118
properties:
1219
desc(描述): Text
1320
index: TextAndVector
14-
semanticType(语义类型): Text
15-
index: Text
21+
semanticType(语义类型): SemanticConcept
22+
synonyms(同义词): Astronomy
23+
officialName(标准名): Astronomy
1624

1725
Building(建筑): EntityType
1826
properties:
1927
desc(描述): Text
2028
index: TextAndVector
21-
semanticType(语义类型): Text
22-
index: Text
29+
semanticType(语义类型): SemanticConcept
30+
synonyms(同义词): Building
31+
officialName(标准名): Building
2332

2433
Creature(生物): EntityType
2534
properties:
2635
desc(描述): Text
2736
index: TextAndVector
28-
semanticType(语义类型): Text
29-
index: Text
37+
semanticType(语义类型): SemanticConcept
38+
synonyms(同义词): Creature
39+
officialName(标准名): Creature
3040

3141
Concept(概念): EntityType
3242
properties:
3343
desc(描述): Text
3444
index: TextAndVector
35-
semanticType(语义类型): Text
36-
index: Text
45+
semanticType(语义类型): SemanticConcept
46+
synonyms(同义词): Concept
47+
officialName(标准名): Concept
3748

3849
Date(日期): EntityType
3950
properties:
4051
desc(描述): Text
4152
index: TextAndVector
42-
semanticType(语义类型): Text
43-
index: Text
53+
semanticType(语义类型): SemanticConcept
54+
synonyms(同义词): Date
55+
officialName(标准名): Date
4456

4557
GeographicLocation(地理位置): EntityType
4658
properties:
4759
desc(描述): Text
4860
index: TextAndVector
49-
semanticType(语义类型): Text
50-
index: Text
61+
semanticType(语义类型): SemanticConcept
62+
synonyms(同义词): GeographicLocation
63+
officialName(标准名): GeographicLocation
5164

5265
Keyword(关键词): EntityType
5366
properties:
5467
desc(描述): Text
5568
index: TextAndVector
56-
semanticType(语义类型): Text
57-
index: Text
69+
semanticType(语义类型): SemanticConcept
70+
synonyms(同义词): Keyword
71+
officialName(标准名): Keyword
5872

5973
Medicine(药物): EntityType
6074
properties:
6175
desc(描述): Text
6276
index: TextAndVector
63-
semanticType(语义类型): Text
64-
index: Text
65-
77+
semanticType(语义类型): SemanticConcept
78+
synonyms(同义词): Medicine
79+
officialName(标准名): Medicine
6680

6781
NaturalScience(自然科学): EntityType
6882
properties:
6983
desc(描述): Text
7084
index: TextAndVector
71-
semanticType(语义类型): Text
72-
index: Text
85+
semanticType(语义类型): SemanticConcept
86+
synonyms(同义词): NaturalScience
87+
officialName(标准名): NaturalScience
7388

7489
Organization(组织机构): EntityType
7590
properties:
7691
desc(描述): Text
7792
index: TextAndVector
78-
semanticType(语义类型): Text
79-
index: Text
93+
semanticType(语义类型): SemanticConcept
94+
synonyms(同义词): Organization
95+
officialName(标准名): Organization
8096

8197
Person(人物): EntityType
8298
properties:
8399
desc(描述): Text
84100
index: TextAndVector
85-
semanticType(语义类型): Text
86-
index: Text
101+
semanticType(语义类型): SemanticConcept
102+
synonyms(同义词): Person
103+
officialName(标准名): Person
87104

88105
Transport(运输): EntityType
89106
properties:
90107
desc(描述): Text
91108
index: TextAndVector
92-
semanticType(语义类型): Text
93-
index: Text
109+
semanticType(语义类型): SemanticConcept
110+
synonyms(同义词): Transport
111+
officialName(标准名): Transport
94112

95113
Works(作品): EntityType
96114
properties:
97115
desc(描述): Text
98116
index: TextAndVector
99-
semanticType(语义类型): Text
100-
index: Text
101-
102-
Others(其他): EntityType
103-
properties:
104-
desc(描述): Text
105-
index: TextAndVector
106-
semanticType(语义类型): Text
107-
index: Text
117+
semanticType(语义类型): SemanticConcept
118+
synonyms(同义词): Works
119+
officialName(标准名): Works
108120

109121
Event(事件): EventType
110122
properties:
@@ -118,8 +130,10 @@ Event(事件): EventType
118130
type(事件类型): Text
119131
index: Text
120132

121-
122-
SemanticConcept(语义概念): EntityType
133+
Others(其他): EntityType
123134
properties:
124-
desc(内容): Text
125-
index: Text
135+
desc(描述): Text
136+
index: TextAndVector
137+
semanticType(语义类型): SemanticConcept
138+
synonyms(同义词): Others
139+
officialName(标准名): Others

kag/examples/csqa/kag_config.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ chain_vectorizer:
7979

8080
kg_cs: &kg_cs
8181
type: kg_cs_open_spg
82+
priority: 0
8283
path_select:
8384
type: exact_one_hop_select
8485
graph_api: *graph_api
@@ -90,6 +91,11 @@ kg_cs: &kg_cs
9091
recognition_threshold: 0.9
9192
exclude_types:
9293
- Chunk
94+
- AtomicQuery
95+
- KnowledgeUnit
96+
- Summary
97+
- Outline
98+
- Doc
9399

94100
kg_fr: &kg_fr
95101
type: kg_fr_open_spg
@@ -114,28 +120,24 @@ kg_fr: &kg_fr
114120
recognition_threshold: 0.8
115121
exclude_types:
116122
- Chunk
123+
- AtomicQuery
124+
- KnowledgeUnit
125+
- Summary
126+
- Outline
127+
- Doc
117128

118129
rc: &rc
119130
type: rc_open_spg
120131
vector_chunk_retriever:
121-
type: vector_chunk_retriever_legacy
132+
type: vector_chunk_retriever
122133
vectorize_model: *vectorize_model
134+
score_threshold: 0.65
123135
search_api: *search_api
124136
graph_api: *graph_api
125137
search_api: *search_api
126138
vectorize_model: *vectorize_model
127139
top_k: 20
128140

129-
kag_merger:
130-
type: kg_merger
131-
top_k: 20
132-
llm_module: *chat_llm
133-
summary_prompt:
134-
type: default_thought_then_answer
135-
vectorize_model: *vectorize_model
136-
graph_api: *graph_api
137-
search_api: *search_api
138-
139141
kag_hybrid_executor: &kag_hybrid_executor_conf
140142
type: kag_hybrid_retrieval_executor
141143
retrievers:
@@ -144,19 +146,21 @@ kag_hybrid_executor: &kag_hybrid_executor_conf
144146
- *rc
145147
merger:
146148
type: kag_merger
147-
enable_summary: true
149+
enable_summary: true
148150

149151
kag_output_executor: &kag_output_executor_conf
150152
type: kag_output_executor
153+
llm_module: *chat_llm
151154

152155
kag_deduce_executor: &kag_deduce_executor_conf
153156
type: kag_deduce_executor
154-
157+
llm_module: *chat_llm
155158

156159
py_code_based_math_executor: &py_code_based_math_executor_conf
157160
type: py_code_based_math_executor
158161
llm: *chat_llm
159162

163+
160164
kag_solver_pipeline:
161165
type: kag_static_pipeline
162166
planner:
@@ -172,7 +176,7 @@ kag_solver_pipeline:
172176
- *kag_deduce_executor_conf
173177
- *kag_output_executor_conf
174178
generator:
175-
type: llm_generator
179+
type: llm_index_generator
176180
llm_client: *chat_llm
177181
generated_prompt:
178182
type: default_refer_generator_prompt

0 commit comments

Comments
 (0)