Skip to content

Commit

Permalink
Merge branch '0.6_dev' of github.com:OpenSPG/KAG into 0.6_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
northmachine committed Dec 27, 2024
2 parents e72f257 + 3b7dd83 commit cc73a02
Show file tree
Hide file tree
Showing 24 changed files with 265 additions and 119 deletions.
4 changes: 1 addition & 3 deletions kag/common/registry/registrable.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,7 @@ def from_config(
logger.warn(f"Failed to initialize class {cls}, info: {e}")
raise e
if len(params) > 0:
raise ConfigurationError(
f"These params are not used for constructing {cls}:\n{params}"
)
logger.warn(f"These params are not used for constructing {cls}:\n{params}")

return instant

Expand Down
17 changes: 12 additions & 5 deletions kag/examples/2wiki/kag_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,28 @@ vectorize_model: *id002
vectorizer: *id002

lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: resp_simple
reflector:
type: default_reflector
reasoner:
type: base
type: default_reasoner
lf_planner:
type: default_lf_planner
lf_executor:
type: base
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 5
search_api: &id003
type: openspg
type: openspg_search_api
graph_api: &id004
type: openspg
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 5
Expand All @@ -88,5 +95,5 @@ lf_solver_pipeline:
recall_num: 10
rerank_topk: 10
merger:
type: base
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
30 changes: 19 additions & 11 deletions kag/examples/baike/kag_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,42 @@ kag-indexer:
scanner:
type: dir



lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: default_resp_generator # kag.solver.prompt.default.resp_generator.RespGenerator
#type: resp_simple # solver.prompt.resp_generator.RespGenerator
type: default_resp_generator
reflector:
type: default_reflector
reasoner:
type: base
type: default_reasoner
lf_planner:
type: default_lf_planner
lf_executor:
type: base
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default
type: default_exact_kg_retriever
el_num: 5
search_api: &id003
type: openspg
type: openspg_search_api
graph_api: &id004
type: openspg
type: openspg_graph_api
fuzzy_kg_retriever:
type: default
type: default_fuzzy_kg_retriever
el_num: 5
vectorize_model: *id002
llm_client: *id001
search_api: *id003
graph_api: *id004
chunk_retriever: &id005
type: default
type: default_chunk_retriever
recall_num: 10
rerank_topk: 10
merger:
type: base
chunk_retriever: *id005
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
18 changes: 13 additions & 5 deletions kag/examples/hotpotqa/kag_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,30 @@ runner:
type: hotpotqa
vectorize_model: *id002
vectorizer: *id002

lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: resp_simple
reflector:
type: default_reflector
reasoner:
type: base
type: default_reasoner
lf_planner:
type: default_lf_planner
lf_executor:
type: base
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 5
search_api: &id003
type: openspg
type: openspg_search_api
graph_api: &id004
type: openspg
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 5
Expand All @@ -87,5 +95,5 @@ lf_solver_pipeline:
recall_num: 10
rerank_topk: 10
merger:
type: base
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
51 changes: 39 additions & 12 deletions kag/examples/medicine/kag_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,7 @@ extract_runner:
num_chains: 8
scanner:
type: csv
lf_solver_pipeline:
generator:
generate_prompt:
type: example_resp_generator
reasoner:
lf_solver:
chunk_retriever:
ner_prompt:
type: example_medical_question_ner
type: kag
kg_retriever:
type: base

llm: *id001
log:
level: INFO
Expand Down Expand Up @@ -85,3 +74,41 @@ vectorize_model: *id002
vectorizer:
type: batch
vectorize_model: *id002

lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: example_resp_generator
reflector:
type: default_reflector
reasoner:
type: default_reasoner
lf_planner:
type: default_lf_planner
lf_executor:
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 5
search_api: &id003
type: openspg_search_api
graph_api: &id004
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 5
vectorize_model: *id002
llm_client: *id001
search_api: *id003
graph_api: *id004
chunk_retriever: &id005
type: default_chunk_retriever
recall_num: 10
rerank_topk: 10
merger:
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
19 changes: 13 additions & 6 deletions kag/examples/musique/kag_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,28 @@ vectorize_model: *id002
vectorizer: *id002

lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: resp_simple
reflector:
type: default_reflector
reasoner:
type: base
type: default_reasoner
lf_planner:
type: default_lf_planner
lf_executor:
type: base
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 5
search_api: &id003
type: openspg
type: openspg_search_api
graph_api: &id004
type: openspg
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 5
Expand All @@ -88,5 +95,5 @@ lf_solver_pipeline:
recall_num: 10
rerank_topk: 10
merger:
type: base
chunk_retriever: *id005
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
56 changes: 44 additions & 12 deletions kag/examples/riskmining/kag_config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
lf_solver_pipeline:
reasoner:
lf_planner:
logic_form_plan_prompt:
type: riskmining_lf_plan
type: base
generator:
generate_prompt:
type: resp_riskmining
llm:
llm: &id001
api_key: key
base_url: https://api.deepseek.com
model: deepseek-chat
Expand All @@ -20,9 +11,50 @@ project:
id: '4'
language: zh
namespace: RiskMining
vectorize_model: &id001
vectorize_model: &id002
type: mock
vector_dimensions: 768
vectorizer:
type: batch
vectorize_model: *id001
vectorize_model: *id002


lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: resp_riskmining
reflector:
type: default_reflector
reasoner:
type: default_reasoner
lf_planner:
logic_form_plan_prompt:
type: riskmining_lf_plan
type: default_lf_planner
lf_executor:
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 1
search_api: &id003
type: openspg_search_api
graph_api: &id004
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 1
vectorize_model: *id002
llm_client: *id001
search_api: *id003
graph_api: *id004
chunk_retriever: &id005
type: default_chunk_retriever
recall_num: 10
rerank_topk: 10
merger:
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
56 changes: 44 additions & 12 deletions kag/examples/supplychain/kag_config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
lf_solver_pipeline:
reasoner:
lf_planner:
logic_form_plan_prompt:
type: supplychain_lf_plan
type: base
generator:
generate_prompt:
type: resp_supplychain
llm:
llm: &id001
api_key: key
base_url: https://api.deepseek.com
model: deepseek-chat
Expand All @@ -20,9 +11,50 @@ project:
id: '5'
language: zh
namespace: SupplyChain
vectorize_model: &id001
vectorize_model: &id002
type: mock
vector_dimensions: 768
vectorizer:
type: batch
vectorize_model: *id001
vectorize_model: *id002


lf_solver_pipeline:
memory: default_memory
max_iterations: 3
generator:
type: default_generator
generate_prompt:
type: resp_supplychain
reflector:
type: default_reflector
reasoner:
type: default_reasoner
lf_planner:
logic_form_plan_prompt:
type: supplychain_lf_plan
type: default_lf_planner
lf_executor:
type: default_lf_executor
force_chunk_retriever: true
exact_kg_retriever:
type: default_exact_kg_retriever
el_num: 1
search_api: &id003
type: openspg_search_api
graph_api: &id004
type: openspg_graph_api
fuzzy_kg_retriever:
type: default_fuzzy_kg_retriever
el_num: 1
vectorize_model: *id002
llm_client: *id001
search_api: *id003
graph_api: *id004
chunk_retriever: &id005
type: default_chunk_retriever
recall_num: 10
rerank_topk: 10
merger:
type: default_lf_sub_query_res_merger
chunk_retriever: *id005
Loading

0 comments on commit cc73a02

Please sign in to comment.