sdg-hub 0.1.1__py3-none-any.whl → 0.1.3__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/_version.py +2 -2
- sdg_hub/blocks/__init__.py +6 -0
- sdg_hub/blocks/openaichatblock.py +556 -0
- sdg_hub/configs/annotations/simple_annotations.yaml +1 -1
- sdg_hub/configs/knowledge/evaluate_relevancy.yaml +1 -2
- sdg_hub/flow.py +21 -18
- sdg_hub/flow_runner.py +286 -52
- sdg_hub/flows/generation/knowledge/mmlu_bench.yaml +1 -1
- sdg_hub/flows/generation/knowledge/simple_knowledge.yaml +1 -1
- sdg_hub/flows/generation/knowledge/synth_knowledge.yaml +4 -4
- sdg_hub/flows/generation/knowledge/synth_knowledge1.5.yaml +8 -13
- sdg_hub/prompts.py +31 -0
- sdg_hub/utils/__init__.py +5 -0
- sdg_hub/utils/error_handling.py +94 -0
- sdg_hub/utils/path_resolution.py +62 -0
- {sdg_hub-0.1.1.dist-info → sdg_hub-0.1.3.dist-info}/METADATA +2 -2
- {sdg_hub-0.1.1.dist-info → sdg_hub-0.1.3.dist-info}/RECORD +20 -17
- {sdg_hub-0.1.1.dist-info → sdg_hub-0.1.3.dist-info}/WHEEL +0 -0
- {sdg_hub-0.1.1.dist-info → sdg_hub-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {sdg_hub-0.1.1.dist-info → sdg_hub-0.1.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
"""Custom exception classes for SDG Hub error handling."""
|
2
|
+
|
3
|
+
|
4
|
+
class SDGHubError(Exception):
|
5
|
+
"""Base exception class for all SDG Hub errors."""
|
6
|
+
|
7
|
+
def __init__(self, message: str, details: str = None):
|
8
|
+
"""Initialize SDGHubError.
|
9
|
+
|
10
|
+
Parameters
|
11
|
+
----------
|
12
|
+
message : str
|
13
|
+
The main error message.
|
14
|
+
details : str, optional
|
15
|
+
Additional details about the error.
|
16
|
+
"""
|
17
|
+
self.message = message
|
18
|
+
self.details = details
|
19
|
+
full_message = message
|
20
|
+
if details:
|
21
|
+
full_message = f"{message}\nDetails: {details}"
|
22
|
+
super().__init__(full_message)
|
23
|
+
|
24
|
+
|
25
|
+
class FlowRunnerError(SDGHubError):
|
26
|
+
"""Base exception class for flow runner errors."""
|
27
|
+
|
28
|
+
pass
|
29
|
+
|
30
|
+
|
31
|
+
class DatasetLoadError(FlowRunnerError):
|
32
|
+
"""Raised when dataset loading fails."""
|
33
|
+
|
34
|
+
pass
|
35
|
+
|
36
|
+
|
37
|
+
class FlowConfigurationError(FlowRunnerError):
|
38
|
+
"""Raised when flow configuration is invalid."""
|
39
|
+
|
40
|
+
pass
|
41
|
+
|
42
|
+
|
43
|
+
class APIConnectionError(FlowRunnerError):
|
44
|
+
"""Raised when API connection fails."""
|
45
|
+
|
46
|
+
pass
|
47
|
+
|
48
|
+
|
49
|
+
class DataGenerationError(FlowRunnerError):
|
50
|
+
"""Raised when data generation fails."""
|
51
|
+
|
52
|
+
pass
|
53
|
+
|
54
|
+
|
55
|
+
class DataSaveError(FlowRunnerError):
|
56
|
+
"""Raised when saving generated data fails."""
|
57
|
+
|
58
|
+
pass
|
59
|
+
|
60
|
+
|
61
|
+
class BlockError(SDGHubError):
|
62
|
+
"""Base exception class for block-related errors."""
|
63
|
+
|
64
|
+
pass
|
65
|
+
|
66
|
+
|
67
|
+
class BlockConfigurationError(BlockError):
|
68
|
+
"""Raised when block configuration is invalid."""
|
69
|
+
|
70
|
+
pass
|
71
|
+
|
72
|
+
|
73
|
+
class BlockExecutionError(BlockError):
|
74
|
+
"""Raised when block execution fails."""
|
75
|
+
|
76
|
+
pass
|
77
|
+
|
78
|
+
|
79
|
+
class FlowError(SDGHubError):
|
80
|
+
"""Base exception class for flow-related errors."""
|
81
|
+
|
82
|
+
pass
|
83
|
+
|
84
|
+
|
85
|
+
class FlowValidationError(FlowError):
|
86
|
+
"""Raised when flow validation fails."""
|
87
|
+
|
88
|
+
pass
|
89
|
+
|
90
|
+
|
91
|
+
class FlowExecutionError(FlowError):
|
92
|
+
"""Raised when flow execution fails."""
|
93
|
+
|
94
|
+
pass
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""
|
2
|
+
Path resolution utilities for SDG Hub.
|
3
|
+
|
4
|
+
This module provides utilities for resolving file paths relative to one or more
|
5
|
+
base directories, with support for both single directory and multiple directory
|
6
|
+
search paths.
|
7
|
+
"""
|
8
|
+
|
9
|
+
# Standard
|
10
|
+
from typing import List, Union
|
11
|
+
import os
|
12
|
+
|
13
|
+
|
14
|
+
def resolve_path(filename: str, search_dirs: Union[str, List[str]]) -> str:
|
15
|
+
"""Resolve a file path relative to one or more search directories.
|
16
|
+
|
17
|
+
Files are checked in the following order:
|
18
|
+
1. Absolute path is always used as-is
|
19
|
+
2. Checked relative to each directory in search_dirs (in order)
|
20
|
+
3. If not found, returns the original filename (assumes relative to current directory)
|
21
|
+
|
22
|
+
Parameters
|
23
|
+
----------
|
24
|
+
filename : str
|
25
|
+
The path to the file to resolve.
|
26
|
+
search_dirs : Union[str, List[str]]
|
27
|
+
Directory or list of directories in which to search for the file.
|
28
|
+
|
29
|
+
Returns
|
30
|
+
-------
|
31
|
+
str
|
32
|
+
Resolved file path.
|
33
|
+
|
34
|
+
Examples
|
35
|
+
--------
|
36
|
+
>>> resolve_path("config.yaml", "/path/to/base")
|
37
|
+
'/path/to/base/config.yaml' # if file exists
|
38
|
+
|
39
|
+
>>> resolve_path("config.yaml", ["/path1", "/path2"])
|
40
|
+
'/path1/config.yaml' # if file exists in path1
|
41
|
+
'/path2/config.yaml' # if file exists in path2 but not path1
|
42
|
+
|
43
|
+
>>> resolve_path("/absolute/path/file.yaml", ["/path1", "/path2"])
|
44
|
+
'/absolute/path/file.yaml' # absolute path always used as-is
|
45
|
+
"""
|
46
|
+
# Handle absolute paths - always use as-is
|
47
|
+
if os.path.isabs(filename):
|
48
|
+
return filename
|
49
|
+
|
50
|
+
# Convert single directory to list for uniform handling
|
51
|
+
if isinstance(search_dirs, str):
|
52
|
+
search_dirs = [search_dirs]
|
53
|
+
|
54
|
+
# Check each directory in order
|
55
|
+
for directory in search_dirs:
|
56
|
+
full_file_path = os.path.join(directory, filename)
|
57
|
+
if os.path.isfile(full_file_path):
|
58
|
+
return full_file_path
|
59
|
+
|
60
|
+
# If not found in any search directory, return the original filename
|
61
|
+
# This assumes the path is relative to the current directory
|
62
|
+
return filename
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: sdg_hub
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: Synthetic Data Generation
|
5
5
|
Author-email: Red Hat AI Innovation <abhandwa@redhat.com>
|
6
6
|
License: Apache-2.0
|
@@ -36,7 +36,7 @@ Requires-Dist: flask>=3.0.2; extra == "web-interface"
|
|
36
36
|
Requires-Dist: pyyaml>=6.0.1; extra == "web-interface"
|
37
37
|
Requires-Dist: flask-wtf>=1.2.2; extra == "web-interface"
|
38
38
|
Provides-Extra: vllm
|
39
|
-
Requires-Dist: vllm
|
39
|
+
Requires-Dist: vllm>=0.9.1; extra == "vllm"
|
40
40
|
Requires-Dist: torch>=2.0.0; extra == "vllm"
|
41
41
|
Requires-Dist: transformers>=4.37.0; extra == "vllm"
|
42
42
|
Requires-Dist: accelerate>=0.21.0; extra == "vllm"
|
@@ -1,17 +1,18 @@
|
|
1
1
|
sdg_hub/__init__.py,sha256=5Wa6onDndPvG4iwnjq2jK747t3-7XKdQn2WfHfq1sFc,67
|
2
|
-
sdg_hub/_version.py,sha256=
|
2
|
+
sdg_hub/_version.py,sha256=NIzzV8ZM0W-CSLuEs1weG4zPrn_-8yr1AwwI1iuS6yo,511
|
3
3
|
sdg_hub/checkpointer.py,sha256=R0pNKL_q7-BerxmIarY0w1nFYaq7fGnoRRkCVL6Z-Gw,5053
|
4
|
-
sdg_hub/flow.py,sha256=
|
5
|
-
sdg_hub/flow_runner.py,sha256=
|
4
|
+
sdg_hub/flow.py,sha256=14WDZfb-VDUBwXsVo9u5oMuWD6aOm-GWtIdT64z4j-0,18050
|
5
|
+
sdg_hub/flow_runner.py,sha256=rSoXoN2n2vsMmOnsRImeQivsY9zlrDig53O9DBbQzz0,15177
|
6
6
|
sdg_hub/logger_config.py,sha256=7uHEJVRfym1c4n95DOKHelLXqAus8uHsZYmzLsEjqpo,422
|
7
7
|
sdg_hub/pipeline.py,sha256=mahktfoCMVnuBnvLNjAVOAoFKNQo-wb0Dz1_xdYhKDM,3852
|
8
|
-
sdg_hub/prompts.py,sha256=
|
8
|
+
sdg_hub/prompts.py,sha256=Gto1KcIhO-50ERvZx1Qzu-eAhSlIkOjYH9F6j2eIPfY,17482
|
9
9
|
sdg_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
sdg_hub/registry.py,sha256=Sc_HNxo4n0pgWMiEDd_sLjxaSXAMZFiHJIhQKqjywwk,3772
|
11
11
|
sdg_hub/sdg.py,sha256=8SKrSnqyvJAwE2Muf9lXw9ONRcDzqmCtaEzFHCYW4CY,6914
|
12
|
-
sdg_hub/blocks/__init__.py,sha256=
|
12
|
+
sdg_hub/blocks/__init__.py,sha256=I-kMjIM7E1NrPLyBuUi0yNoXnuw_kTK3A7ybyt3pOxU,936
|
13
13
|
sdg_hub/blocks/block.py,sha256=zdeyDyYiY0EdD3xS7kZR2hRZCRkbygQ4WONp_zv3X7w,3051
|
14
14
|
sdg_hub/blocks/llmblock.py,sha256=nWslPFZSCiyL7MXQurOk6Jx29UOsgnVDMI3PTwje7kg,13678
|
15
|
+
sdg_hub/blocks/openaichatblock.py,sha256=BWsWFEozWptwe1MMaz-_ZmgQPsNbCRun6ZlaKD3ICxQ,20016
|
15
16
|
sdg_hub/blocks/utilblocks.py,sha256=U2PQk26cwHOgofk5IenHjrao08gbqPFOBNRy5QJ-EEY,18290
|
16
17
|
sdg_hub/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
18
|
sdg_hub/configs/annotations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -19,14 +20,14 @@ sdg_hub/configs/annotations/cot_reflection.yaml,sha256=60EdsTe1y7GoUIAWYSGfMa3EK
|
|
19
20
|
sdg_hub/configs/annotations/detailed_annotations.yaml,sha256=in21xmlhxDJGEaWh1IgINh33tEyW9AuyG3k4pWBuKSM,1520
|
20
21
|
sdg_hub/configs/annotations/detailed_description.yaml,sha256=FsGbQMBxf1MAOi0nhrQ4icxcwYMlRura_ji9Pmeh1AA,192
|
21
22
|
sdg_hub/configs/annotations/detailed_description_icl.yaml,sha256=NDdwo5EShnYZjm1Fn80sZTAwfnwpPigixP2hvJ8--cU,679
|
22
|
-
sdg_hub/configs/annotations/simple_annotations.yaml,sha256=
|
23
|
+
sdg_hub/configs/annotations/simple_annotations.yaml,sha256=d80d0mK7Xz0MMCCSW3sYw3ztt5HASV5miu0krSAbjnA,234
|
23
24
|
sdg_hub/configs/knowledge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
25
|
sdg_hub/configs/knowledge/atomic_facts.yaml,sha256=bIfQr0q0FyReO94v_lpLO56FikARCvFmZza-ISZTOnA,2453
|
25
26
|
sdg_hub/configs/knowledge/auxilary_instructions.yaml,sha256=aCgIjvNacdC2ZHThEvhZKvwORK6KqErVvVYQYQrIDLE,2034
|
26
27
|
sdg_hub/configs/knowledge/detailed_summary.yaml,sha256=_Mc_i9vaLp1OPKexSOURV5gbXEG41p1eELUukOhz8oM,388
|
27
28
|
sdg_hub/configs/knowledge/evaluate_faithfulness.yaml,sha256=iuvx5vNNm_jzHlmcKF83StaDYezRz2vQn3JUHM-TMdQ,3054
|
28
29
|
sdg_hub/configs/knowledge/evaluate_question.yaml,sha256=02mikEAJCUEkREBo7KxPY9H6iTUHQN-4cRkn2XMlVQ8,1915
|
29
|
-
sdg_hub/configs/knowledge/evaluate_relevancy.yaml,sha256=
|
30
|
+
sdg_hub/configs/knowledge/evaluate_relevancy.yaml,sha256=yPyW2BeLV07cvDU8NO6f-Wc32P9iycnpXyLvvTnUy44,3651
|
30
31
|
sdg_hub/configs/knowledge/extractive_summary.yaml,sha256=TYgJ7WQc7NFkf3GeRsbx6lwfA_xFnEOYGELewSqorp0,399
|
31
32
|
sdg_hub/configs/knowledge/generate_code_questions_responses.yaml,sha256=cIus2JYMYDvxHFVSU9QVa-1IK5KoChb3rCU2b4b9UmI,908
|
32
33
|
sdg_hub/configs/knowledge/generate_questions.yaml,sha256=iJtttZrVvlXFraUSrMowqTCLoJOLDbBndcTNMPTO8A4,2788
|
@@ -66,21 +67,23 @@ sdg_hub/configs/skills/icl_examples/math.yaml,sha256=hNq-QudlXrg9CWLpJdrZ4v3vifG
|
|
66
67
|
sdg_hub/configs/skills/icl_examples/reasoning.yaml,sha256=eesIlH9SO07TVF20gy18MZrcDzLhSmynd_F_lvg0oQg,4335
|
67
68
|
sdg_hub/configs/skills/icl_examples/roleplay.yaml,sha256=LYEyA7wv7QWQscUNQr0K_lotNoWSfuoAEncx3PCRYIs,6997
|
68
69
|
sdg_hub/configs/skills/icl_examples/writing.yaml,sha256=El-57IjZ5IvdcmCHyHvX_M2RFFkEos572220be8ecrQ,11335
|
69
|
-
sdg_hub/flows/generation/knowledge/mmlu_bench.yaml,sha256=
|
70
|
-
sdg_hub/flows/generation/knowledge/simple_knowledge.yaml,sha256=
|
71
|
-
sdg_hub/flows/generation/knowledge/synth_knowledge.yaml,sha256=
|
72
|
-
sdg_hub/flows/generation/knowledge/synth_knowledge1.5.yaml,sha256=
|
70
|
+
sdg_hub/flows/generation/knowledge/mmlu_bench.yaml,sha256=U0S2NPkZ_9_8yQGgHJm4el-wVsg_6MllzbFT97cGNrI,343
|
71
|
+
sdg_hub/flows/generation/knowledge/simple_knowledge.yaml,sha256=_DkBZjS47bH0Lmu0eXVRlesTxeAF8Zlzj1PgR1vruuA,295
|
72
|
+
sdg_hub/flows/generation/knowledge/synth_knowledge.yaml,sha256=sYBzIFNBGks_o2Nwvov5MSrMadAB3g-niBAaWPbBYO0,2160
|
73
|
+
sdg_hub/flows/generation/knowledge/synth_knowledge1.5.yaml,sha256=Ao91pCtPmyJts0_aLDkl7n3q14ndvzN_nNIm5Q0RnMI,3610
|
73
74
|
sdg_hub/flows/generation/skills/improve_responses.yaml,sha256=wUV0awTmKHNZ62pHiw_yz-IdG0OYgT_dCwlMUlZS3TA,2683
|
74
75
|
sdg_hub/flows/generation/skills/simple_freeform_skill.yaml,sha256=iVEomFH1E52JA7KLmTIwkS1PnzxUJVPMgbK2O-m80As,309
|
75
76
|
sdg_hub/flows/generation/skills/simple_grounded_skill.yaml,sha256=LTLxqdgbLIKSJonuIRHhcRSpit1EawwNvytWzXWXe2E,309
|
76
77
|
sdg_hub/flows/generation/skills/synth_grounded_skills.yaml,sha256=91Dm--agpmbm02hIVnFhEndjppKsQEWXDbckR9GAzKM,2045
|
77
78
|
sdg_hub/flows/generation/skills/synth_skills.yaml,sha256=9lhQcxXXbN4V9ztPph4fyjUtctll2FYtKY-V4grQdy4,1492
|
78
|
-
sdg_hub/utils/__init__.py,sha256=
|
79
|
+
sdg_hub/utils/__init__.py,sha256=Jfs1DAVSYDNn8dfs0Uq2MguSwu77NyhP-KufSJICiBQ,278
|
79
80
|
sdg_hub/utils/config_validation.py,sha256=g92GxN73Mjr0cXvc5amB_Fn4iV9-iKeWmPz9HwLPmNY,3426
|
80
81
|
sdg_hub/utils/datautils.py,sha256=0t_SZ_UXBKl8uL6rVp3SUh8YKRbzKlh2oO5gr2cKyEw,389
|
82
|
+
sdg_hub/utils/error_handling.py,sha256=UvPEmtdpbBL71Zx8DWpIqd8869kEY2dlCH11iDgMfec,1847
|
83
|
+
sdg_hub/utils/path_resolution.py,sha256=M7hnwoyRQTKgwGC3Ld1_KmKaO_8Lu0PCk6JtQrLp67Q,2006
|
81
84
|
sdg_hub/utils/validation_result.py,sha256=O3zF6r49LQ9StAf_oWmK2bg-JfTQw6rpbHtHr9lI4ks,264
|
82
|
-
sdg_hub-0.1.
|
83
|
-
sdg_hub-0.1.
|
84
|
-
sdg_hub-0.1.
|
85
|
-
sdg_hub-0.1.
|
86
|
-
sdg_hub-0.1.
|
85
|
+
sdg_hub-0.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
86
|
+
sdg_hub-0.1.3.dist-info/METADATA,sha256=v8k82qCPIhwhS_rBAe8S3SXTl_xu7UBAoi6NB3vzT3s,7240
|
87
|
+
sdg_hub-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
88
|
+
sdg_hub-0.1.3.dist-info/top_level.txt,sha256=TqI7d-HE1n6zkXFkU0nF3A1Ct0P0pBaqI675uFokhx4,8
|
89
|
+
sdg_hub-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|