Upload 23 files
Browse files- config/extracted_sample.yaml +40 -0
- config/gpu/compact_openai.yaml +97 -0
- config/gpu/compact_openai_korean.yaml +95 -0
- config/gpu/full_no_rerank_openai.yaml +139 -0
- config/gpu/half_openai.yaml +110 -0
- config/gpu/half_openai_korean.yaml +128 -0
- config/gpu_api/compact_openai.yaml +102 -0
- config/gpu_api/compact_openai_korean.yaml +100 -0
- config/gpu_api/full_no_rerank_openai.yaml +144 -0
- config/gpu_api/half_openai.yaml +115 -0
- config/gpu_api/half_openai_korean.yaml +133 -0
- config/non_gpu/compact_openai.yaml +81 -0
- config/non_gpu/compact_openai_korean.yaml +79 -0
- config/non_gpu/full_no_rerank_openai.yaml +123 -0
- config/non_gpu/half_openai.yaml +94 -0
- config/non_gpu/half_openai_korean.yaml +112 -0
- config/non_gpu/simple_openai.yaml +25 -0
- config/non_gpu/simple_openai_korean.yaml +26 -0
- sample_data/corpus_data_sample.parquet +3 -0
- sample_data/qa_data_sample.parquet +3 -0
- src/__pycache__/runner.cpython-310.pyc +0 -0
- src/runner.py +97 -0
- web.py +326 -0
config/extracted_sample.yaml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
modules:
|
6 |
+
- module_type: vectordb
|
7 |
+
embedding_model: openai
|
8 |
+
top_k: 3
|
9 |
+
strategy:
|
10 |
+
metrics:
|
11 |
+
- retrieval_f1
|
12 |
+
- retrieval_recall
|
13 |
+
- retrieval_precision
|
14 |
+
- node_line_name: post_retrieve_node_line
|
15 |
+
nodes:
|
16 |
+
- node_type: prompt_maker
|
17 |
+
modules:
|
18 |
+
- module_type: fstring
|
19 |
+
prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : "
|
20 |
+
strategy:
|
21 |
+
generator_modules:
|
22 |
+
- batch: 2
|
23 |
+
llm: openai
|
24 |
+
module_type: llama_index_llm
|
25 |
+
metrics:
|
26 |
+
- bleu
|
27 |
+
- meteor
|
28 |
+
- rouge
|
29 |
+
- node_type: generator
|
30 |
+
modules:
|
31 |
+
- batch: 2
|
32 |
+
llm: openai
|
33 |
+
model: gpt-3.5-turbo-16k
|
34 |
+
module_type: llama_index_llm
|
35 |
+
strategy:
|
36 |
+
metrics:
|
37 |
+
- metric_name: bleu
|
38 |
+
- metric_name: meteor
|
39 |
+
- embedding_model: openai
|
40 |
+
metric_name: sem_score
|
config/gpu/compact_openai.yaml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: rankgpt
|
43 |
+
- module_type: colbert_reranker
|
44 |
+
- module_type: sentence_transformer_reranker
|
45 |
+
- module_type: flag_embedding_reranker
|
46 |
+
- module_type: flag_embedding_llm_reranker
|
47 |
+
- module_type: openvino_reranker
|
48 |
+
- node_type: passage_filter
|
49 |
+
strategy:
|
50 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
51 |
+
speed_threshold: 5
|
52 |
+
modules:
|
53 |
+
- module_type: pass_passage_filter
|
54 |
+
- module_type: similarity_threshold_cutoff
|
55 |
+
threshold: 0.85
|
56 |
+
- module_type: similarity_percentile_cutoff
|
57 |
+
percentile: 0.6
|
58 |
+
- module_type: threshold_cutoff
|
59 |
+
threshold: 0.85
|
60 |
+
- module_type: percentile_cutoff
|
61 |
+
percentile: 0.6
|
62 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
63 |
+
nodes:
|
64 |
+
- node_type: prompt_maker
|
65 |
+
strategy:
|
66 |
+
metrics:
|
67 |
+
- metric_name: bleu
|
68 |
+
- metric_name: meteor
|
69 |
+
- metric_name: rouge
|
70 |
+
- metric_name: sem_score
|
71 |
+
embedding_model: openai
|
72 |
+
speed_threshold: 10
|
73 |
+
generator_modules:
|
74 |
+
- module_type: llama_index_llm
|
75 |
+
llm: openai
|
76 |
+
model: [gpt-4o-mini]
|
77 |
+
modules:
|
78 |
+
- module_type: fstring
|
79 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
80 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
81 |
+
- module_type: long_context_reorder
|
82 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
83 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
84 |
+
- node_type: generator
|
85 |
+
strategy:
|
86 |
+
metrics:
|
87 |
+
- metric_name: bleu
|
88 |
+
- metric_name: meteor
|
89 |
+
- metric_name: rouge
|
90 |
+
- metric_name: sem_score
|
91 |
+
embedding_model: openai
|
92 |
+
speed_threshold: 10
|
93 |
+
modules:
|
94 |
+
- module_type: llama_index_llm
|
95 |
+
llm: [openai]
|
96 |
+
model: [gpt-4o-mini]
|
97 |
+
temperature: [0.5, 1.0]
|
config/gpu/compact_openai_korean.yaml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: rankgpt
|
43 |
+
- module_type: colbert_reranker
|
44 |
+
- module_type: sentence_transformer_reranker
|
45 |
+
- module_type: flag_embedding_reranker
|
46 |
+
- module_type: flag_embedding_llm_reranker
|
47 |
+
- module_type: openvino_reranker
|
48 |
+
- node_type: passage_filter
|
49 |
+
strategy:
|
50 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
51 |
+
speed_threshold: 5
|
52 |
+
modules:
|
53 |
+
- module_type: pass_passage_filter
|
54 |
+
- module_type: similarity_threshold_cutoff
|
55 |
+
threshold: 0.85
|
56 |
+
- module_type: similarity_percentile_cutoff
|
57 |
+
percentile: 0.6
|
58 |
+
- module_type: threshold_cutoff
|
59 |
+
threshold: 0.85
|
60 |
+
- module_type: percentile_cutoff
|
61 |
+
percentile: 0.6
|
62 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
63 |
+
nodes:
|
64 |
+
- node_type: prompt_maker
|
65 |
+
strategy:
|
66 |
+
metrics:
|
67 |
+
- metric_name: bleu
|
68 |
+
- metric_name: meteor
|
69 |
+
- metric_name: rouge
|
70 |
+
- metric_name: sem_score
|
71 |
+
embedding_model: openai
|
72 |
+
speed_threshold: 10
|
73 |
+
generator_modules:
|
74 |
+
- module_type: llama_index_llm
|
75 |
+
llm: openai
|
76 |
+
model: [gpt-4o-mini]
|
77 |
+
modules:
|
78 |
+
- module_type: fstring
|
79 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
80 |
+
- module_type: long_context_reorder
|
81 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
82 |
+
- node_type: generator
|
83 |
+
strategy:
|
84 |
+
metrics:
|
85 |
+
- metric_name: bleu
|
86 |
+
- metric_name: meteor
|
87 |
+
- metric_name: rouge
|
88 |
+
- metric_name: sem_score
|
89 |
+
embedding_model: openai
|
90 |
+
speed_threshold: 10
|
91 |
+
modules:
|
92 |
+
- module_type: llama_index_llm
|
93 |
+
llm: [openai]
|
94 |
+
model: [gpt-4o-mini]
|
95 |
+
temperature: [0.5, 1.0]
|
config/gpu/full_no_rerank_openai.yaml
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: pre_retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: query_expansion
|
5 |
+
strategy:
|
6 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
7 |
+
speed_threshold: 10
|
8 |
+
top_k: 10
|
9 |
+
retrieval_modules:
|
10 |
+
- module_type: bm25
|
11 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
12 |
+
- module_type: vectordb
|
13 |
+
embedding_model: openai
|
14 |
+
modules:
|
15 |
+
- module_type: pass_query_expansion
|
16 |
+
- module_type: query_decompose
|
17 |
+
generator_module_type: llama_index_llm
|
18 |
+
llm: openai
|
19 |
+
model: [ gpt-4o-mini ]
|
20 |
+
- module_type: hyde
|
21 |
+
generator_module_type: llama_index_llm
|
22 |
+
llm: openai
|
23 |
+
model: [ gpt-4o-mini ]
|
24 |
+
max_token: 64
|
25 |
+
- module_type: multi_query_expansion
|
26 |
+
generator_module_type: llama_index_llm
|
27 |
+
llm: openai
|
28 |
+
temperature: [ 0.2, 1.0 ]
|
29 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
30 |
+
nodes:
|
31 |
+
- node_type: retrieval
|
32 |
+
strategy:
|
33 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
34 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 10
|
37 |
+
modules:
|
38 |
+
- module_type: bm25
|
39 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
40 |
+
- module_type: vectordb
|
41 |
+
embedding_model: openai
|
42 |
+
embedding_batch: 256
|
43 |
+
- module_type: hybrid_rrf
|
44 |
+
weight_range: (4,80)
|
45 |
+
- module_type: hybrid_cc
|
46 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
47 |
+
weight_range: (0.0, 1.0)
|
48 |
+
test_weight_size: 101
|
49 |
+
- node_type: passage_augmenter
|
50 |
+
strategy:
|
51 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
52 |
+
speed_threshold: 5
|
53 |
+
top_k: 5
|
54 |
+
embedding_model: openai
|
55 |
+
modules:
|
56 |
+
- module_type: pass_passage_augmenter
|
57 |
+
- module_type: prev_next_augmenter
|
58 |
+
mode: next
|
59 |
+
- node_type: passage_reranker
|
60 |
+
strategy:
|
61 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
62 |
+
speed_threshold: 10
|
63 |
+
top_k: 5
|
64 |
+
modules:
|
65 |
+
- module_type: pass_reranker
|
66 |
+
- module_type: tart
|
67 |
+
- module_type: monot5
|
68 |
+
- module_type: upr
|
69 |
+
- module_type: rankgpt
|
70 |
+
- module_type: colbert_reranker
|
71 |
+
- module_type: sentence_transformer_reranker
|
72 |
+
- module_type: flag_embedding_reranker
|
73 |
+
- module_type: flag_embedding_llm_reranker
|
74 |
+
- module_type: openvino_reranker
|
75 |
+
- node_type: passage_filter
|
76 |
+
strategy:
|
77 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
78 |
+
speed_threshold: 5
|
79 |
+
modules:
|
80 |
+
- module_type: pass_passage_filter
|
81 |
+
- module_type: similarity_threshold_cutoff
|
82 |
+
threshold: 0.85
|
83 |
+
- module_type: similarity_percentile_cutoff
|
84 |
+
percentile: 0.6
|
85 |
+
- module_type: threshold_cutoff
|
86 |
+
threshold: 0.85
|
87 |
+
- module_type: percentile_cutoff
|
88 |
+
percentile: 0.6
|
89 |
+
- node_type: passage_compressor
|
90 |
+
strategy:
|
91 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
92 |
+
speed_threshold: 10
|
93 |
+
modules:
|
94 |
+
- module_type: pass_compressor
|
95 |
+
- module_type: tree_summarize
|
96 |
+
llm: openai
|
97 |
+
model: gpt-4o-mini
|
98 |
+
- module_type: refine
|
99 |
+
llm: openai
|
100 |
+
model: gpt-4o-mini
|
101 |
+
- module_type: longllmlingua
|
102 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
103 |
+
nodes:
|
104 |
+
- node_type: prompt_maker
|
105 |
+
strategy:
|
106 |
+
metrics:
|
107 |
+
- metric_name: bleu
|
108 |
+
- metric_name: meteor
|
109 |
+
- metric_name: rouge
|
110 |
+
- metric_name: sem_score
|
111 |
+
embedding_model: openai
|
112 |
+
- metric_name: g_eval
|
113 |
+
speed_threshold: 10
|
114 |
+
generator_modules:
|
115 |
+
- module_type: llama_index_llm
|
116 |
+
llm: openai
|
117 |
+
model: [gpt-4o-mini]
|
118 |
+
modules:
|
119 |
+
- module_type: fstring
|
120 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
121 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
122 |
+
- module_type: long_context_reorder
|
123 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
124 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
125 |
+
- node_type: generator
|
126 |
+
strategy:
|
127 |
+
metrics:
|
128 |
+
- metric_name: bleu
|
129 |
+
- metric_name: meteor
|
130 |
+
- metric_name: rouge
|
131 |
+
- metric_name: sem_score
|
132 |
+
embedding_model: openai
|
133 |
+
- metric_name: g_eval
|
134 |
+
speed_threshold: 10
|
135 |
+
modules:
|
136 |
+
- module_type: llama_index_llm
|
137 |
+
llm: [openai]
|
138 |
+
model: [gpt-4o-mini]
|
139 |
+
temperature: [0.5, 1.0]
|
config/gpu/half_openai.yaml
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: rankgpt
|
43 |
+
- module_type: colbert_reranker
|
44 |
+
- module_type: sentence_transformer_reranker
|
45 |
+
- module_type: flag_embedding_reranker
|
46 |
+
- module_type: flag_embedding_llm_reranker
|
47 |
+
- module_type: openvino_reranker
|
48 |
+
- node_type: passage_filter
|
49 |
+
strategy:
|
50 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
51 |
+
speed_threshold: 5
|
52 |
+
modules:
|
53 |
+
- module_type: pass_passage_filter
|
54 |
+
- module_type: similarity_threshold_cutoff
|
55 |
+
threshold: 0.85
|
56 |
+
- module_type: similarity_percentile_cutoff
|
57 |
+
percentile: 0.6
|
58 |
+
- module_type: threshold_cutoff
|
59 |
+
threshold: 0.85
|
60 |
+
- module_type: percentile_cutoff
|
61 |
+
percentile: 0.6
|
62 |
+
- node_type: passage_compressor
|
63 |
+
strategy:
|
64 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
65 |
+
speed_threshold: 10
|
66 |
+
modules:
|
67 |
+
- module_type: pass_compressor
|
68 |
+
- module_type: tree_summarize
|
69 |
+
llm: openai
|
70 |
+
model: gpt-4o-mini
|
71 |
+
- module_type: refine
|
72 |
+
llm: openai
|
73 |
+
model: gpt-4o-mini
|
74 |
+
- module_type: longllmlingua
|
75 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
76 |
+
nodes:
|
77 |
+
- node_type: prompt_maker
|
78 |
+
strategy:
|
79 |
+
metrics:
|
80 |
+
- metric_name: bleu
|
81 |
+
- metric_name: meteor
|
82 |
+
- metric_name: rouge
|
83 |
+
- metric_name: sem_score
|
84 |
+
embedding_model: openai
|
85 |
+
speed_threshold: 10
|
86 |
+
generator_modules:
|
87 |
+
- module_type: llama_index_llm
|
88 |
+
llm: openai
|
89 |
+
model: [gpt-4o-mini]
|
90 |
+
modules:
|
91 |
+
- module_type: fstring
|
92 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
93 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
94 |
+
- module_type: long_context_reorder
|
95 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
96 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
97 |
+
- node_type: generator
|
98 |
+
strategy:
|
99 |
+
metrics:
|
100 |
+
- metric_name: bleu
|
101 |
+
- metric_name: meteor
|
102 |
+
- metric_name: rouge
|
103 |
+
- metric_name: sem_score
|
104 |
+
embedding_model: openai
|
105 |
+
speed_threshold: 10
|
106 |
+
modules:
|
107 |
+
- module_type: llama_index_llm
|
108 |
+
llm: [openai]
|
109 |
+
model: [gpt-4o-mini]
|
110 |
+
temperature: [0.5, 1.0]
|
config/gpu/half_openai_korean.yaml
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: rankgpt
|
43 |
+
- module_type: colbert_reranker
|
44 |
+
- module_type: sentence_transformer_reranker
|
45 |
+
- module_type: flag_embedding_reranker
|
46 |
+
- module_type: flag_embedding_llm_reranker
|
47 |
+
- module_type: openvino_reranker
|
48 |
+
- node_type: passage_filter
|
49 |
+
strategy:
|
50 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
51 |
+
speed_threshold: 5
|
52 |
+
modules:
|
53 |
+
- module_type: pass_passage_filter
|
54 |
+
- module_type: similarity_threshold_cutoff
|
55 |
+
threshold: 0.85
|
56 |
+
- module_type: similarity_percentile_cutoff
|
57 |
+
percentile: 0.6
|
58 |
+
- module_type: threshold_cutoff
|
59 |
+
threshold: 0.85
|
60 |
+
- module_type: percentile_cutoff
|
61 |
+
percentile: 0.6
|
62 |
+
- node_type: passage_compressor
|
63 |
+
strategy:
|
64 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
65 |
+
speed_threshold: 10
|
66 |
+
modules:
|
67 |
+
- module_type: pass_compressor
|
68 |
+
- module_type: tree_summarize
|
69 |
+
llm: openai
|
70 |
+
model: gpt-4o-mini
|
71 |
+
prompt: |
|
72 |
+
여러 문맥 정보는 다음과 같습니다.\n
|
73 |
+
---------------------\n
|
74 |
+
{context_str}\n
|
75 |
+
---------------------\n
|
76 |
+
사전 지식이 아닌 여러 정보가 주어졌습니다,
|
77 |
+
질문에 대답하세요.\n
|
78 |
+
질문: {query_str}\n
|
79 |
+
답변:
|
80 |
+
- module_type: refine
|
81 |
+
llm: openai
|
82 |
+
model: gpt-4o-mini
|
83 |
+
prompt: |
|
84 |
+
원래 질문은 다음과 같습니다: {query_str}
|
85 |
+
기존 답변은 다음과 같습니다: {existing_answer}
|
86 |
+
아래에서 기존 답변을 정제할 수 있는 기회가 있습니다.
|
87 |
+
(필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다.
|
88 |
+
------------
|
89 |
+
{context_msg}
|
90 |
+
------------
|
91 |
+
새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다.
|
92 |
+
맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요.
|
93 |
+
정제된 답변:
|
94 |
+
- module_type: longllmlingua
|
95 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
96 |
+
nodes:
|
97 |
+
- node_type: prompt_maker
|
98 |
+
strategy:
|
99 |
+
metrics:
|
100 |
+
- metric_name: bleu
|
101 |
+
- metric_name: meteor
|
102 |
+
- metric_name: rouge
|
103 |
+
- metric_name: sem_score
|
104 |
+
embedding_model: openai
|
105 |
+
speed_threshold: 10
|
106 |
+
generator_modules:
|
107 |
+
- module_type: llama_index_llm
|
108 |
+
llm: openai
|
109 |
+
model: [gpt-4o-mini]
|
110 |
+
modules:
|
111 |
+
- module_type: fstring
|
112 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
113 |
+
- module_type: long_context_reorder
|
114 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
115 |
+
- node_type: generator
|
116 |
+
strategy:
|
117 |
+
metrics:
|
118 |
+
- metric_name: bleu
|
119 |
+
- metric_name: meteor
|
120 |
+
- metric_name: rouge
|
121 |
+
- metric_name: sem_score
|
122 |
+
embedding_model: openai
|
123 |
+
speed_threshold: 10
|
124 |
+
modules:
|
125 |
+
- module_type: llama_index_llm
|
126 |
+
llm: [openai]
|
127 |
+
model: [gpt-4o-mini]
|
128 |
+
temperature: [0.5, 1.0]
|
config/gpu_api/compact_openai.yaml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: cohere_reranker
|
43 |
+
- module_type: rankgpt
|
44 |
+
- module_type: jina_reranker
|
45 |
+
- module_type: colbert_reranker
|
46 |
+
- module_type: sentence_transformer_reranker
|
47 |
+
- module_type: flag_embedding_reranker
|
48 |
+
- module_type: flag_embedding_llm_reranker
|
49 |
+
- module_type: time_reranker
|
50 |
+
- module_type: openvino_reranker
|
51 |
+
- module_type: voyageai_reranker
|
52 |
+
- module_type: mixedbreadai_reranker
|
53 |
+
- node_type: passage_filter
|
54 |
+
strategy:
|
55 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
56 |
+
speed_threshold: 5
|
57 |
+
modules:
|
58 |
+
- module_type: pass_passage_filter
|
59 |
+
- module_type: similarity_threshold_cutoff
|
60 |
+
threshold: 0.85
|
61 |
+
- module_type: similarity_percentile_cutoff
|
62 |
+
percentile: 0.6
|
63 |
+
- module_type: threshold_cutoff
|
64 |
+
threshold: 0.85
|
65 |
+
- module_type: percentile_cutoff
|
66 |
+
percentile: 0.6
|
67 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
68 |
+
nodes:
|
69 |
+
- node_type: prompt_maker
|
70 |
+
strategy:
|
71 |
+
metrics:
|
72 |
+
- metric_name: bleu
|
73 |
+
- metric_name: meteor
|
74 |
+
- metric_name: rouge
|
75 |
+
- metric_name: sem_score
|
76 |
+
embedding_model: openai
|
77 |
+
speed_threshold: 10
|
78 |
+
generator_modules:
|
79 |
+
- module_type: llama_index_llm
|
80 |
+
llm: openai
|
81 |
+
model: [gpt-4o-mini]
|
82 |
+
modules:
|
83 |
+
- module_type: fstring
|
84 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
85 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
86 |
+
- module_type: long_context_reorder
|
87 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
88 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
89 |
+
- node_type: generator
|
90 |
+
strategy:
|
91 |
+
metrics:
|
92 |
+
- metric_name: bleu
|
93 |
+
- metric_name: meteor
|
94 |
+
- metric_name: rouge
|
95 |
+
- metric_name: sem_score
|
96 |
+
embedding_model: openai
|
97 |
+
speed_threshold: 10
|
98 |
+
modules:
|
99 |
+
- module_type: llama_index_llm
|
100 |
+
llm: [openai]
|
101 |
+
model: [gpt-4o-mini]
|
102 |
+
temperature: [0.5, 1.0]
|
config/gpu_api/compact_openai_korean.yaml
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: cohere_reranker
|
43 |
+
- module_type: rankgpt
|
44 |
+
- module_type: jina_reranker
|
45 |
+
- module_type: colbert_reranker
|
46 |
+
- module_type: sentence_transformer_reranker
|
47 |
+
- module_type: flag_embedding_reranker
|
48 |
+
- module_type: flag_embedding_llm_reranker
|
49 |
+
- module_type: time_reranker
|
50 |
+
- module_type: openvino_reranker
|
51 |
+
- module_type: voyageai_reranker
|
52 |
+
- module_type: mixedbreadai_reranker
|
53 |
+
- node_type: passage_filter
|
54 |
+
strategy:
|
55 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
56 |
+
speed_threshold: 5
|
57 |
+
modules:
|
58 |
+
- module_type: pass_passage_filter
|
59 |
+
- module_type: similarity_threshold_cutoff
|
60 |
+
threshold: 0.85
|
61 |
+
- module_type: similarity_percentile_cutoff
|
62 |
+
percentile: 0.6
|
63 |
+
- module_type: threshold_cutoff
|
64 |
+
threshold: 0.85
|
65 |
+
- module_type: percentile_cutoff
|
66 |
+
percentile: 0.6
|
67 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
68 |
+
nodes:
|
69 |
+
- node_type: prompt_maker
|
70 |
+
strategy:
|
71 |
+
metrics:
|
72 |
+
- metric_name: bleu
|
73 |
+
- metric_name: meteor
|
74 |
+
- metric_name: rouge
|
75 |
+
- metric_name: sem_score
|
76 |
+
embedding_model: openai
|
77 |
+
speed_threshold: 10
|
78 |
+
generator_modules:
|
79 |
+
- module_type: llama_index_llm
|
80 |
+
llm: openai
|
81 |
+
model: [gpt-4o-mini]
|
82 |
+
modules:
|
83 |
+
- module_type: fstring
|
84 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
85 |
+
- module_type: long_context_reorder
|
86 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
87 |
+
- node_type: generator
|
88 |
+
strategy:
|
89 |
+
metrics:
|
90 |
+
- metric_name: bleu
|
91 |
+
- metric_name: meteor
|
92 |
+
- metric_name: rouge
|
93 |
+
- metric_name: sem_score
|
94 |
+
embedding_model: openai
|
95 |
+
speed_threshold: 10
|
96 |
+
modules:
|
97 |
+
- module_type: llama_index_llm
|
98 |
+
llm: [openai]
|
99 |
+
model: [gpt-4o-mini]
|
100 |
+
temperature: [0.5, 1.0]
|
config/gpu_api/full_no_rerank_openai.yaml
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: pre_retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: query_expansion
|
5 |
+
strategy:
|
6 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
7 |
+
speed_threshold: 10
|
8 |
+
top_k: 10
|
9 |
+
retrieval_modules:
|
10 |
+
- module_type: bm25
|
11 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
12 |
+
- module_type: vectordb
|
13 |
+
embedding_model: openai
|
14 |
+
modules:
|
15 |
+
- module_type: pass_query_expansion
|
16 |
+
- module_type: query_decompose
|
17 |
+
generator_module_type: llama_index_llm
|
18 |
+
llm: openai
|
19 |
+
model: [ gpt-4o-mini ]
|
20 |
+
- module_type: hyde
|
21 |
+
generator_module_type: llama_index_llm
|
22 |
+
llm: openai
|
23 |
+
model: [ gpt-4o-mini ]
|
24 |
+
max_token: 64
|
25 |
+
- module_type: multi_query_expansion
|
26 |
+
generator_module_type: llama_index_llm
|
27 |
+
llm: openai
|
28 |
+
temperature: [ 0.2, 1.0 ]
|
29 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
30 |
+
nodes:
|
31 |
+
- node_type: retrieval
|
32 |
+
strategy:
|
33 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
34 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 10
|
37 |
+
modules:
|
38 |
+
- module_type: bm25
|
39 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
40 |
+
- module_type: vectordb
|
41 |
+
embedding_model: openai
|
42 |
+
embedding_batch: 256
|
43 |
+
- module_type: hybrid_rrf
|
44 |
+
weight_range: (4,80)
|
45 |
+
- module_type: hybrid_cc
|
46 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
47 |
+
weight_range: (0.0, 1.0)
|
48 |
+
test_weight_size: 101
|
49 |
+
- node_type: passage_augmenter
|
50 |
+
strategy:
|
51 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
52 |
+
speed_threshold: 5
|
53 |
+
top_k: 5
|
54 |
+
embedding_model: openai
|
55 |
+
modules:
|
56 |
+
- module_type: pass_passage_augmenter
|
57 |
+
- module_type: prev_next_augmenter
|
58 |
+
mode: next
|
59 |
+
- node_type: passage_reranker
|
60 |
+
strategy:
|
61 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
62 |
+
speed_threshold: 10
|
63 |
+
top_k: 5
|
64 |
+
modules:
|
65 |
+
- module_type: pass_reranker
|
66 |
+
- module_type: tart
|
67 |
+
- module_type: monot5
|
68 |
+
- module_type: upr
|
69 |
+
- module_type: cohere_reranker
|
70 |
+
- module_type: rankgpt
|
71 |
+
- module_type: jina_reranker
|
72 |
+
- module_type: colbert_reranker
|
73 |
+
- module_type: sentence_transformer_reranker
|
74 |
+
- module_type: flag_embedding_reranker
|
75 |
+
- module_type: flag_embedding_llm_reranker
|
76 |
+
- module_type: time_reranker
|
77 |
+
- module_type: openvino_reranker
|
78 |
+
- module_type: voyageai_reranker
|
79 |
+
- module_type: mixedbreadai_reranker
|
80 |
+
- node_type: passage_filter
|
81 |
+
strategy:
|
82 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
83 |
+
speed_threshold: 5
|
84 |
+
modules:
|
85 |
+
- module_type: pass_passage_filter
|
86 |
+
- module_type: similarity_threshold_cutoff
|
87 |
+
threshold: 0.85
|
88 |
+
- module_type: similarity_percentile_cutoff
|
89 |
+
percentile: 0.6
|
90 |
+
- module_type: threshold_cutoff
|
91 |
+
threshold: 0.85
|
92 |
+
- module_type: percentile_cutoff
|
93 |
+
percentile: 0.6
|
94 |
+
- node_type: passage_compressor
|
95 |
+
strategy:
|
96 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
97 |
+
speed_threshold: 10
|
98 |
+
modules:
|
99 |
+
- module_type: pass_compressor
|
100 |
+
- module_type: tree_summarize
|
101 |
+
llm: openai
|
102 |
+
model: gpt-4o-mini
|
103 |
+
- module_type: refine
|
104 |
+
llm: openai
|
105 |
+
model: gpt-4o-mini
|
106 |
+
- module_type: longllmlingua
|
107 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
108 |
+
nodes:
|
109 |
+
- node_type: prompt_maker
|
110 |
+
strategy:
|
111 |
+
metrics:
|
112 |
+
- metric_name: bleu
|
113 |
+
- metric_name: meteor
|
114 |
+
- metric_name: rouge
|
115 |
+
- metric_name: sem_score
|
116 |
+
embedding_model: openai
|
117 |
+
- metric_name: g_eval
|
118 |
+
speed_threshold: 10
|
119 |
+
generator_modules:
|
120 |
+
- module_type: llama_index_llm
|
121 |
+
llm: openai
|
122 |
+
model: [gpt-4o-mini]
|
123 |
+
modules:
|
124 |
+
- module_type: fstring
|
125 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
126 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
127 |
+
- module_type: long_context_reorder
|
128 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
129 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
130 |
+
- node_type: generator
|
131 |
+
strategy:
|
132 |
+
metrics:
|
133 |
+
- metric_name: bleu
|
134 |
+
- metric_name: meteor
|
135 |
+
- metric_name: rouge
|
136 |
+
- metric_name: sem_score
|
137 |
+
embedding_model: openai
|
138 |
+
- metric_name: g_eval
|
139 |
+
speed_threshold: 10
|
140 |
+
modules:
|
141 |
+
- module_type: llama_index_llm
|
142 |
+
llm: [openai]
|
143 |
+
model: [gpt-4o-mini]
|
144 |
+
temperature: [0.5, 1.0]
|
config/gpu_api/half_openai.yaml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: cohere_reranker
|
43 |
+
- module_type: rankgpt
|
44 |
+
- module_type: jina_reranker
|
45 |
+
- module_type: colbert_reranker
|
46 |
+
- module_type: sentence_transformer_reranker
|
47 |
+
- module_type: flag_embedding_reranker
|
48 |
+
- module_type: flag_embedding_llm_reranker
|
49 |
+
- module_type: time_reranker
|
50 |
+
- module_type: openvino_reranker
|
51 |
+
- module_type: voyageai_reranker
|
52 |
+
- module_type: mixedbreadai_reranker
|
53 |
+
- node_type: passage_filter
|
54 |
+
strategy:
|
55 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
56 |
+
speed_threshold: 5
|
57 |
+
modules:
|
58 |
+
- module_type: pass_passage_filter
|
59 |
+
- module_type: similarity_threshold_cutoff
|
60 |
+
threshold: 0.85
|
61 |
+
- module_type: similarity_percentile_cutoff
|
62 |
+
percentile: 0.6
|
63 |
+
- module_type: threshold_cutoff
|
64 |
+
threshold: 0.85
|
65 |
+
- module_type: percentile_cutoff
|
66 |
+
percentile: 0.6
|
67 |
+
- node_type: passage_compressor
|
68 |
+
strategy:
|
69 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
70 |
+
speed_threshold: 10
|
71 |
+
modules:
|
72 |
+
- module_type: pass_compressor
|
73 |
+
- module_type: tree_summarize
|
74 |
+
llm: openai
|
75 |
+
model: gpt-4o-mini
|
76 |
+
- module_type: refine
|
77 |
+
llm: openai
|
78 |
+
model: gpt-4o-mini
|
79 |
+
- module_type: longllmlingua
|
80 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
81 |
+
nodes:
|
82 |
+
- node_type: prompt_maker
|
83 |
+
strategy:
|
84 |
+
metrics:
|
85 |
+
- metric_name: bleu
|
86 |
+
- metric_name: meteor
|
87 |
+
- metric_name: rouge
|
88 |
+
- metric_name: sem_score
|
89 |
+
embedding_model: openai
|
90 |
+
speed_threshold: 10
|
91 |
+
generator_modules:
|
92 |
+
- module_type: llama_index_llm
|
93 |
+
llm: openai
|
94 |
+
model: [gpt-4o-mini]
|
95 |
+
modules:
|
96 |
+
- module_type: fstring
|
97 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
98 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
99 |
+
- module_type: long_context_reorder
|
100 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
101 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
102 |
+
- node_type: generator
|
103 |
+
strategy:
|
104 |
+
metrics:
|
105 |
+
- metric_name: bleu
|
106 |
+
- metric_name: meteor
|
107 |
+
- metric_name: rouge
|
108 |
+
- metric_name: sem_score
|
109 |
+
embedding_model: openai
|
110 |
+
speed_threshold: 10
|
111 |
+
modules:
|
112 |
+
- module_type: llama_index_llm
|
113 |
+
llm: [openai]
|
114 |
+
model: [gpt-4o-mini]
|
115 |
+
temperature: [0.5, 1.0]
|
config/gpu_api/half_openai_korean.yaml
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_reranker
|
33 |
+
strategy:
|
34 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 5
|
37 |
+
modules:
|
38 |
+
- module_type: pass_reranker
|
39 |
+
- module_type: tart
|
40 |
+
- module_type: monot5
|
41 |
+
- module_type: upr
|
42 |
+
- module_type: cohere_reranker
|
43 |
+
- module_type: rankgpt
|
44 |
+
- module_type: jina_reranker
|
45 |
+
- module_type: colbert_reranker
|
46 |
+
- module_type: sentence_transformer_reranker
|
47 |
+
- module_type: flag_embedding_reranker
|
48 |
+
- module_type: flag_embedding_llm_reranker
|
49 |
+
- module_type: time_reranker
|
50 |
+
- module_type: openvino_reranker
|
51 |
+
- module_type: voyageai_reranker
|
52 |
+
- module_type: mixedbreadai_reranker
|
53 |
+
- node_type: passage_filter
|
54 |
+
strategy:
|
55 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
56 |
+
speed_threshold: 5
|
57 |
+
modules:
|
58 |
+
- module_type: pass_passage_filter
|
59 |
+
- module_type: similarity_threshold_cutoff
|
60 |
+
threshold: 0.85
|
61 |
+
- module_type: similarity_percentile_cutoff
|
62 |
+
percentile: 0.6
|
63 |
+
- module_type: threshold_cutoff
|
64 |
+
threshold: 0.85
|
65 |
+
- module_type: percentile_cutoff
|
66 |
+
percentile: 0.6
|
67 |
+
- node_type: passage_compressor
|
68 |
+
strategy:
|
69 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
70 |
+
speed_threshold: 10
|
71 |
+
modules:
|
72 |
+
- module_type: pass_compressor
|
73 |
+
- module_type: tree_summarize
|
74 |
+
llm: openai
|
75 |
+
model: gpt-4o-mini
|
76 |
+
prompt: |
|
77 |
+
여러 문맥 정보는 다음과 같습니다.\n
|
78 |
+
---------------------\n
|
79 |
+
{context_str}\n
|
80 |
+
---------------------\n
|
81 |
+
사전 지식이 아닌 여러 정보가 주어졌습니다,
|
82 |
+
질문에 대답하세요.\n
|
83 |
+
질문: {query_str}\n
|
84 |
+
답변:
|
85 |
+
- module_type: refine
|
86 |
+
llm: openai
|
87 |
+
model: gpt-4o-mini
|
88 |
+
prompt: |
|
89 |
+
원래 질문은 다음과 같습니다: {query_str}
|
90 |
+
기존 답변은 다음과 같습니다: {existing_answer}
|
91 |
+
아래에서 기존 답변을 정제할 수 있는 기회가 있습니다.
|
92 |
+
(필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다.
|
93 |
+
------------
|
94 |
+
{context_msg}
|
95 |
+
------------
|
96 |
+
새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다.
|
97 |
+
맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요.
|
98 |
+
정제된 답변:
|
99 |
+
- module_type: longllmlingua
|
100 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
101 |
+
nodes:
|
102 |
+
- node_type: prompt_maker
|
103 |
+
strategy:
|
104 |
+
metrics:
|
105 |
+
- metric_name: bleu
|
106 |
+
- metric_name: meteor
|
107 |
+
- metric_name: rouge
|
108 |
+
- metric_name: sem_score
|
109 |
+
embedding_model: openai
|
110 |
+
speed_threshold: 10
|
111 |
+
generator_modules:
|
112 |
+
- module_type: llama_index_llm
|
113 |
+
llm: openai
|
114 |
+
model: [gpt-4o-mini]
|
115 |
+
modules:
|
116 |
+
- module_type: fstring
|
117 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
118 |
+
- module_type: long_context_reorder
|
119 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
120 |
+
- node_type: generator
|
121 |
+
strategy:
|
122 |
+
metrics:
|
123 |
+
- metric_name: bleu
|
124 |
+
- metric_name: meteor
|
125 |
+
- metric_name: rouge
|
126 |
+
- metric_name: sem_score
|
127 |
+
embedding_model: openai
|
128 |
+
speed_threshold: 10
|
129 |
+
modules:
|
130 |
+
- module_type: llama_index_llm
|
131 |
+
llm: [openai]
|
132 |
+
model: [gpt-4o-mini]
|
133 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/compact_openai.yaml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_filter
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 5
|
36 |
+
modules:
|
37 |
+
- module_type: pass_passage_filter
|
38 |
+
- module_type: similarity_threshold_cutoff
|
39 |
+
threshold: 0.85
|
40 |
+
- module_type: similarity_percentile_cutoff
|
41 |
+
percentile: 0.6
|
42 |
+
- module_type: threshold_cutoff
|
43 |
+
threshold: 0.85
|
44 |
+
- module_type: percentile_cutoff
|
45 |
+
percentile: 0.6
|
46 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
47 |
+
nodes:
|
48 |
+
- node_type: prompt_maker
|
49 |
+
strategy:
|
50 |
+
metrics:
|
51 |
+
- metric_name: bleu
|
52 |
+
- metric_name: meteor
|
53 |
+
- metric_name: rouge
|
54 |
+
- metric_name: sem_score
|
55 |
+
embedding_model: openai
|
56 |
+
speed_threshold: 10
|
57 |
+
generator_modules:
|
58 |
+
- module_type: llama_index_llm
|
59 |
+
llm: openai
|
60 |
+
model: [gpt-4o-mini]
|
61 |
+
modules:
|
62 |
+
- module_type: fstring
|
63 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
64 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
65 |
+
- module_type: long_context_reorder
|
66 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
67 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
68 |
+
- node_type: generator
|
69 |
+
strategy:
|
70 |
+
metrics:
|
71 |
+
- metric_name: bleu
|
72 |
+
- metric_name: meteor
|
73 |
+
- metric_name: rouge
|
74 |
+
- metric_name: sem_score
|
75 |
+
embedding_model: openai
|
76 |
+
speed_threshold: 10
|
77 |
+
modules:
|
78 |
+
- module_type: llama_index_llm
|
79 |
+
llm: [openai]
|
80 |
+
model: [gpt-4o-mini]
|
81 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/compact_openai_korean.yaml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_filter
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 5
|
36 |
+
modules:
|
37 |
+
- module_type: pass_passage_filter
|
38 |
+
- module_type: similarity_threshold_cutoff
|
39 |
+
threshold: 0.85
|
40 |
+
- module_type: similarity_percentile_cutoff
|
41 |
+
percentile: 0.6
|
42 |
+
- module_type: threshold_cutoff
|
43 |
+
threshold: 0.85
|
44 |
+
- module_type: percentile_cutoff
|
45 |
+
percentile: 0.6
|
46 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
47 |
+
nodes:
|
48 |
+
- node_type: prompt_maker
|
49 |
+
strategy:
|
50 |
+
metrics:
|
51 |
+
- metric_name: bleu
|
52 |
+
- metric_name: meteor
|
53 |
+
- metric_name: rouge
|
54 |
+
- metric_name: sem_score
|
55 |
+
embedding_model: openai
|
56 |
+
speed_threshold: 10
|
57 |
+
generator_modules:
|
58 |
+
- module_type: llama_index_llm
|
59 |
+
llm: openai
|
60 |
+
model: [gpt-4o-mini]
|
61 |
+
modules:
|
62 |
+
- module_type: fstring
|
63 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
64 |
+
- module_type: long_context_reorder
|
65 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
66 |
+
- node_type: generator
|
67 |
+
strategy:
|
68 |
+
metrics:
|
69 |
+
- metric_name: bleu
|
70 |
+
- metric_name: meteor
|
71 |
+
- metric_name: rouge
|
72 |
+
- metric_name: sem_score
|
73 |
+
embedding_model: openai
|
74 |
+
speed_threshold: 10
|
75 |
+
modules:
|
76 |
+
- module_type: llama_index_llm
|
77 |
+
llm: [openai]
|
78 |
+
model: [gpt-4o-mini]
|
79 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/full_no_rerank_openai.yaml
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: pre_retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: query_expansion
|
5 |
+
strategy:
|
6 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
7 |
+
speed_threshold: 10
|
8 |
+
top_k: 10
|
9 |
+
retrieval_modules:
|
10 |
+
- module_type: bm25
|
11 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
12 |
+
- module_type: vectordb
|
13 |
+
embedding_model: openai
|
14 |
+
modules:
|
15 |
+
- module_type: pass_query_expansion
|
16 |
+
- module_type: query_decompose
|
17 |
+
generator_module_type: llama_index_llm
|
18 |
+
llm: openai
|
19 |
+
model: [ gpt-4o-mini ]
|
20 |
+
- module_type: hyde
|
21 |
+
generator_module_type: llama_index_llm
|
22 |
+
llm: openai
|
23 |
+
model: [ gpt-4o-mini ]
|
24 |
+
max_token: 64
|
25 |
+
- module_type: multi_query_expansion
|
26 |
+
generator_module_type: llama_index_llm
|
27 |
+
llm: openai
|
28 |
+
temperature: [ 0.2, 1.0 ]
|
29 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
30 |
+
nodes:
|
31 |
+
- node_type: retrieval
|
32 |
+
strategy:
|
33 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
34 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
35 |
+
speed_threshold: 10
|
36 |
+
top_k: 10
|
37 |
+
modules:
|
38 |
+
- module_type: bm25
|
39 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
40 |
+
- module_type: vectordb
|
41 |
+
embedding_model: openai
|
42 |
+
embedding_batch: 256
|
43 |
+
- module_type: hybrid_rrf
|
44 |
+
weight_range: (4,80)
|
45 |
+
- module_type: hybrid_cc
|
46 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
47 |
+
weight_range: (0.0, 1.0)
|
48 |
+
test_weight_size: 101
|
49 |
+
- node_type: passage_augmenter
|
50 |
+
strategy:
|
51 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
52 |
+
speed_threshold: 5
|
53 |
+
top_k: 5
|
54 |
+
embedding_model: openai
|
55 |
+
modules:
|
56 |
+
- module_type: pass_passage_augmenter
|
57 |
+
- module_type: prev_next_augmenter
|
58 |
+
mode: next
|
59 |
+
- node_type: passage_filter
|
60 |
+
strategy:
|
61 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
62 |
+
speed_threshold: 5
|
63 |
+
modules:
|
64 |
+
- module_type: pass_passage_filter
|
65 |
+
- module_type: similarity_threshold_cutoff
|
66 |
+
threshold: 0.85
|
67 |
+
- module_type: similarity_percentile_cutoff
|
68 |
+
percentile: 0.6
|
69 |
+
- module_type: threshold_cutoff
|
70 |
+
threshold: 0.85
|
71 |
+
- module_type: percentile_cutoff
|
72 |
+
percentile: 0.6
|
73 |
+
- node_type: passage_compressor
|
74 |
+
strategy:
|
75 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
76 |
+
speed_threshold: 10
|
77 |
+
modules:
|
78 |
+
- module_type: pass_compressor
|
79 |
+
- module_type: tree_summarize
|
80 |
+
llm: openai
|
81 |
+
model: gpt-4o-mini
|
82 |
+
- module_type: refine
|
83 |
+
llm: openai
|
84 |
+
model: gpt-4o-mini
|
85 |
+
- module_type: longllmlingua
|
86 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
87 |
+
nodes:
|
88 |
+
- node_type: prompt_maker
|
89 |
+
strategy:
|
90 |
+
metrics:
|
91 |
+
- metric_name: bleu
|
92 |
+
- metric_name: meteor
|
93 |
+
- metric_name: rouge
|
94 |
+
- metric_name: sem_score
|
95 |
+
embedding_model: openai
|
96 |
+
- metric_name: g_eval
|
97 |
+
speed_threshold: 10
|
98 |
+
generator_modules:
|
99 |
+
- module_type: llama_index_llm
|
100 |
+
llm: openai
|
101 |
+
model: [gpt-4o-mini]
|
102 |
+
modules:
|
103 |
+
- module_type: fstring
|
104 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
105 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
106 |
+
- module_type: long_context_reorder
|
107 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
108 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
109 |
+
- node_type: generator
|
110 |
+
strategy:
|
111 |
+
metrics:
|
112 |
+
- metric_name: bleu
|
113 |
+
- metric_name: meteor
|
114 |
+
- metric_name: rouge
|
115 |
+
- metric_name: sem_score
|
116 |
+
embedding_model: openai
|
117 |
+
- metric_name: g_eval
|
118 |
+
speed_threshold: 10
|
119 |
+
modules:
|
120 |
+
- module_type: llama_index_llm
|
121 |
+
llm: [openai]
|
122 |
+
model: [gpt-4o-mini]
|
123 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/half_openai.yaml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ porter_stemmer, space, gpt2 ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_filter
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 5
|
36 |
+
modules:
|
37 |
+
- module_type: pass_passage_filter
|
38 |
+
- module_type: similarity_threshold_cutoff
|
39 |
+
threshold: 0.85
|
40 |
+
- module_type: similarity_percentile_cutoff
|
41 |
+
percentile: 0.6
|
42 |
+
- module_type: threshold_cutoff
|
43 |
+
threshold: 0.85
|
44 |
+
- module_type: percentile_cutoff
|
45 |
+
percentile: 0.6
|
46 |
+
- node_type: passage_compressor
|
47 |
+
strategy:
|
48 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
49 |
+
speed_threshold: 10
|
50 |
+
modules:
|
51 |
+
- module_type: pass_compressor
|
52 |
+
- module_type: tree_summarize
|
53 |
+
llm: openai
|
54 |
+
model: gpt-4o-mini
|
55 |
+
- module_type: refine
|
56 |
+
llm: openai
|
57 |
+
model: gpt-4o-mini
|
58 |
+
- module_type: longllmlingua
|
59 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
60 |
+
nodes:
|
61 |
+
- node_type: prompt_maker
|
62 |
+
strategy:
|
63 |
+
metrics:
|
64 |
+
- metric_name: bleu
|
65 |
+
- metric_name: meteor
|
66 |
+
- metric_name: rouge
|
67 |
+
- metric_name: sem_score
|
68 |
+
embedding_model: openai
|
69 |
+
speed_threshold: 10
|
70 |
+
generator_modules:
|
71 |
+
- module_type: llama_index_llm
|
72 |
+
llm: openai
|
73 |
+
model: [gpt-4o-mini]
|
74 |
+
modules:
|
75 |
+
- module_type: fstring
|
76 |
+
prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}",
|
77 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"]
|
78 |
+
- module_type: long_context_reorder
|
79 |
+
prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}",
|
80 |
+
"Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ]
|
81 |
+
- node_type: generator
|
82 |
+
strategy:
|
83 |
+
metrics:
|
84 |
+
- metric_name: bleu
|
85 |
+
- metric_name: meteor
|
86 |
+
- metric_name: rouge
|
87 |
+
- metric_name: sem_score
|
88 |
+
embedding_model: openai
|
89 |
+
speed_threshold: 10
|
90 |
+
modules:
|
91 |
+
- module_type: llama_index_llm
|
92 |
+
llm: [openai]
|
93 |
+
model: [gpt-4o-mini]
|
94 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/half_openai_korean.yaml
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision,
|
7 |
+
retrieval_ndcg, retrieval_map, retrieval_mrr ]
|
8 |
+
speed_threshold: 10
|
9 |
+
top_k: 10
|
10 |
+
modules:
|
11 |
+
- module_type: bm25
|
12 |
+
bm25_tokenizer: [ ko_kiwi ]
|
13 |
+
- module_type: vectordb
|
14 |
+
embedding_model: openai
|
15 |
+
embedding_batch: 256
|
16 |
+
- module_type: hybrid_rrf
|
17 |
+
weight_range: (4,80)
|
18 |
+
- module_type: hybrid_cc
|
19 |
+
normalize_method: [ mm, tmm, z, dbsf ]
|
20 |
+
weight_range: (0.0, 1.0)
|
21 |
+
test_weight_size: 101
|
22 |
+
- node_type: passage_augmenter
|
23 |
+
strategy:
|
24 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
25 |
+
speed_threshold: 5
|
26 |
+
top_k: 5
|
27 |
+
embedding_model: openai
|
28 |
+
modules:
|
29 |
+
- module_type: pass_passage_augmenter
|
30 |
+
- module_type: prev_next_augmenter
|
31 |
+
mode: next
|
32 |
+
- node_type: passage_filter
|
33 |
+
strategy:
|
34 |
+
metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ]
|
35 |
+
speed_threshold: 5
|
36 |
+
modules:
|
37 |
+
- module_type: pass_passage_filter
|
38 |
+
- module_type: similarity_threshold_cutoff
|
39 |
+
threshold: 0.85
|
40 |
+
- module_type: similarity_percentile_cutoff
|
41 |
+
percentile: 0.6
|
42 |
+
- module_type: threshold_cutoff
|
43 |
+
threshold: 0.85
|
44 |
+
- module_type: percentile_cutoff
|
45 |
+
percentile: 0.6
|
46 |
+
- node_type: passage_compressor
|
47 |
+
strategy:
|
48 |
+
metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision]
|
49 |
+
speed_threshold: 10
|
50 |
+
modules:
|
51 |
+
- module_type: pass_compressor
|
52 |
+
- module_type: tree_summarize
|
53 |
+
llm: openai
|
54 |
+
model: gpt-4o-mini
|
55 |
+
prompt: |
|
56 |
+
여러 문맥 정보는 다음과 같습니다.\n
|
57 |
+
---------------------\n
|
58 |
+
{context_str}\n
|
59 |
+
---------------------\n
|
60 |
+
사전 지식이 아닌 여러 정보가 주어졌습니다,
|
61 |
+
질문에 대답하세요.\n
|
62 |
+
질문: {query_str}\n
|
63 |
+
답변:
|
64 |
+
- module_type: refine
|
65 |
+
llm: openai
|
66 |
+
model: gpt-4o-mini
|
67 |
+
prompt: |
|
68 |
+
원래 질문은 다음과 같습니다: {query_str}
|
69 |
+
기존 답변은 다음과 같습니다: {existing_answer}
|
70 |
+
아래에서 기존 답변을 정제할 수 있는 기회가 있습니다.
|
71 |
+
(필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다.
|
72 |
+
------------
|
73 |
+
{context_msg}
|
74 |
+
------------
|
75 |
+
새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다.
|
76 |
+
맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요.
|
77 |
+
정제된 답변:
|
78 |
+
- module_type: longllmlingua
|
79 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
80 |
+
nodes:
|
81 |
+
- node_type: prompt_maker
|
82 |
+
strategy:
|
83 |
+
metrics:
|
84 |
+
- metric_name: bleu
|
85 |
+
- metric_name: meteor
|
86 |
+
- metric_name: rouge
|
87 |
+
- metric_name: sem_score
|
88 |
+
embedding_model: openai
|
89 |
+
speed_threshold: 10
|
90 |
+
generator_modules:
|
91 |
+
- module_type: llama_index_llm
|
92 |
+
llm: openai
|
93 |
+
model: [gpt-4o-mini]
|
94 |
+
modules:
|
95 |
+
- module_type: fstring
|
96 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
97 |
+
- module_type: long_context_reorder
|
98 |
+
prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"]
|
99 |
+
- node_type: generator
|
100 |
+
strategy:
|
101 |
+
metrics:
|
102 |
+
- metric_name: bleu
|
103 |
+
- metric_name: meteor
|
104 |
+
- metric_name: rouge
|
105 |
+
- metric_name: sem_score
|
106 |
+
embedding_model: openai
|
107 |
+
speed_threshold: 10
|
108 |
+
modules:
|
109 |
+
- module_type: llama_index_llm
|
110 |
+
llm: [openai]
|
111 |
+
model: [gpt-4o-mini]
|
112 |
+
temperature: [0.5, 1.0]
|
config/non_gpu/simple_openai.yaml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
7 |
+
top_k: 3
|
8 |
+
modules:
|
9 |
+
- module_type: vectordb
|
10 |
+
embedding_model: openai
|
11 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
12 |
+
nodes:
|
13 |
+
- node_type: prompt_maker
|
14 |
+
strategy:
|
15 |
+
metrics: [bleu, meteor, rouge]
|
16 |
+
modules:
|
17 |
+
- module_type: fstring
|
18 |
+
prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : "
|
19 |
+
- node_type: generator
|
20 |
+
strategy:
|
21 |
+
metrics: [bleu, meteor, rouge]
|
22 |
+
modules:
|
23 |
+
- module_type: llama_index_llm
|
24 |
+
llm: openai
|
25 |
+
model: [gpt-4o-mini]
|
config/non_gpu/simple_openai_korean.yaml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
node_lines:
|
2 |
+
- node_line_name: retrieve_node_line # Arbitrary node line name
|
3 |
+
nodes:
|
4 |
+
- node_type: retrieval
|
5 |
+
strategy:
|
6 |
+
metrics: [retrieval_f1, retrieval_recall, retrieval_precision]
|
7 |
+
top_k: 3
|
8 |
+
modules:
|
9 |
+
- module_type: vectordb
|
10 |
+
embedding_model: openai
|
11 |
+
- node_line_name: post_retrieve_node_line # Arbitrary node line name
|
12 |
+
nodes:
|
13 |
+
- node_type: prompt_maker
|
14 |
+
strategy:
|
15 |
+
metrics: [bleu, meteor, rouge]
|
16 |
+
modules:
|
17 |
+
- module_type: fstring
|
18 |
+
prompt: "주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"
|
19 |
+
- node_type: generator
|
20 |
+
strategy:
|
21 |
+
metrics: [bleu, meteor, rouge]
|
22 |
+
modules:
|
23 |
+
- module_type: llama_index_llm
|
24 |
+
llm: openai
|
25 |
+
model: [gpt-4o-mini]
|
26 |
+
batch: 2
|
sample_data/corpus_data_sample.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0fe74568301d61265ce87a76fb7b609f0480e018170d6c275f21c382b1fcb4be
|
3 |
+
size 111931
|
sample_data/qa_data_sample.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:70fa30e911d6b748f44e768fe593b6227ba77d6461395e36dc9caf3251f86ab8
|
3 |
+
size 9928
|
src/__pycache__/runner.cpython-310.pyc
ADDED
Binary file (2.83 kB). View file
|
|
src/runner.py
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import uuid
|
3 |
+
from typing import List, Dict, Optional
|
4 |
+
|
5 |
+
import pandas as pd
|
6 |
+
from autorag.deploy import GradioRunner
|
7 |
+
from autorag.deploy.api import RetrievedPassage
|
8 |
+
from autorag.nodes.generator.base import BaseGenerator
|
9 |
+
from autorag.utils import fetch_contents
|
10 |
+
|
11 |
+
empty_retrieved_passage = RetrievedPassage(
|
12 |
+
content="", doc_id="", filepath=None, file_page=None, start_idx=None, end_idx=None
|
13 |
+
)
|
14 |
+
|
15 |
+
|
16 |
+
class GradioStreamRunner(GradioRunner):
|
17 |
+
def __init__(self, config: Dict, project_dir: Optional[str] = None):
|
18 |
+
super().__init__(config, project_dir)
|
19 |
+
|
20 |
+
data_dir = os.path.join(project_dir, "data")
|
21 |
+
self.corpus_df = pd.read_parquet(
|
22 |
+
os.path.join(data_dir, "corpus.parquet"), engine="pyarrow"
|
23 |
+
)
|
24 |
+
|
25 |
+
def stream_run(self, query: str):
|
26 |
+
previous_result = pd.DataFrame(
|
27 |
+
{
|
28 |
+
"qid": str(uuid.uuid4()),
|
29 |
+
"query": [query],
|
30 |
+
"retrieval_gt": [[]],
|
31 |
+
"generation_gt": [""],
|
32 |
+
}
|
33 |
+
) # pseudo qa data for execution
|
34 |
+
|
35 |
+
for module_instance, module_param in zip(
|
36 |
+
self.module_instances, self.module_params
|
37 |
+
):
|
38 |
+
if not isinstance(module_instance, BaseGenerator):
|
39 |
+
new_result = module_instance.pure(
|
40 |
+
previous_result=previous_result, **module_param
|
41 |
+
)
|
42 |
+
duplicated_columns = previous_result.columns.intersection(
|
43 |
+
new_result.columns
|
44 |
+
)
|
45 |
+
drop_previous_result = previous_result.drop(
|
46 |
+
columns=duplicated_columns
|
47 |
+
)
|
48 |
+
previous_result = pd.concat(
|
49 |
+
[drop_previous_result, new_result], axis=1
|
50 |
+
)
|
51 |
+
else:
|
52 |
+
# retrieved_passages = self.extract_retrieve_passage(
|
53 |
+
# previous_result
|
54 |
+
# )
|
55 |
+
# yield "", retrieved_passages
|
56 |
+
# Start streaming of the result
|
57 |
+
assert len(previous_result) == 1
|
58 |
+
prompt: str = previous_result["prompts"].tolist()[0]
|
59 |
+
for delta in module_instance.stream(prompt=prompt,
|
60 |
+
**module_param):
|
61 |
+
yield delta, [empty_retrieved_passage]
|
62 |
+
|
63 |
+
def extract_retrieve_passage(self, df: pd.DataFrame) -> List[RetrievedPassage]:
|
64 |
+
retrieved_ids: List[str] = df["retrieved_ids"].tolist()[0]
|
65 |
+
contents = fetch_contents(self.corpus_df, [retrieved_ids])[0]
|
66 |
+
if "path" in self.corpus_df.columns:
|
67 |
+
paths = fetch_contents(self.corpus_df, [retrieved_ids], column_name="path")[
|
68 |
+
0
|
69 |
+
]
|
70 |
+
else:
|
71 |
+
paths = [None] * len(retrieved_ids)
|
72 |
+
metadatas = fetch_contents(
|
73 |
+
self.corpus_df, [retrieved_ids], column_name="metadata"
|
74 |
+
)[0]
|
75 |
+
if "start_end_idx" in self.corpus_df.columns:
|
76 |
+
start_end_indices = fetch_contents(
|
77 |
+
self.corpus_df, [retrieved_ids], column_name="start_end_idx"
|
78 |
+
)[0]
|
79 |
+
else:
|
80 |
+
start_end_indices = [None] * len(retrieved_ids)
|
81 |
+
return list(
|
82 |
+
map(
|
83 |
+
lambda content, doc_id, path, metadata, start_end_idx: RetrievedPassage(
|
84 |
+
content=content,
|
85 |
+
doc_id=doc_id,
|
86 |
+
filepath=path,
|
87 |
+
file_page=metadata.get("page", None),
|
88 |
+
start_idx=start_end_idx[0] if start_end_idx else None,
|
89 |
+
end_idx=start_end_idx[1] if start_end_idx else None,
|
90 |
+
),
|
91 |
+
contents,
|
92 |
+
retrieved_ids,
|
93 |
+
paths,
|
94 |
+
metadatas,
|
95 |
+
start_end_indices,
|
96 |
+
)
|
97 |
+
)
|
web.py
ADDED
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import pathlib
|
3 |
+
|
4 |
+
import gradio as gr
|
5 |
+
import pandas as pd
|
6 |
+
import yaml
|
7 |
+
|
8 |
+
from autorag.evaluator import Evaluator
|
9 |
+
|
10 |
+
from src.runner import GradioStreamRunner
|
11 |
+
|
12 |
+
root_dir = os.path.dirname(os.path.realpath(__file__))
|
13 |
+
|
14 |
+
# Paths to example files
|
15 |
+
config_dir = os.path.join(root_dir, "config")
|
16 |
+
|
17 |
+
# Non-GPU Examples
|
18 |
+
non_gpu = os.path.join(config_dir, "non_gpu")
|
19 |
+
simple_openai = os.path.join(non_gpu, "simple_openai.yaml")
|
20 |
+
simple_openai_korean = os.path.join(non_gpu, "simple_openai_korean.yaml")
|
21 |
+
compact_openai = os.path.join(non_gpu, "compact_openai.yaml")
|
22 |
+
compact_openai_korean = os.path.join(non_gpu, "compact_openai_korean.yaml")
|
23 |
+
half_openai = os.path.join(non_gpu, "half_openai.yaml")
|
24 |
+
half_openai_korean = os.path.join(non_gpu, "half_openai_korean.yaml")
|
25 |
+
full_openai = os.path.join(non_gpu, "full_no_rerank_openai.yaml")
|
26 |
+
|
27 |
+
non_gpu_examples_list = [
|
28 |
+
simple_openai, simple_openai_korean, compact_openai, compact_openai_korean, half_openai, half_openai_korean,
|
29 |
+
full_openai
|
30 |
+
]
|
31 |
+
non_gpu_examples = list(map(lambda x: [x], non_gpu_examples_list))
|
32 |
+
|
33 |
+
# GPU Examples
|
34 |
+
gpu = os.path.join(config_dir, "gpu")
|
35 |
+
compact_openai_gpu = os.path.join(gpu, "compact_openai.yaml")
|
36 |
+
compact_openai_korean_gpu = os.path.join(gpu, "compact_openai_korean.yaml")
|
37 |
+
half_openai_gpu = os.path.join(gpu, "half_openai.yaml")
|
38 |
+
half_openai_korean_gpu = os.path.join(gpu, "half_openai_korean.yaml")
|
39 |
+
full_openai_gpu = os.path.join(gpu, "full_no_rerank_openai.yaml")
|
40 |
+
|
41 |
+
gpu_examples_list = [
|
42 |
+
compact_openai_gpu, compact_openai_korean_gpu, half_openai_gpu, half_openai_korean_gpu, full_openai_gpu
|
43 |
+
]
|
44 |
+
gpu_examples = list(map(lambda x: [x], gpu_examples_list))
|
45 |
+
|
46 |
+
# GPU + API
|
47 |
+
gpu_api = os.path.join(config_dir, "gpu_api")
|
48 |
+
compact_openai_gpu_api = os.path.join(gpu_api, "compact_openai.yaml")
|
49 |
+
compact_openai_korean_gpu_api = os.path.join(gpu_api, "compact_openai_korean.yaml")
|
50 |
+
half_openai_gpu_api = os.path.join(gpu_api, "half_openai.yaml")
|
51 |
+
half_openai_korean_gpu_api = os.path.join(gpu_api, "half_openai_korean.yaml")
|
52 |
+
full_openai_gpu_api = os.path.join(gpu_api, "full_no_rerank_openai.yaml")
|
53 |
+
|
54 |
+
gpu_api_examples_list = [
|
55 |
+
compact_openai_gpu_api, compact_openai_korean_gpu_api, half_openai_gpu_api, half_openai_korean_gpu_api,
|
56 |
+
full_openai_gpu_api
|
57 |
+
]
|
58 |
+
gpu_api_examples = list(map(lambda x: [x], gpu_api_examples_list))
|
59 |
+
|
60 |
+
example_qa_parquet = os.path.join(root_dir, "sample_data", "qa_data_sample.parquet")
|
61 |
+
example_corpus_parquet = os.path.join(root_dir, "sample_data", "corpus_data_sample.parquet")
|
62 |
+
|
63 |
+
|
64 |
+
def display_yaml(file):
|
65 |
+
if file is None:
|
66 |
+
return "No file uploaded"
|
67 |
+
with open(file.name, "r") as f:
|
68 |
+
content = yaml.safe_load(f)
|
69 |
+
return yaml.dump(content, default_flow_style=False)
|
70 |
+
|
71 |
+
|
72 |
+
def display_parquet(file):
|
73 |
+
if file is None:
|
74 |
+
return pd.DataFrame()
|
75 |
+
df = pd.read_parquet(file.name)
|
76 |
+
return df
|
77 |
+
|
78 |
+
|
79 |
+
def check_files(yaml_file, qa_file, corpus_file):
|
80 |
+
if yaml_file is not None and qa_file is not None and corpus_file is not None:
|
81 |
+
return gr.update(visible=True)
|
82 |
+
return gr.update(visible=False)
|
83 |
+
|
84 |
+
|
85 |
+
def run_trial(file, yaml_file, qa_file, corpus_file):
|
86 |
+
project_dir = os.path.join(pathlib.PurePath(file.name).parent, "project")
|
87 |
+
evaluator = Evaluator(qa_file, corpus_file, project_dir=project_dir)
|
88 |
+
|
89 |
+
evaluator.start_trial(yaml_file, skip_validation=True)
|
90 |
+
return ("❗Trial Completed❗ "
|
91 |
+
"Go to Chat Tab to start the conversation")
|
92 |
+
|
93 |
+
|
94 |
+
def set_environment_variable(api_name, api_key):
|
95 |
+
if api_name and api_key:
|
96 |
+
try:
|
97 |
+
os.environ[api_name] = api_key
|
98 |
+
return "✅ Setting Complete ✅"
|
99 |
+
except Exception as e:
|
100 |
+
return f"Error setting environment variable: {e}"
|
101 |
+
return "API Name or Key is missing"
|
102 |
+
|
103 |
+
|
104 |
+
def stream_default(file, history):
|
105 |
+
# Default YAML Runner
|
106 |
+
yaml_path = os.path.join(config_dir, "extracted_sample.yaml")
|
107 |
+
project_dir = os.path.join(
|
108 |
+
pathlib.PurePath(file.name).parent, "project"
|
109 |
+
)
|
110 |
+
default_gradio_runner = GradioStreamRunner.from_yaml(yaml_path, project_dir)
|
111 |
+
|
112 |
+
history.append({"role": "assistant", "content": ""})
|
113 |
+
# Stream responses for the chatbox
|
114 |
+
for default_output in default_gradio_runner.stream_run(history[-2]["content"]):
|
115 |
+
stream_delta = default_output[0]
|
116 |
+
history[-1]["content"] = stream_delta
|
117 |
+
yield history
|
118 |
+
|
119 |
+
|
120 |
+
def stream_optimized(file, history):
|
121 |
+
# Custom YAML Runner
|
122 |
+
trial_dir = os.path.join(pathlib.PurePath(file.name).parent, "project", "0")
|
123 |
+
custom_gradio_runner = GradioStreamRunner.from_trial_folder(trial_dir)
|
124 |
+
|
125 |
+
history.append({"role": "assistant", "content": ""})
|
126 |
+
for output in custom_gradio_runner.stream_run(history[-2]["content"]):
|
127 |
+
stream_delta = output[0]
|
128 |
+
history[-1]["content"] = stream_delta
|
129 |
+
yield history
|
130 |
+
|
131 |
+
|
132 |
+
def user(user_message, history: list):
|
133 |
+
return "", history + [{"role": "user", "content": user_message}]
|
134 |
+
|
135 |
+
|
136 |
+
with gr.Blocks(theme="earneleh/paris") as demo:
|
137 |
+
gr.Markdown("# AutoRAG Trial & Debugging Interface")
|
138 |
+
|
139 |
+
with gr.Tabs() as tabs:
|
140 |
+
with gr.Tab("Environment Variables"):
|
141 |
+
gr.Markdown("## Environment Variables")
|
142 |
+
with gr.Row(): # Arrange horizontally
|
143 |
+
with gr.Column(scale=3):
|
144 |
+
api_name = gr.Textbox(
|
145 |
+
label="Environment Variable Name",
|
146 |
+
type="text",
|
147 |
+
placeholder="Enter your Environment Variable Name",
|
148 |
+
)
|
149 |
+
gr.Examples(examples=[["OPENAI_API_KEY"]], inputs=api_name)
|
150 |
+
with gr.Column(scale=7):
|
151 |
+
api_key = gr.Textbox(
|
152 |
+
label="API Key",
|
153 |
+
type="password",
|
154 |
+
placeholder="Enter your API Key",
|
155 |
+
)
|
156 |
+
|
157 |
+
set_env_button = gr.Button("Set Environment Variable")
|
158 |
+
env_output = gr.Textbox(
|
159 |
+
label="Status", interactive=False
|
160 |
+
)
|
161 |
+
|
162 |
+
api_key.submit(
|
163 |
+
set_environment_variable, inputs=[api_name, api_key], outputs=env_output
|
164 |
+
)
|
165 |
+
set_env_button.click(
|
166 |
+
set_environment_variable, inputs=[api_name, api_key], outputs=env_output
|
167 |
+
)
|
168 |
+
|
169 |
+
with gr.Tab("File Upload"):
|
170 |
+
with gr.Row() as file_upload_row:
|
171 |
+
with gr.Column(scale=3):
|
172 |
+
yaml_file = gr.File(
|
173 |
+
label="Upload YAML File",
|
174 |
+
file_count="single",
|
175 |
+
)
|
176 |
+
make_yaml_button = gr.Button("Make Your Own YAML File",
|
177 |
+
link="https://tally.so/r/mBQY5N")
|
178 |
+
|
179 |
+
with gr.Column(scale=7):
|
180 |
+
yaml_content = gr.Textbox(label="YAML File Content")
|
181 |
+
gr.Markdown("Here is the Sample YAML File. Just click the file ❗")
|
182 |
+
|
183 |
+
gr.Markdown("### Non-GPU Examples")
|
184 |
+
gr.Examples(examples=non_gpu_examples, inputs=yaml_file)
|
185 |
+
|
186 |
+
with gr.Row():
|
187 |
+
# Section for GPU examples
|
188 |
+
with gr.Column():
|
189 |
+
gr.Markdown("### GPU Examples")
|
190 |
+
gr.Markdown(
|
191 |
+
"**⚠️ Warning**: Here are the YAML files containing the modules that use the **local model**.")
|
192 |
+
gr.Markdown(
|
193 |
+
"Note that if you Run_Trial in a non-GPU environment, **it can take a very long time**.")
|
194 |
+
gr.Examples(examples=gpu_examples, inputs=yaml_file)
|
195 |
+
make_gpu = gr.Button("Use AutoRAG GPU Feature",
|
196 |
+
link="https://tally.so/r/3j7rP6")
|
197 |
+
|
198 |
+
# Section for GPU + API examples
|
199 |
+
with gr.Column():
|
200 |
+
gr.Markdown("### GPU + API Examples")
|
201 |
+
gr.Markdown(
|
202 |
+
"**⚠️ Warning**: Here are the YAML files containing the modules that use the **local model** and **API Based Model**.")
|
203 |
+
gr.Markdown("You need to set **JINA_API_KEY**, **COHERE_API_KEY**, **MXBAI_API_KEY** and **VOYAGE_API_KEY** as environment variables to use this feature. ")
|
204 |
+
gr.Examples(examples=gpu_api_examples, inputs=yaml_file)
|
205 |
+
gpu_api_button = gr.Button("Use AutoRAG API KEY Feature",
|
206 |
+
link="https://tally.so/r/waD1Ab")
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
with gr.Row() as qa_upload_row:
|
211 |
+
with gr.Column(scale=3):
|
212 |
+
qa_file = gr.File(
|
213 |
+
label="Upload qa.parquet File",
|
214 |
+
file_count="single",
|
215 |
+
)
|
216 |
+
# Add button for QA
|
217 |
+
make_qa_button = gr.Button("Make Your Own QA Data",
|
218 |
+
link="https://huggingface.co/spaces/AutoRAG/AutoRAG-data-creation")
|
219 |
+
|
220 |
+
with gr.Column(scale=7):
|
221 |
+
qa_content = gr.Dataframe(label="QA Parquet File Content")
|
222 |
+
gr.Markdown("Here is the Sample QA File. Just click the file ❗")
|
223 |
+
gr.Examples(examples=[[example_qa_parquet]], inputs=qa_file)
|
224 |
+
with gr.Row() as corpus_upload_row:
|
225 |
+
with gr.Column(scale=3):
|
226 |
+
corpus_file = gr.File(
|
227 |
+
label="Upload corpus.parquet File",
|
228 |
+
file_count="single",
|
229 |
+
)
|
230 |
+
make_corpus_button = gr.Button("Make Your Own Corpus Data",
|
231 |
+
link="https://huggingface.co/spaces/AutoRAG/AutoRAG-data-creation")
|
232 |
+
with gr.Column(scale=7):
|
233 |
+
corpus_content = gr.Dataframe(label="Corpus Parquet File Content")
|
234 |
+
gr.Markdown(
|
235 |
+
"Here is the Sample Corpus File. Just click the file ❗"
|
236 |
+
)
|
237 |
+
gr.Examples(examples=[[example_corpus_parquet]], inputs=corpus_file)
|
238 |
+
|
239 |
+
run_trial_button = gr.Button("Run Trial", visible=False)
|
240 |
+
trial_output = gr.Textbox(label="Trial Output", visible=False)
|
241 |
+
|
242 |
+
yaml_file.change(display_yaml, inputs=yaml_file, outputs=yaml_content)
|
243 |
+
qa_file.change(display_parquet, inputs=qa_file, outputs=qa_content)
|
244 |
+
corpus_file.change(
|
245 |
+
display_parquet, inputs=corpus_file, outputs=corpus_content
|
246 |
+
)
|
247 |
+
|
248 |
+
yaml_file.change(
|
249 |
+
check_files,
|
250 |
+
inputs=[yaml_file, qa_file, corpus_file],
|
251 |
+
outputs=run_trial_button,
|
252 |
+
)
|
253 |
+
qa_file.change(
|
254 |
+
check_files,
|
255 |
+
inputs=[yaml_file, qa_file, corpus_file],
|
256 |
+
outputs=run_trial_button,
|
257 |
+
)
|
258 |
+
corpus_file.change(
|
259 |
+
check_files,
|
260 |
+
inputs=[yaml_file, qa_file, corpus_file],
|
261 |
+
outputs=run_trial_button,
|
262 |
+
)
|
263 |
+
|
264 |
+
run_trial_button.click(
|
265 |
+
lambda: (
|
266 |
+
gr.update(visible=False),
|
267 |
+
gr.update(visible=False),
|
268 |
+
gr.update(visible=False),
|
269 |
+
gr.update(visible=True),
|
270 |
+
),
|
271 |
+
outputs=[
|
272 |
+
file_upload_row,
|
273 |
+
qa_upload_row,
|
274 |
+
corpus_upload_row,
|
275 |
+
trial_output,
|
276 |
+
],
|
277 |
+
)
|
278 |
+
run_trial_button.click(
|
279 |
+
run_trial,
|
280 |
+
inputs=[yaml_file, yaml_file, qa_file, corpus_file],
|
281 |
+
outputs=trial_output,
|
282 |
+
)
|
283 |
+
|
284 |
+
# New Chat Tab
|
285 |
+
with gr.Tab("Chat") as chat_tab:
|
286 |
+
gr.Markdown("### Compare Chat Models")
|
287 |
+
|
288 |
+
question_input = gr.Textbox(
|
289 |
+
label="Your Question", placeholder="Type your question here..."
|
290 |
+
)
|
291 |
+
pseudo_input = gr.Textbox(label="havertz", visible=False)
|
292 |
+
|
293 |
+
with gr.Row():
|
294 |
+
# Left Chatbox (Default YAML)
|
295 |
+
with gr.Column():
|
296 |
+
gr.Markdown("#### Naive RAG Chat")
|
297 |
+
default_chatbox = gr.Chatbot(label="Naive RAG Conversation",type="messages")
|
298 |
+
|
299 |
+
# Right Chatbox (Custom YAML)
|
300 |
+
with gr.Column():
|
301 |
+
gr.Markdown("#### Optimized RAG Chat")
|
302 |
+
custom_chatbox = gr.Chatbot(label="Optimized RAG Conversation",type="messages")
|
303 |
+
|
304 |
+
question_input.submit(lambda x: x, inputs=[question_input], outputs=[pseudo_input]).then(
|
305 |
+
user, [question_input, default_chatbox], outputs=[question_input, default_chatbox], queue=False
|
306 |
+
).then(
|
307 |
+
stream_default,
|
308 |
+
inputs=[yaml_file, default_chatbox],
|
309 |
+
outputs=[default_chatbox],
|
310 |
+
)
|
311 |
+
|
312 |
+
pseudo_input.change(
|
313 |
+
user, [pseudo_input, custom_chatbox], outputs=[question_input, custom_chatbox], queue=False).then(
|
314 |
+
stream_optimized,
|
315 |
+
inputs=[yaml_file, custom_chatbox],
|
316 |
+
outputs=[custom_chatbox],
|
317 |
+
)
|
318 |
+
|
319 |
+
|
320 |
+
deploy_button = gr.Button("Deploy",
|
321 |
+
link="https://tally.so/r/3XM7y4")
|
322 |
+
|
323 |
+
|
324 |
+
if __name__ == "__main__":
|
325 |
+
# Run the interface
|
326 |
+
demo.launch(share=False, debug=True)
|