sdg-hub 0.1.3__py3-none-any.whl → 0.2.0__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 +28 -1
- sdg_hub/_version.py +2 -2
- sdg_hub/core/__init__.py +22 -0
- sdg_hub/core/blocks/__init__.py +58 -0
- sdg_hub/core/blocks/base.py +313 -0
- sdg_hub/core/blocks/deprecated_blocks/__init__.py +29 -0
- sdg_hub/core/blocks/deprecated_blocks/combine_columns.py +93 -0
- sdg_hub/core/blocks/deprecated_blocks/duplicate_columns.py +88 -0
- sdg_hub/core/blocks/deprecated_blocks/filter_by_value.py +103 -0
- sdg_hub/core/blocks/deprecated_blocks/flatten_columns.py +94 -0
- sdg_hub/core/blocks/deprecated_blocks/llmblock.py +479 -0
- sdg_hub/core/blocks/deprecated_blocks/rename_columns.py +88 -0
- sdg_hub/core/blocks/deprecated_blocks/sample_populator.py +58 -0
- sdg_hub/core/blocks/deprecated_blocks/selector.py +97 -0
- sdg_hub/core/blocks/deprecated_blocks/set_to_majority_value.py +88 -0
- sdg_hub/core/blocks/evaluation/__init__.py +9 -0
- sdg_hub/core/blocks/evaluation/evaluate_faithfulness_block.py +564 -0
- sdg_hub/core/blocks/evaluation/evaluate_relevancy_block.py +564 -0
- sdg_hub/core/blocks/evaluation/verify_question_block.py +564 -0
- sdg_hub/core/blocks/filtering/__init__.py +12 -0
- sdg_hub/core/blocks/filtering/column_value_filter.py +188 -0
- sdg_hub/core/blocks/llm/__init__.py +25 -0
- sdg_hub/core/blocks/llm/client_manager.py +398 -0
- sdg_hub/core/blocks/llm/config.py +336 -0
- sdg_hub/core/blocks/llm/error_handler.py +368 -0
- sdg_hub/core/blocks/llm/llm_chat_block.py +542 -0
- sdg_hub/core/blocks/llm/prompt_builder_block.py +368 -0
- sdg_hub/core/blocks/llm/text_parser_block.py +310 -0
- sdg_hub/core/blocks/registry.py +331 -0
- sdg_hub/core/blocks/transform/__init__.py +23 -0
- sdg_hub/core/blocks/transform/duplicate_columns.py +88 -0
- sdg_hub/core/blocks/transform/index_based_mapper.py +225 -0
- sdg_hub/core/blocks/transform/melt_columns.py +126 -0
- sdg_hub/core/blocks/transform/rename_columns.py +69 -0
- sdg_hub/core/blocks/transform/text_concat.py +102 -0
- sdg_hub/core/blocks/transform/uniform_col_val_setter.py +101 -0
- sdg_hub/core/flow/__init__.py +20 -0
- sdg_hub/core/flow/base.py +980 -0
- sdg_hub/core/flow/metadata.py +344 -0
- sdg_hub/core/flow/migration.py +187 -0
- sdg_hub/core/flow/registry.py +330 -0
- sdg_hub/core/flow/validation.py +265 -0
- sdg_hub/{utils → core/utils}/__init__.py +6 -4
- sdg_hub/{utils → core/utils}/datautils.py +1 -3
- sdg_hub/core/utils/error_handling.py +208 -0
- sdg_hub/{utils → core/utils}/path_resolution.py +2 -2
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/atomic_facts.yaml +40 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/detailed_summary.yaml +13 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_faithfulness.yaml +64 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_question.yaml +29 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/evaluate_relevancy.yaml +81 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/extractive_summary.yaml +13 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/flow.yaml +191 -0
- sdg_hub/flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/generate_questions_responses.yaml +54 -0
- sdg_hub-0.2.0.dist-info/METADATA +218 -0
- sdg_hub-0.2.0.dist-info/RECORD +63 -0
- sdg_hub/blocks/__init__.py +0 -42
- sdg_hub/blocks/block.py +0 -96
- sdg_hub/blocks/llmblock.py +0 -375
- sdg_hub/blocks/openaichatblock.py +0 -556
- sdg_hub/blocks/utilblocks.py +0 -597
- sdg_hub/checkpointer.py +0 -139
- sdg_hub/configs/annotations/cot_reflection.yaml +0 -34
- sdg_hub/configs/annotations/detailed_annotations.yaml +0 -28
- sdg_hub/configs/annotations/detailed_description.yaml +0 -10
- sdg_hub/configs/annotations/detailed_description_icl.yaml +0 -32
- sdg_hub/configs/annotations/simple_annotations.yaml +0 -9
- sdg_hub/configs/knowledge/__init__.py +0 -0
- sdg_hub/configs/knowledge/atomic_facts.yaml +0 -46
- sdg_hub/configs/knowledge/auxilary_instructions.yaml +0 -35
- sdg_hub/configs/knowledge/detailed_summary.yaml +0 -18
- sdg_hub/configs/knowledge/evaluate_faithfulness.yaml +0 -68
- sdg_hub/configs/knowledge/evaluate_question.yaml +0 -38
- sdg_hub/configs/knowledge/evaluate_relevancy.yaml +0 -84
- sdg_hub/configs/knowledge/extractive_summary.yaml +0 -18
- sdg_hub/configs/knowledge/generate_code_questions_responses.yaml +0 -39
- sdg_hub/configs/knowledge/generate_questions.yaml +0 -82
- sdg_hub/configs/knowledge/generate_questions_responses.yaml +0 -56
- sdg_hub/configs/knowledge/generate_responses.yaml +0 -86
- sdg_hub/configs/knowledge/mcq_generation.yaml +0 -83
- sdg_hub/configs/knowledge/router.yaml +0 -12
- sdg_hub/configs/knowledge/simple_generate_qa.yaml +0 -34
- sdg_hub/configs/reasoning/__init__.py +0 -0
- sdg_hub/configs/reasoning/dynamic_cot.yaml +0 -40
- sdg_hub/configs/skills/__init__.py +0 -0
- sdg_hub/configs/skills/analyzer.yaml +0 -48
- sdg_hub/configs/skills/annotation.yaml +0 -36
- sdg_hub/configs/skills/contexts.yaml +0 -28
- sdg_hub/configs/skills/critic.yaml +0 -60
- sdg_hub/configs/skills/evaluate_freeform_pair.yaml +0 -111
- sdg_hub/configs/skills/evaluate_freeform_questions.yaml +0 -78
- sdg_hub/configs/skills/evaluate_grounded_pair.yaml +0 -119
- sdg_hub/configs/skills/evaluate_grounded_questions.yaml +0 -51
- sdg_hub/configs/skills/freeform_questions.yaml +0 -34
- sdg_hub/configs/skills/freeform_responses.yaml +0 -39
- sdg_hub/configs/skills/grounded_questions.yaml +0 -38
- sdg_hub/configs/skills/grounded_responses.yaml +0 -59
- sdg_hub/configs/skills/icl_examples/STEM.yaml +0 -56
- sdg_hub/configs/skills/icl_examples/__init__.py +0 -0
- sdg_hub/configs/skills/icl_examples/coding.yaml +0 -97
- sdg_hub/configs/skills/icl_examples/extraction.yaml +0 -36
- sdg_hub/configs/skills/icl_examples/humanities.yaml +0 -71
- sdg_hub/configs/skills/icl_examples/math.yaml +0 -85
- sdg_hub/configs/skills/icl_examples/reasoning.yaml +0 -30
- sdg_hub/configs/skills/icl_examples/roleplay.yaml +0 -45
- sdg_hub/configs/skills/icl_examples/writing.yaml +0 -80
- sdg_hub/configs/skills/judge.yaml +0 -53
- sdg_hub/configs/skills/planner.yaml +0 -67
- sdg_hub/configs/skills/respond.yaml +0 -8
- sdg_hub/configs/skills/revised_responder.yaml +0 -78
- sdg_hub/configs/skills/router.yaml +0 -59
- sdg_hub/configs/skills/simple_generate_qa_freeform.yaml +0 -27
- sdg_hub/configs/skills/simple_generate_qa_grounded.yaml +0 -31
- sdg_hub/flow.py +0 -477
- sdg_hub/flow_runner.py +0 -450
- sdg_hub/flows/generation/knowledge/mmlu_bench.yaml +0 -13
- sdg_hub/flows/generation/knowledge/simple_knowledge.yaml +0 -12
- sdg_hub/flows/generation/knowledge/synth_knowledge.yaml +0 -89
- sdg_hub/flows/generation/knowledge/synth_knowledge1.5.yaml +0 -148
- sdg_hub/flows/generation/skills/improve_responses.yaml +0 -103
- sdg_hub/flows/generation/skills/simple_freeform_skill.yaml +0 -12
- sdg_hub/flows/generation/skills/simple_grounded_skill.yaml +0 -12
- sdg_hub/flows/generation/skills/synth_grounded_skills.yaml +0 -80
- sdg_hub/flows/generation/skills/synth_skills.yaml +0 -59
- sdg_hub/pipeline.py +0 -121
- sdg_hub/prompts.py +0 -74
- sdg_hub/registry.py +0 -122
- sdg_hub/sdg.py +0 -206
- sdg_hub/utils/config_validation.py +0 -91
- sdg_hub/utils/error_handling.py +0 -94
- sdg_hub/utils/validation_result.py +0 -10
- sdg_hub-0.1.3.dist-info/METADATA +0 -190
- sdg_hub-0.1.3.dist-info/RECORD +0 -89
- sdg_hub/{logger_config.py → core/utils/logger_config.py} +1 -1
- /sdg_hub/{configs/__init__.py → flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab/README.md} +0 -0
- /sdg_hub/{configs/annotations → flows/qa_generation/document_grounded_qa/multi_summary_qa/instructlab}/__init__.py +0 -0
- {sdg_hub-0.1.3.dist-info → sdg_hub-0.2.0.dist-info}/WHEEL +0 -0
- {sdg_hub-0.1.3.dist-info → sdg_hub-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {sdg_hub-0.1.3.dist-info → sdg_hub-0.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
"""Deprecated RenameColumns for backwards compatibility.
|
3
|
+
|
4
|
+
This module provides a deprecated wrapper around RenameColumnsBlock
|
5
|
+
to maintain backwards compatibility with existing code and configurations.
|
6
|
+
"""
|
7
|
+
|
8
|
+
# Standard
|
9
|
+
from typing import Any
|
10
|
+
import warnings
|
11
|
+
|
12
|
+
# Third Party
|
13
|
+
from datasets import Dataset
|
14
|
+
|
15
|
+
# Local
|
16
|
+
from ...utils.logger_config import setup_logger
|
17
|
+
from ..base import BaseBlock
|
18
|
+
from ..registry import BlockRegistry
|
19
|
+
from ..transform import RenameColumnsBlock
|
20
|
+
|
21
|
+
logger = setup_logger(__name__)
|
22
|
+
|
23
|
+
|
24
|
+
@BlockRegistry.register(
|
25
|
+
"RenameColumns",
|
26
|
+
"deprecated",
|
27
|
+
"DEPRECATED: Use RenameColumnsBlock instead. Renames columns in a dataset according to a mapping dictionary",
|
28
|
+
)
|
29
|
+
class RenameColumns(BaseBlock):
|
30
|
+
"""DEPRECATED: Block for renaming columns in a dataset.
|
31
|
+
|
32
|
+
This block is deprecated and maintained only for backwards compatibility.
|
33
|
+
Please use RenameColumnsBlock instead.
|
34
|
+
|
35
|
+
This block renames columns in a dataset according to a mapping dictionary,
|
36
|
+
where keys are existing column names and values are new column names.
|
37
|
+
"""
|
38
|
+
|
39
|
+
def __init__(
|
40
|
+
self,
|
41
|
+
block_name: str,
|
42
|
+
columns_map: dict[str, str],
|
43
|
+
) -> None:
|
44
|
+
"""Initialize the deprecated RenameColumns.
|
45
|
+
|
46
|
+
Parameters
|
47
|
+
----------
|
48
|
+
block_name : str
|
49
|
+
Name of the block.
|
50
|
+
columns_map : Dict[str, str]
|
51
|
+
Dictionary mapping existing column names to new column names.
|
52
|
+
Keys are existing column names, values are new column names.
|
53
|
+
"""
|
54
|
+
# Issue deprecation warning
|
55
|
+
warnings.warn(
|
56
|
+
"RenameColumns is deprecated and will be removed in a future version. "
|
57
|
+
"Please use RenameColumnsBlock instead.",
|
58
|
+
DeprecationWarning,
|
59
|
+
stacklevel=2,
|
60
|
+
)
|
61
|
+
|
62
|
+
# Map old signature to new signature
|
63
|
+
super().__init__(
|
64
|
+
block_name=block_name,
|
65
|
+
input_cols=columns_map,
|
66
|
+
output_cols=[],
|
67
|
+
)
|
68
|
+
|
69
|
+
# Create the new block instance with mapped parameters
|
70
|
+
self._new_block = RenameColumnsBlock(
|
71
|
+
block_name=block_name,
|
72
|
+
input_cols=columns_map,
|
73
|
+
)
|
74
|
+
|
75
|
+
def generate(self, samples: Dataset, **kwargs: Any) -> Dataset:
|
76
|
+
"""Generate dataset with renamed columns using the new RenameColumnsBlock.
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
samples : Dataset
|
81
|
+
The input dataset to rename columns in.
|
82
|
+
|
83
|
+
Returns
|
84
|
+
-------
|
85
|
+
Dataset
|
86
|
+
The dataset with renamed columns.
|
87
|
+
"""
|
88
|
+
return self._new_block.generate(samples, **kwargs)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
"""DEPRECATED: SamplePopulatorBlock for backward compatibility.
|
3
|
+
|
4
|
+
This module provides a deprecated stub for SamplePopulatorBlock.
|
5
|
+
This block is deprecated and will be replaced with a router block.
|
6
|
+
"""
|
7
|
+
|
8
|
+
# Standard
|
9
|
+
from typing import Any
|
10
|
+
import warnings
|
11
|
+
|
12
|
+
# Third Party
|
13
|
+
from datasets import Dataset
|
14
|
+
|
15
|
+
# Local
|
16
|
+
from ...utils.logger_config import setup_logger
|
17
|
+
from ..base import BaseBlock
|
18
|
+
from ..registry import BlockRegistry
|
19
|
+
|
20
|
+
logger = setup_logger(__name__)
|
21
|
+
|
22
|
+
|
23
|
+
@BlockRegistry.register(
|
24
|
+
"SamplePopulatorBlock",
|
25
|
+
"deprecated",
|
26
|
+
"DEPRECATED: Use a router block instead. Populates dataset with data from configuration files",
|
27
|
+
)
|
28
|
+
class SamplePopulatorBlock(BaseBlock):
|
29
|
+
"""DEPRECATED: Block for populating dataset with data from configuration files.
|
30
|
+
|
31
|
+
.. deprecated::
|
32
|
+
This block is deprecated and will be replaced with a router block.
|
33
|
+
"""
|
34
|
+
|
35
|
+
def __init__(
|
36
|
+
self,
|
37
|
+
block_name: str,
|
38
|
+
config_paths: list[str],
|
39
|
+
column_name: str,
|
40
|
+
post_fix: str = "",
|
41
|
+
**batch_kwargs: dict[str, Any],
|
42
|
+
) -> None:
|
43
|
+
warnings.warn(
|
44
|
+
"SamplePopulatorBlock is deprecated and will be replaced with a router block.",
|
45
|
+
DeprecationWarning,
|
46
|
+
stacklevel=2,
|
47
|
+
)
|
48
|
+
|
49
|
+
# Initialize with dummy values for BaseBlock validation
|
50
|
+
super().__init__(
|
51
|
+
block_name=block_name, input_cols=[column_name], output_cols=[column_name]
|
52
|
+
)
|
53
|
+
|
54
|
+
def generate(self, samples: Dataset, **kwargs: Any) -> Dataset:
|
55
|
+
"""Generate method - raises error as block is deprecated."""
|
56
|
+
raise NotImplementedError(
|
57
|
+
"SamplePopulatorBlock is deprecated and will be replaced with a router block."
|
58
|
+
)
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
"""DEPRECATED: SelectorBlock for backward compatibility.
|
3
|
+
|
4
|
+
This module provides a deprecated wrapper for the old SelectorBlock interface.
|
5
|
+
Use transform.IndexBasedMapperBlock instead.
|
6
|
+
"""
|
7
|
+
|
8
|
+
# Standard
|
9
|
+
from typing import Any
|
10
|
+
import warnings
|
11
|
+
|
12
|
+
# Third Party
|
13
|
+
from datasets import Dataset
|
14
|
+
|
15
|
+
# Local
|
16
|
+
from ...utils.logger_config import setup_logger
|
17
|
+
from ..base import BaseBlock
|
18
|
+
from ..registry import BlockRegistry
|
19
|
+
from ..transform.index_based_mapper import IndexBasedMapperBlock
|
20
|
+
|
21
|
+
logger = setup_logger(__name__)
|
22
|
+
|
23
|
+
|
24
|
+
@BlockRegistry.register(
|
25
|
+
"SelectorBlock",
|
26
|
+
"deprecated",
|
27
|
+
"DEPRECATED: Use IndexBasedMapperBlock instead. Selects and maps values from one column to another",
|
28
|
+
)
|
29
|
+
class SelectorBlock(BaseBlock):
|
30
|
+
"""DEPRECATED: Block for selecting and mapping values from one column to another.
|
31
|
+
|
32
|
+
.. deprecated::
|
33
|
+
Use `sdg_hub.blocks.transform.IndexBasedMapperBlock` instead.
|
34
|
+
This class will be removed in a future version.
|
35
|
+
|
36
|
+
This block uses a mapping dictionary to select values from one column and
|
37
|
+
store them in a new output column based on a choice column's value.
|
38
|
+
|
39
|
+
Parameters
|
40
|
+
----------
|
41
|
+
block_name : str
|
42
|
+
Name of the block.
|
43
|
+
choice_map : Dict[str, str]
|
44
|
+
Dictionary mapping choice values to column names.
|
45
|
+
choice_col : str
|
46
|
+
Name of the column containing choice values.
|
47
|
+
output_col : str
|
48
|
+
Name of the column to store selected values.
|
49
|
+
**batch_kwargs : Dict[str, Any]
|
50
|
+
Additional keyword arguments for batch processing.
|
51
|
+
"""
|
52
|
+
|
53
|
+
def __init__(
|
54
|
+
self,
|
55
|
+
block_name: str,
|
56
|
+
choice_map: dict[str, str],
|
57
|
+
choice_col: str,
|
58
|
+
output_col: str,
|
59
|
+
**batch_kwargs: dict[str, Any],
|
60
|
+
) -> None:
|
61
|
+
warnings.warn(
|
62
|
+
"SelectorBlock is deprecated. Use sdg_hub.blocks.transform.IndexBasedMapperBlock instead.",
|
63
|
+
DeprecationWarning,
|
64
|
+
stacklevel=2,
|
65
|
+
)
|
66
|
+
|
67
|
+
# Initialize with dummy values for BaseBlock validation
|
68
|
+
# We need all columns referenced in choice_map as input, plus the choice column
|
69
|
+
all_input_cols = list(choice_map.values()) + [choice_col]
|
70
|
+
|
71
|
+
super().__init__(
|
72
|
+
block_name=block_name, input_cols=all_input_cols, output_cols=[output_col]
|
73
|
+
)
|
74
|
+
|
75
|
+
# Create the new implementation
|
76
|
+
self._impl = IndexBasedMapperBlock(
|
77
|
+
block_name=block_name,
|
78
|
+
input_cols=all_input_cols,
|
79
|
+
output_cols=[output_col],
|
80
|
+
choice_map=choice_map,
|
81
|
+
choice_cols=[choice_col],
|
82
|
+
)
|
83
|
+
|
84
|
+
def generate(self, samples: Dataset) -> Dataset:
|
85
|
+
"""Generate a new dataset with selected values.
|
86
|
+
|
87
|
+
Parameters
|
88
|
+
----------
|
89
|
+
samples : Dataset
|
90
|
+
Input dataset to process.
|
91
|
+
|
92
|
+
Returns
|
93
|
+
-------
|
94
|
+
Dataset
|
95
|
+
Dataset with selected values stored in output column.
|
96
|
+
"""
|
97
|
+
return self._impl.generate(samples)
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
"""Deprecated SetToMajorityValue for backwards compatibility.
|
3
|
+
|
4
|
+
This module provides a deprecated wrapper around UniformColumnValueSetter
|
5
|
+
to maintain backwards compatibility with existing code and configurations.
|
6
|
+
"""
|
7
|
+
|
8
|
+
# Standard
|
9
|
+
from typing import Any
|
10
|
+
import warnings
|
11
|
+
|
12
|
+
# Third Party
|
13
|
+
from datasets import Dataset
|
14
|
+
|
15
|
+
# Local
|
16
|
+
from ...utils.logger_config import setup_logger
|
17
|
+
from ..base import BaseBlock
|
18
|
+
from ..registry import BlockRegistry
|
19
|
+
from ..transform import UniformColumnValueSetter
|
20
|
+
|
21
|
+
logger = setup_logger(__name__)
|
22
|
+
|
23
|
+
|
24
|
+
@BlockRegistry.register(
|
25
|
+
"SetToMajorityValue",
|
26
|
+
"deprecated",
|
27
|
+
"DEPRECATED: Use UniformColumnValueSetter with reduction_strategy='mode' instead. Sets all values in a column to the most frequent value",
|
28
|
+
)
|
29
|
+
class SetToMajorityValue(BaseBlock):
|
30
|
+
"""DEPRECATED: Block for setting all values in a column to the most frequent value.
|
31
|
+
|
32
|
+
This block is deprecated and maintained only for backwards compatibility.
|
33
|
+
Please use UniformColumnValueSetter with reduction_strategy='mode' instead.
|
34
|
+
|
35
|
+
This block finds the most common value (mode) in a specified column and
|
36
|
+
replaces all values in that column with this majority value.
|
37
|
+
"""
|
38
|
+
|
39
|
+
def __init__(
|
40
|
+
self,
|
41
|
+
block_name: str,
|
42
|
+
col_name: str,
|
43
|
+
) -> None:
|
44
|
+
"""Initialize the deprecated SetToMajorityValue.
|
45
|
+
|
46
|
+
Parameters
|
47
|
+
----------
|
48
|
+
block_name : str
|
49
|
+
Name of the block.
|
50
|
+
col_name : str
|
51
|
+
Name of the column to set to majority value.
|
52
|
+
"""
|
53
|
+
# Issue deprecation warning
|
54
|
+
warnings.warn(
|
55
|
+
"SetToMajorityValue is deprecated and will be removed in a future version. "
|
56
|
+
"Please use UniformColumnValueSetter with reduction_strategy='mode' instead.",
|
57
|
+
DeprecationWarning,
|
58
|
+
stacklevel=2,
|
59
|
+
)
|
60
|
+
|
61
|
+
# Map old signature to new signature
|
62
|
+
super().__init__(
|
63
|
+
block_name=block_name,
|
64
|
+
input_cols=[col_name],
|
65
|
+
output_cols=[],
|
66
|
+
)
|
67
|
+
|
68
|
+
# Create the new block instance with mapped parameters
|
69
|
+
self._new_block = UniformColumnValueSetter(
|
70
|
+
block_name=block_name,
|
71
|
+
input_cols=[col_name],
|
72
|
+
reduction_strategy="mode",
|
73
|
+
)
|
74
|
+
|
75
|
+
def generate(self, samples: Dataset, **kwargs: Any) -> Dataset:
|
76
|
+
"""Generate dataset with column set to majority value using UniformColumnValueSetter.
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
samples : Dataset
|
81
|
+
The input dataset to process.
|
82
|
+
|
83
|
+
Returns
|
84
|
+
-------
|
85
|
+
Dataset
|
86
|
+
The dataset with specified column set to its majority value.
|
87
|
+
"""
|
88
|
+
return self._new_block.generate(samples, **kwargs)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
"""Evaluation blocks for SDG Hub."""
|
3
|
+
|
4
|
+
# Local
|
5
|
+
from .evaluate_faithfulness_block import EvaluateFaithfulnessBlock
|
6
|
+
from .evaluate_relevancy_block import EvaluateRelevancyBlock
|
7
|
+
from .verify_question_block import VerifyQuestionBlock
|
8
|
+
|
9
|
+
__all__ = ["EvaluateFaithfulnessBlock", "EvaluateRelevancyBlock", "VerifyQuestionBlock"]
|