sdg-hub 0.3.1__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sdg_hub/__init__.py +0 -2
- sdg_hub/_version.py +2 -2
- sdg_hub/core/__init__.py +1 -2
- sdg_hub/core/blocks/__init__.py +2 -4
- sdg_hub/core/blocks/base.py +61 -6
- sdg_hub/core/blocks/filtering/column_value_filter.py +3 -2
- sdg_hub/core/blocks/llm/__init__.py +2 -4
- sdg_hub/core/blocks/llm/llm_chat_block.py +251 -265
- sdg_hub/core/blocks/llm/llm_chat_with_parsing_retry_block.py +216 -98
- sdg_hub/core/blocks/llm/llm_parser_block.py +320 -0
- sdg_hub/core/blocks/llm/text_parser_block.py +53 -152
- sdg_hub/core/flow/__init__.py +3 -4
- sdg_hub/core/flow/base.py +11 -73
- sdg_hub/core/flow/metadata.py +1 -68
- sdg_hub/core/flow/registry.py +0 -1
- sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/detailed_summary/flow.yaml +51 -12
- sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/doc_direct_qa/__init__.py +0 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/doc_direct_qa/flow.yaml +158 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/extractive_summary/flow.yaml +51 -12
- sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts/flow.yaml +14 -3
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/flow.yaml +147 -28
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/README.md +0 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/__init__.py +0 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/atomic_facts_ja.yaml +41 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/detailed_summary_ja.yaml +14 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/extractive_summary_ja.yaml +14 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/flow.yaml +303 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/generate_questions_responses_ja.yaml +55 -0
- sdg_hub/flows/text_analysis/structured_insights/flow.yaml +28 -5
- {sdg_hub-0.3.1.dist-info → sdg_hub-0.4.1.dist-info}/METADATA +2 -1
- {sdg_hub-0.3.1.dist-info → sdg_hub-0.4.1.dist-info}/RECORD +34 -30
- sdg_hub/core/blocks/evaluation/__init__.py +0 -9
- sdg_hub/core/blocks/evaluation/evaluate_faithfulness_block.py +0 -323
- sdg_hub/core/blocks/evaluation/evaluate_relevancy_block.py +0 -323
- sdg_hub/core/blocks/evaluation/verify_question_block.py +0 -329
- sdg_hub/core/blocks/llm/client_manager.py +0 -472
- sdg_hub/core/blocks/llm/config.py +0 -337
- {sdg_hub-0.3.1.dist-info → sdg_hub-0.4.1.dist-info}/WHEEL +0 -0
- {sdg_hub-0.3.1.dist-info → sdg_hub-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {sdg_hub-0.3.1.dist-info → sdg_hub-0.4.1.dist-info}/top_level.txt +0 -0
sdg_hub/flows/qa_generation/document_grounded_qa/enhanced_multi_summary_qa/key_facts/flow.yaml
CHANGED
@@ -17,7 +17,6 @@ metadata:
|
|
17
17
|
- qa-pairs
|
18
18
|
- key-facts
|
19
19
|
license: Apache-2.0
|
20
|
-
min_sdg_hub_version: 0.2.0
|
21
20
|
dataset_requirements:
|
22
21
|
required_columns:
|
23
22
|
- document
|
@@ -50,10 +49,16 @@ blocks:
|
|
50
49
|
temperature: 0.7
|
51
50
|
n: 1
|
52
51
|
async_mode: true
|
52
|
+
- block_type: LLMParserBlock
|
53
|
+
block_config:
|
54
|
+
block_name: extract_atomic_facts
|
55
|
+
input_cols: raw_summary
|
56
|
+
extract_content: true
|
57
|
+
expand_lists: true
|
53
58
|
- block_type: TextParserBlock
|
54
59
|
block_config:
|
55
60
|
block_name: parse_atomic_facts
|
56
|
-
input_cols:
|
61
|
+
input_cols: extract_atomic_facts_content
|
57
62
|
output_cols: atomic_facts
|
58
63
|
start_tags:
|
59
64
|
- '### Key Facts With Context'
|
@@ -89,10 +94,16 @@ blocks:
|
|
89
94
|
temperature: 0.7
|
90
95
|
n: 1
|
91
96
|
async_mode: true
|
97
|
+
- block_type: LLMParserBlock
|
98
|
+
block_config:
|
99
|
+
block_name: extract_key_fact_qa
|
100
|
+
input_cols: raw_key_fact_qa
|
101
|
+
extract_content: true
|
102
|
+
expand_lists: true
|
92
103
|
- block_type: TextParserBlock
|
93
104
|
block_config:
|
94
105
|
block_name: parse_key_fact_qa
|
95
|
-
input_cols:
|
106
|
+
input_cols: extract_key_fact_qa_content
|
96
107
|
output_cols:
|
97
108
|
- question
|
98
109
|
- response
|
@@ -18,8 +18,7 @@ metadata:
|
|
18
18
|
- "educational"
|
19
19
|
|
20
20
|
license: "Apache-2.0"
|
21
|
-
|
22
|
-
|
21
|
+
|
23
22
|
dataset_requirements:
|
24
23
|
required_columns:
|
25
24
|
- "document"
|
@@ -54,11 +53,19 @@ blocks:
|
|
54
53
|
output_cols: raw_summary_detailed
|
55
54
|
max_tokens: 2048
|
56
55
|
async_mode: true
|
56
|
+
n: 2
|
57
|
+
|
58
|
+
- block_type: LLMParserBlock
|
59
|
+
block_config:
|
60
|
+
block_name: detailed_summary
|
61
|
+
input_cols: raw_summary_detailed
|
62
|
+
extract_content: true
|
63
|
+
extract_reasoning_content: true
|
57
64
|
|
58
65
|
- block_type: TextParserBlock
|
59
66
|
block_config:
|
60
67
|
block_name: parse_detailed_summary
|
61
|
-
input_cols:
|
68
|
+
input_cols: detailed_summary_content
|
62
69
|
output_cols: summary_detailed
|
63
70
|
start_tags: [""]
|
64
71
|
end_tags: [""]
|
@@ -78,10 +85,16 @@ blocks:
|
|
78
85
|
max_tokens: 2048
|
79
86
|
async_mode: true
|
80
87
|
|
88
|
+
- block_type: LLMParserBlock
|
89
|
+
block_config:
|
90
|
+
block_name: atomic_facts
|
91
|
+
input_cols: raw_atomic_facts
|
92
|
+
extract_content: true
|
93
|
+
|
81
94
|
- block_type: TextParserBlock
|
82
95
|
block_config:
|
83
96
|
block_name: parse_atomic_facts
|
84
|
-
input_cols:
|
97
|
+
input_cols: atomic_facts_content
|
85
98
|
output_cols: summary_atomic_facts
|
86
99
|
start_tags: [""]
|
87
100
|
end_tags: [""]
|
@@ -101,10 +114,16 @@ blocks:
|
|
101
114
|
max_tokens: 2048
|
102
115
|
async_mode: true
|
103
116
|
|
117
|
+
- block_type: LLMParserBlock
|
118
|
+
block_config:
|
119
|
+
block_name: extractive_summary
|
120
|
+
input_cols: raw_summary_extractive
|
121
|
+
extract_content: true
|
122
|
+
|
104
123
|
- block_type: TextParserBlock
|
105
124
|
block_config:
|
106
125
|
block_name: parse_extractive_summary
|
107
|
-
input_cols:
|
126
|
+
input_cols: extractive_summary_content
|
108
127
|
output_cols: summary_extractive
|
109
128
|
start_tags: [""]
|
110
129
|
end_tags: [""]
|
@@ -136,50 +155,150 @@ blocks:
|
|
136
155
|
max_tokens: 2048
|
137
156
|
async_mode: true
|
138
157
|
|
158
|
+
- block_type: LLMParserBlock
|
159
|
+
block_config:
|
160
|
+
block_name: get_knowledge_generation
|
161
|
+
input_cols: raw_knowledge_generation
|
162
|
+
extract_content: true
|
163
|
+
|
139
164
|
- block_type: TextParserBlock
|
140
165
|
block_config:
|
141
166
|
block_name: parse_knowledge_generation
|
142
|
-
input_cols:
|
167
|
+
input_cols: get_knowledge_generation_content
|
143
168
|
output_cols: [question, response]
|
144
169
|
parsing_pattern: "\\[(?:Question|QUESTION)\\]\\s*(.*?)\\s*\\[(?:Answer|ANSWER)\\]\\s*(.*?)\\s*(?=\\[(?:Question|QUESTION)\\]|$)"
|
145
170
|
parser_cleanup_tags: ["[END]"]
|
146
171
|
|
147
|
-
- block_type:
|
172
|
+
- block_type: PromptBuilderBlock
|
148
173
|
block_config:
|
149
|
-
block_name:
|
174
|
+
block_name: eval_faithful_prompt
|
150
175
|
input_cols: [document, response]
|
151
|
-
output_cols:
|
176
|
+
output_cols: eval_faithful_prompt
|
152
177
|
prompt_config_path: evaluate_faithfulness.yaml
|
178
|
+
format_as_messages: true
|
179
|
+
|
180
|
+
- block_type: LLMChatBlock
|
181
|
+
block_config:
|
182
|
+
block_name: eval_faithful_llm_chat
|
183
|
+
input_cols: eval_faithful_prompt
|
184
|
+
output_cols: eval_faithful_response_dict
|
185
|
+
max_tokens: 2048
|
186
|
+
n: 1
|
187
|
+
async_mode: true
|
188
|
+
|
189
|
+
- block_type: LLMParserBlock
|
190
|
+
block_config:
|
191
|
+
block_name: extract_eval_faithful
|
192
|
+
input_cols: eval_faithful_response_dict
|
193
|
+
extract_content: true
|
194
|
+
|
195
|
+
- block_type: TextParserBlock
|
196
|
+
block_config:
|
197
|
+
block_name: parse_eval_faithful
|
198
|
+
input_cols: extract_eval_faithful_content
|
199
|
+
output_cols:
|
200
|
+
- faithfulness_explanation
|
201
|
+
- faithfulness_judgment
|
202
|
+
start_tags:
|
203
|
+
- '[Start of Explanation]'
|
204
|
+
- '[Start of Answer]'
|
205
|
+
end_tags:
|
206
|
+
- '[End of Explanation]'
|
207
|
+
- '[End of Answer]'
|
208
|
+
|
209
|
+
- block_type: ColumnValueFilterBlock
|
210
|
+
block_config:
|
211
|
+
block_name: eval_faithful_filter
|
212
|
+
input_cols:
|
213
|
+
- faithfulness_judgment
|
153
214
|
filter_value: "YES"
|
154
215
|
operation: eq
|
155
|
-
async_mode: true
|
156
|
-
start_tags: ["[Start of Explanation]", "[Start of Answer]"]
|
157
|
-
end_tags: ["[End of Explanation]", "[End of Answer]"]
|
158
216
|
|
159
|
-
- block_type:
|
217
|
+
- block_type: PromptBuilderBlock
|
160
218
|
block_config:
|
161
|
-
block_name:
|
162
|
-
input_cols:
|
163
|
-
|
219
|
+
block_name: eval_relevancy_prompt
|
220
|
+
input_cols:
|
221
|
+
- question
|
222
|
+
- response
|
223
|
+
output_cols: eval_relevancy_prompt
|
164
224
|
prompt_config_path: evaluate_relevancy.yaml
|
225
|
+
format_as_messages: true
|
226
|
+
- block_type: LLMChatBlock
|
227
|
+
block_config:
|
228
|
+
block_name: eval_relevancy_llm_chat
|
229
|
+
input_cols: eval_relevancy_prompt
|
230
|
+
output_cols: eval_relevancy_response_dict
|
231
|
+
max_tokens: 2048
|
232
|
+
n: 1
|
233
|
+
async_mode: true
|
234
|
+
- block_type: LLMParserBlock
|
235
|
+
block_config:
|
236
|
+
block_name: extract_eval_relevancy
|
237
|
+
input_cols: eval_relevancy_response_dict
|
238
|
+
extract_content: true
|
239
|
+
|
240
|
+
- block_type: TextParserBlock
|
241
|
+
block_config:
|
242
|
+
block_name: parse_eval_relevancy
|
243
|
+
input_cols: extract_eval_relevancy_content
|
244
|
+
output_cols:
|
245
|
+
- relevancy_explanation
|
246
|
+
- relevancy_score
|
247
|
+
start_tags:
|
248
|
+
- '[Start of Feedback]'
|
249
|
+
- '[Start of Score]'
|
250
|
+
end_tags:
|
251
|
+
- '[End of Feedback]'
|
252
|
+
- '[End of Score]'
|
253
|
+
- block_type: ColumnValueFilterBlock
|
254
|
+
block_config:
|
255
|
+
block_name: eval_relevancy_filter
|
256
|
+
input_cols:
|
257
|
+
- relevancy_score
|
165
258
|
filter_value: 2.0
|
166
259
|
operation: eq
|
167
260
|
convert_dtype: float
|
168
|
-
max_tokens: 2048
|
169
|
-
async_mode: true
|
170
|
-
start_tags: ["[Start of Feedback]", "[Start of Score]"]
|
171
|
-
end_tags: ["[End of Feedback]", "[End of Score]"]
|
172
261
|
|
173
|
-
- block_type:
|
262
|
+
- block_type: PromptBuilderBlock
|
174
263
|
block_config:
|
175
|
-
block_name:
|
176
|
-
input_cols:
|
177
|
-
|
264
|
+
block_name: verify_question_prompt
|
265
|
+
input_cols:
|
266
|
+
- question
|
267
|
+
output_cols: verify_question_prompt
|
178
268
|
prompt_config_path: evaluate_question.yaml
|
269
|
+
format_as_messages: true
|
270
|
+
- block_type: LLMChatBlock
|
271
|
+
block_config:
|
272
|
+
block_name: verify_question_llm_chat
|
273
|
+
input_cols: verify_question_prompt
|
274
|
+
output_cols: verify_question_response_dict
|
275
|
+
max_tokens: 2048
|
276
|
+
n: 1
|
277
|
+
async_mode: true
|
278
|
+
- block_type: LLMParserBlock
|
279
|
+
block_config:
|
280
|
+
block_name: extract_verify_question
|
281
|
+
input_cols: verify_question_response_dict
|
282
|
+
extract_content: true
|
283
|
+
|
284
|
+
- block_type: TextParserBlock
|
285
|
+
block_config:
|
286
|
+
block_name: parse_verify_question
|
287
|
+
input_cols: extract_verify_question_content
|
288
|
+
output_cols:
|
289
|
+
- verification_explanation
|
290
|
+
- verification_rating
|
291
|
+
start_tags:
|
292
|
+
- '[Start of Explanation]'
|
293
|
+
- '[Start of Rating]'
|
294
|
+
end_tags:
|
295
|
+
- '[End of Explanation]'
|
296
|
+
- '[End of Rating]'
|
297
|
+
- block_type: ColumnValueFilterBlock
|
298
|
+
block_config:
|
299
|
+
block_name: verify_question_filter
|
300
|
+
input_cols:
|
301
|
+
- verification_rating
|
179
302
|
filter_value: 1.0
|
180
303
|
operation: ge
|
181
304
|
convert_dtype: float
|
182
|
-
max_tokens: 2048
|
183
|
-
async_mode: true
|
184
|
-
start_tags: ["[Start of Explanation]", "[Start of Rating]"]
|
185
|
-
end_tags: ["[End of Explanation]", "[End of Rating]"]
|
sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/README.md
ADDED
File without changes
|
sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/__init__.py
ADDED
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
- role: system
|
2
|
+
content: You are an AI assistant knowledgeable about {{domain}} domain. Be accurate but concise in response.
|
3
|
+
|
4
|
+
- role: user
|
5
|
+
content: |
|
6
|
+
Please break down the following snippet from an article about {{domain}} into atomic facts.
|
7
|
+
|
8
|
+
1. Make sure each fact is grounded in the given text.
|
9
|
+
2. Include any necessary information needed to explain the fact or concept
|
10
|
+
3. The atomic facts should be as simple as possible, if it's compound sentence, break down one more time
|
11
|
+
4. For clarity, avoid using pronouns like 'it', 'he', 'she', 'this', 'that' etc., and instead use the full names or titles.
|
12
|
+
5. Focus only on key concepts and facts. Skip any question or problems mentioned in the passage.
|
13
|
+
6. Output the response in Japanese.
|
14
|
+
|
15
|
+
To help you understand the task, here is an example:
|
16
|
+
[Passage]
|
17
|
+
The tournament was contested by ten national teams, maintaining the same format used in 2019. After six weeks of round-robin matches, India, South Africa, Australia, and New Zealand finished as the top four and qualified for the knockout stage. In the knockout stage, India and Australia beat New Zealand and South Africa, respectively, to advance to the final, played on 19 November at the Narendra Modi Stadium in Ahmedabad. Australia won the final by six wickets, winning their sixth Cricket World Cup title.
|
18
|
+
[Facts]
|
19
|
+
1. The tournament was contested by ten national teams.
|
20
|
+
2. The tournament maintained the same format used in 2019.
|
21
|
+
3. The round-robin matches lasted for six weeks.
|
22
|
+
4. India finished as one of the top four teams.
|
23
|
+
5. South Africa finished as one of the top four teams.
|
24
|
+
6. Australia finished as one of the top four teams.
|
25
|
+
7. New Zealand finished as one of the top four teams.
|
26
|
+
8. India, South Africa, Australia, and New Zealand qualified for the knockout stage.
|
27
|
+
9. In the knockout stage, India beat New Zealand.
|
28
|
+
10. In the knockout stage, Australia beat South Africa.
|
29
|
+
11. India advanced to the final.
|
30
|
+
12. Australia advanced to the final.
|
31
|
+
13. The final was played on 19 November.
|
32
|
+
14. The final was held at the Narendra Modi Stadium in Ahmedabad.
|
33
|
+
15. Australia won the final by six wickets.
|
34
|
+
16. Australia won their sixth Cricket World Cup title.
|
35
|
+
[End]
|
36
|
+
|
37
|
+
Now it's your turn breakdown following snippet from article about {{domain}} into atomic facts following similar style as above examples
|
38
|
+
[Passage]
|
39
|
+
{{document_outline}}
|
40
|
+
{{document}}
|
41
|
+
[Facts]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- role: system
|
2
|
+
content: You are an AI assistant that is expert at summarizing text.
|
3
|
+
|
4
|
+
- role: user
|
5
|
+
content: |
|
6
|
+
Give me detailed summary for below document, making sure all key points are covered.
|
7
|
+
|
8
|
+
Do not add any new information.
|
9
|
+
Do not miss any key points from the provided document.
|
10
|
+
Output the response in Japanese.
|
11
|
+
|
12
|
+
Document:
|
13
|
+
{{document_outline}}
|
14
|
+
{{document}}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- role: system
|
2
|
+
content: You are an AI assistant that is expert at summarizing text.
|
3
|
+
|
4
|
+
- role: user
|
5
|
+
content: |
|
6
|
+
Give me detailed extractive summary for below document, making sure all key points are covered.
|
7
|
+
|
8
|
+
Do not add any new information.
|
9
|
+
Do not miss any key points from the provided document.
|
10
|
+
Output the response in Japanese.
|
11
|
+
|
12
|
+
Document:
|
13
|
+
{{document_outline}}
|
14
|
+
{{document}}
|
sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/multilingual/japanese/flow.yaml
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
metadata:
|
2
|
+
id: clean-shadow-397
|
3
|
+
name: "Advanced Japanese Document Grounded Question-Answer Generation Flow for Knowledge Tuning"
|
4
|
+
description: "A comprehensive flow that generates high-quality question-answer pairs from Japanese input documents using multiple LLM blocks for question generation, answer synthesis, and quality evaluation."
|
5
|
+
version: "1.0.0"
|
6
|
+
author: "SDG Hub Contributors"
|
7
|
+
|
8
|
+
recommended_models:
|
9
|
+
default: "microsoft/phi-4"
|
10
|
+
compatible: ["meta-llama/Llama-3.3-70B-Instruct", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
|
11
|
+
experimental: []
|
12
|
+
|
13
|
+
tags:
|
14
|
+
- "question-generation"
|
15
|
+
- "knowledge-extraction"
|
16
|
+
- "qa-pairs"
|
17
|
+
- "document-processing"
|
18
|
+
- "educational"
|
19
|
+
- "japanese"
|
20
|
+
|
21
|
+
license: "Apache-2.0"
|
22
|
+
|
23
|
+
dataset_requirements:
|
24
|
+
required_columns:
|
25
|
+
- "document"
|
26
|
+
- "document_outline"
|
27
|
+
- "domain"
|
28
|
+
- "icl_document"
|
29
|
+
- "icl_query_1"
|
30
|
+
- "icl_response_1"
|
31
|
+
- "icl_query_2"
|
32
|
+
- "icl_response_2"
|
33
|
+
- "icl_query_3"
|
34
|
+
- "icl_response_3"
|
35
|
+
description: "Input dataset should contain documents with Japanese text content and domain classification. Each document should be substantial enough for meaningful question generation (minimum 100 words recommended)."
|
36
|
+
|
37
|
+
blocks:
|
38
|
+
- block_type: DuplicateColumnsBlock
|
39
|
+
block_config:
|
40
|
+
block_name: duplicate_document_col
|
41
|
+
input_cols: {document: base_document}
|
42
|
+
|
43
|
+
- block_type: PromptBuilderBlock
|
44
|
+
block_config:
|
45
|
+
block_name: detailed_summary_prompt
|
46
|
+
input_cols: [document, document_outline]
|
47
|
+
output_cols: summary_prompt
|
48
|
+
prompt_config_path: detailed_summary_ja.yaml
|
49
|
+
|
50
|
+
- block_type: LLMChatBlock
|
51
|
+
block_config:
|
52
|
+
block_name: gen_detailed_summary
|
53
|
+
input_cols: summary_prompt
|
54
|
+
output_cols: raw_summary_detailed
|
55
|
+
max_tokens: 2048
|
56
|
+
async_mode: true
|
57
|
+
|
58
|
+
- block_type: LLMParserBlock
|
59
|
+
block_config:
|
60
|
+
block_name: extract_detailed_summary
|
61
|
+
input_cols: raw_summary_detailed
|
62
|
+
extract_content: true
|
63
|
+
|
64
|
+
- block_type: TextParserBlock
|
65
|
+
block_config:
|
66
|
+
block_name: parse_detailed_summary
|
67
|
+
input_cols: extract_detailed_summary_content
|
68
|
+
output_cols: summary_detailed
|
69
|
+
start_tags: [""]
|
70
|
+
end_tags: [""]
|
71
|
+
|
72
|
+
- block_type: PromptBuilderBlock
|
73
|
+
block_config:
|
74
|
+
block_name: atomic_facts_prompt
|
75
|
+
input_cols: [document, document_outline, domain]
|
76
|
+
output_cols: atomic_facts_prompt
|
77
|
+
prompt_config_path: atomic_facts_ja.yaml
|
78
|
+
|
79
|
+
- block_type: LLMChatBlock
|
80
|
+
block_config:
|
81
|
+
block_name: gen_atomic_facts
|
82
|
+
input_cols: atomic_facts_prompt
|
83
|
+
output_cols: raw_atomic_facts
|
84
|
+
max_tokens: 2048
|
85
|
+
async_mode: true
|
86
|
+
|
87
|
+
- block_type: LLMParserBlock
|
88
|
+
block_config:
|
89
|
+
block_name: extract_atomic_facts
|
90
|
+
input_cols: raw_atomic_facts
|
91
|
+
extract_content: true
|
92
|
+
|
93
|
+
- block_type: TextParserBlock
|
94
|
+
block_config:
|
95
|
+
block_name: parse_atomic_facts
|
96
|
+
input_cols: extract_atomic_facts_content
|
97
|
+
output_cols: summary_atomic_facts
|
98
|
+
start_tags: [""]
|
99
|
+
end_tags: [""]
|
100
|
+
|
101
|
+
- block_type: PromptBuilderBlock
|
102
|
+
block_config:
|
103
|
+
block_name: extractive_summary_prompt
|
104
|
+
input_cols: [document, document_outline]
|
105
|
+
output_cols: extractive_summary_prompt
|
106
|
+
prompt_config_path: extractive_summary_ja.yaml
|
107
|
+
|
108
|
+
- block_type: LLMChatBlock
|
109
|
+
block_config:
|
110
|
+
block_name: gen_extractive_summary
|
111
|
+
input_cols: extractive_summary_prompt
|
112
|
+
output_cols: raw_summary_extractive
|
113
|
+
max_tokens: 2048
|
114
|
+
async_mode: true
|
115
|
+
|
116
|
+
- block_type: LLMParserBlock
|
117
|
+
block_config:
|
118
|
+
block_name: extract_extractive_summary
|
119
|
+
input_cols: raw_summary_extractive
|
120
|
+
extract_content: true
|
121
|
+
|
122
|
+
- block_type: TextParserBlock
|
123
|
+
block_config:
|
124
|
+
block_name: parse_extractive_summary
|
125
|
+
input_cols: extract_extractive_summary_content
|
126
|
+
output_cols: summary_extractive
|
127
|
+
start_tags: [""]
|
128
|
+
end_tags: [""]
|
129
|
+
|
130
|
+
- block_type: MeltColumnsBlock
|
131
|
+
block_config:
|
132
|
+
block_name: melt_summary_columns
|
133
|
+
input_cols: [summary_detailed, summary_extractive, summary_atomic_facts, base_document]
|
134
|
+
output_cols: [summary, dataset_type]
|
135
|
+
|
136
|
+
- block_type: RenameColumnsBlock
|
137
|
+
block_config:
|
138
|
+
block_name: rename_to_document_column
|
139
|
+
input_cols: {document: raw_document, summary: document}
|
140
|
+
|
141
|
+
- block_type: PromptBuilderBlock
|
142
|
+
block_config:
|
143
|
+
block_name: knowledge_generation_prompt
|
144
|
+
input_cols: [domain, document, document_outline, icl_document, icl_query_1, icl_response_1, icl_query_2, icl_response_2, icl_query_3, icl_response_3]
|
145
|
+
output_cols: knowledge_generation_prompt
|
146
|
+
prompt_config_path: generate_questions_responses_ja.yaml
|
147
|
+
|
148
|
+
- block_type: LLMChatBlock
|
149
|
+
block_config:
|
150
|
+
block_name: knowledge_generation
|
151
|
+
input_cols: knowledge_generation_prompt
|
152
|
+
output_cols: raw_knowledge_generation
|
153
|
+
temperature: 0.0
|
154
|
+
max_tokens: 2048
|
155
|
+
async_mode: true
|
156
|
+
|
157
|
+
- block_type: LLMParserBlock
|
158
|
+
block_config:
|
159
|
+
block_name: extract_knowledge_generation
|
160
|
+
input_cols: raw_knowledge_generation
|
161
|
+
extract_content: true
|
162
|
+
|
163
|
+
- block_type: TextParserBlock
|
164
|
+
block_config:
|
165
|
+
block_name: parse_knowledge_generation
|
166
|
+
input_cols: extract_knowledge_generation_content
|
167
|
+
output_cols: [question, response]
|
168
|
+
parsing_pattern: "\\[(?:Question|QUESTION)\\]\\s*(.*?)\\s*\\[(?:Answer|ANSWER)\\]\\s*(.*?)\\s*(?=\\[(?:Question|QUESTION)\\]|$)"
|
169
|
+
parser_cleanup_tags: ["[END]"]
|
170
|
+
|
171
|
+
- block_type: PromptBuilderBlock
|
172
|
+
block_config:
|
173
|
+
block_name: eval_faithful_prompt
|
174
|
+
input_cols: [document, response]
|
175
|
+
output_cols: eval_faithful_prompt
|
176
|
+
prompt_config_path: ../../instructlab/evaluate_faithfulness.yaml
|
177
|
+
format_as_messages: true
|
178
|
+
|
179
|
+
- block_type: LLMChatBlock
|
180
|
+
block_config:
|
181
|
+
block_name: eval_faithful_llm_chat
|
182
|
+
input_cols: eval_faithful_prompt
|
183
|
+
output_cols: eval_faithful_response_dict
|
184
|
+
max_tokens: 2048
|
185
|
+
n: 1
|
186
|
+
async_mode: true
|
187
|
+
|
188
|
+
- block_type: LLMParserBlock
|
189
|
+
block_config:
|
190
|
+
block_name: extract_eval_faithful
|
191
|
+
input_cols: eval_faithful_response_dict
|
192
|
+
extract_content: true
|
193
|
+
|
194
|
+
- block_type: TextParserBlock
|
195
|
+
block_config:
|
196
|
+
block_name: parse_eval_faithful
|
197
|
+
input_cols: extract_eval_faithful_content
|
198
|
+
output_cols:
|
199
|
+
- faithfulness_explanation
|
200
|
+
- faithfulness_judgment
|
201
|
+
start_tags:
|
202
|
+
- '[Start of Explanation]'
|
203
|
+
- '[Start of Answer]'
|
204
|
+
end_tags:
|
205
|
+
- '[End of Explanation]'
|
206
|
+
- '[End of Answer]'
|
207
|
+
|
208
|
+
- block_type: ColumnValueFilterBlock
|
209
|
+
block_config:
|
210
|
+
block_name: eval_faithful_filter
|
211
|
+
input_cols:
|
212
|
+
- faithfulness_judgment
|
213
|
+
filter_value: "YES"
|
214
|
+
operation: eq
|
215
|
+
|
216
|
+
- block_type: PromptBuilderBlock
|
217
|
+
block_config:
|
218
|
+
block_name: eval_relevancy_prompt
|
219
|
+
input_cols:
|
220
|
+
- question
|
221
|
+
- response
|
222
|
+
output_cols: eval_relevancy_prompt
|
223
|
+
prompt_config_path: ../../instructlab/evaluate_relevancy.yaml
|
224
|
+
format_as_messages: true
|
225
|
+
- block_type: LLMChatBlock
|
226
|
+
block_config:
|
227
|
+
block_name: eval_relevancy_llm_chat
|
228
|
+
input_cols: eval_relevancy_prompt
|
229
|
+
output_cols: eval_relevancy_response_dict
|
230
|
+
max_tokens: 2048
|
231
|
+
n: 1
|
232
|
+
async_mode: true
|
233
|
+
- block_type: LLMParserBlock
|
234
|
+
block_config:
|
235
|
+
block_name: extract_eval_relevancy
|
236
|
+
input_cols: eval_relevancy_response_dict
|
237
|
+
extract_content: true
|
238
|
+
|
239
|
+
- block_type: TextParserBlock
|
240
|
+
block_config:
|
241
|
+
block_name: parse_eval_relevancy
|
242
|
+
input_cols: extract_eval_relevancy_content
|
243
|
+
output_cols:
|
244
|
+
- relevancy_explanation
|
245
|
+
- relevancy_score
|
246
|
+
start_tags:
|
247
|
+
- '[Start of Feedback]'
|
248
|
+
- '[Start of Score]'
|
249
|
+
end_tags:
|
250
|
+
- '[End of Feedback]'
|
251
|
+
- '[End of Score]'
|
252
|
+
- block_type: ColumnValueFilterBlock
|
253
|
+
block_config:
|
254
|
+
block_name: eval_relevancy_filter
|
255
|
+
input_cols:
|
256
|
+
- relevancy_score
|
257
|
+
filter_value: 2.0
|
258
|
+
operation: eq
|
259
|
+
convert_dtype: float
|
260
|
+
|
261
|
+
- block_type: PromptBuilderBlock
|
262
|
+
block_config:
|
263
|
+
block_name: verify_question_prompt
|
264
|
+
input_cols:
|
265
|
+
- question
|
266
|
+
output_cols: verify_question_prompt
|
267
|
+
prompt_config_path: ../../instructlab/evaluate_question.yaml
|
268
|
+
format_as_messages: true
|
269
|
+
- block_type: LLMChatBlock
|
270
|
+
block_config:
|
271
|
+
block_name: verify_question_llm_chat
|
272
|
+
input_cols: verify_question_prompt
|
273
|
+
output_cols: verify_question_response_dict
|
274
|
+
max_tokens: 2048
|
275
|
+
n: 1
|
276
|
+
async_mode: true
|
277
|
+
- block_type: LLMParserBlock
|
278
|
+
block_config:
|
279
|
+
block_name: extract_verify_question
|
280
|
+
input_cols: verify_question_response_dict
|
281
|
+
extract_content: true
|
282
|
+
|
283
|
+
- block_type: TextParserBlock
|
284
|
+
block_config:
|
285
|
+
block_name: parse_verify_question
|
286
|
+
input_cols: extract_verify_question_content
|
287
|
+
output_cols:
|
288
|
+
- verification_explanation
|
289
|
+
- verification_rating
|
290
|
+
start_tags:
|
291
|
+
- '[Start of Explanation]'
|
292
|
+
- '[Start of Rating]'
|
293
|
+
end_tags:
|
294
|
+
- '[End of Explanation]'
|
295
|
+
- '[End of Rating]'
|
296
|
+
- block_type: ColumnValueFilterBlock
|
297
|
+
block_config:
|
298
|
+
block_name: verify_question_filter
|
299
|
+
input_cols:
|
300
|
+
- verification_rating
|
301
|
+
filter_value: 1.0
|
302
|
+
operation: ge
|
303
|
+
convert_dtype: float
|