sygra 1.0.0__tar.gz

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.
Files changed (119) hide show
  1. sygra-1.0.0/LICENSE +201 -0
  2. sygra-1.0.0/PKG-INFO +218 -0
  3. sygra-1.0.0/README.md +164 -0
  4. sygra-1.0.0/pyproject.toml +184 -0
  5. sygra-1.0.0/setup.cfg +4 -0
  6. sygra-1.0.0/sygra/__init__.py +426 -0
  7. sygra-1.0.0/sygra/config/configuration.yaml +32 -0
  8. sygra-1.0.0/sygra/config/models.yaml +80 -0
  9. sygra-1.0.0/sygra/config/payload_cfg.json +41 -0
  10. sygra-1.0.0/sygra/configuration/__init__.py +10 -0
  11. sygra-1.0.0/sygra/configuration/loader.py +65 -0
  12. sygra-1.0.0/sygra/core/base_task_executor.py +667 -0
  13. sygra-1.0.0/sygra/core/dataset/data_handler_base.py +65 -0
  14. sygra-1.0.0/sygra/core/dataset/dataset_config.py +220 -0
  15. sygra-1.0.0/sygra/core/dataset/dataset_processor.py +464 -0
  16. sygra-1.0.0/sygra/core/dataset/file_handler.py +169 -0
  17. sygra-1.0.0/sygra/core/dataset/huggingface_handler.py +397 -0
  18. sygra-1.0.0/sygra/core/graph/backend_factory.py +115 -0
  19. sygra-1.0.0/sygra/core/graph/edges/edge_factory.py +343 -0
  20. sygra-1.0.0/sygra/core/graph/functions/edge_condition.py +23 -0
  21. sygra-1.0.0/sygra/core/graph/functions/lambda_function.py +23 -0
  22. sygra-1.0.0/sygra/core/graph/functions/node_processor.py +63 -0
  23. sygra-1.0.0/sygra/core/graph/graph_config.py +460 -0
  24. sygra-1.0.0/sygra/core/graph/langgraph/graph_builder.py +187 -0
  25. sygra-1.0.0/sygra/core/graph/langgraph/langgraph_factory.py +160 -0
  26. sygra-1.0.0/sygra/core/graph/langgraph/langgraph_state.py +20 -0
  27. sygra-1.0.0/sygra/core/graph/nodes/agent_node.py +165 -0
  28. sygra-1.0.0/sygra/core/graph/nodes/base_node.py +182 -0
  29. sygra-1.0.0/sygra/core/graph/nodes/connector_node.py +37 -0
  30. sygra-1.0.0/sygra/core/graph/nodes/lambda_node.py +43 -0
  31. sygra-1.0.0/sygra/core/graph/nodes/llm_node.py +266 -0
  32. sygra-1.0.0/sygra/core/graph/nodes/multi_llm_node.py +66 -0
  33. sygra-1.0.0/sygra/core/graph/nodes/node_utils.py +55 -0
  34. sygra-1.0.0/sygra/core/graph/nodes/special_node.py +41 -0
  35. sygra-1.0.0/sygra/core/graph/nodes/weighted_sampler_node.py +100 -0
  36. sygra-1.0.0/sygra/core/graph/sygra_message.py +11 -0
  37. sygra-1.0.0/sygra/core/graph/sygra_state.py +12 -0
  38. sygra-1.0.0/sygra/core/judge_task_executor.py +15 -0
  39. sygra-1.0.0/sygra/core/models/client/base_client.py +126 -0
  40. sygra-1.0.0/sygra/core/models/client/client_factory.py +350 -0
  41. sygra-1.0.0/sygra/core/models/client/http_client.py +188 -0
  42. sygra-1.0.0/sygra/core/models/client/ollama_client.py +144 -0
  43. sygra-1.0.0/sygra/core/models/client/openai_azure_client.py +162 -0
  44. sygra-1.0.0/sygra/core/models/client/openai_client.py +184 -0
  45. sygra-1.0.0/sygra/core/models/custom_models.py +1338 -0
  46. sygra-1.0.0/sygra/core/models/langgraph/openai_chat_model.py +155 -0
  47. sygra-1.0.0/sygra/core/models/langgraph/sygra_base_chat_model.py +741 -0
  48. sygra-1.0.0/sygra/core/models/langgraph/vllm_chat_model.py +156 -0
  49. sygra-1.0.0/sygra/core/models/model_factory.py +121 -0
  50. sygra-1.0.0/sygra/core/models/model_postprocessor.py +60 -0
  51. sygra-1.0.0/sygra/core/models/structured_output/schemas_factory.py +8 -0
  52. sygra-1.0.0/sygra/core/models/structured_output/structured_output_config.py +212 -0
  53. sygra-1.0.0/sygra/core/resumable_execution.py +570 -0
  54. sygra-1.0.0/sygra/data/__init__.py +283 -0
  55. sygra-1.0.0/sygra/data_mapper/helper.py +117 -0
  56. sygra-1.0.0/sygra/data_mapper/mapper.py +218 -0
  57. sygra-1.0.0/sygra/data_mapper/pipelines.py +58 -0
  58. sygra-1.0.0/sygra/data_mapper/transformations.py +258 -0
  59. sygra-1.0.0/sygra/data_mapper/types.py +21 -0
  60. sygra-1.0.0/sygra/exceptions/__init__.py +61 -0
  61. sygra-1.0.0/sygra/internal/data_quality/llm_based/graph_config.yaml +507 -0
  62. sygra-1.0.0/sygra/internal/data_quality/llm_based/prompt_config.yaml +15 -0
  63. sygra-1.0.0/sygra/internal/data_quality/llm_based/sample.json +46 -0
  64. sygra-1.0.0/sygra/internal/data_quality/llm_based/task_executor.py +178 -0
  65. sygra-1.0.0/sygra/internal/data_quality/metadata_tagging/filter_tags.py +619 -0
  66. sygra-1.0.0/sygra/internal/data_quality/metadata_tagging/graph_config.yaml +136 -0
  67. sygra-1.0.0/sygra/internal/data_quality/metadata_tagging/task_executor.py +142 -0
  68. sygra-1.0.0/sygra/internal/data_quality/metadata_tagging/taxonomy/taxonomy.json +23 -0
  69. sygra-1.0.0/sygra/logger/logger_config.py +222 -0
  70. sygra-1.0.0/sygra/models/__init__.py +74 -0
  71. sygra-1.0.0/sygra/nodes/__init__.py +349 -0
  72. sygra-1.0.0/sygra/processors/data_transform.py +476 -0
  73. sygra-1.0.0/sygra/processors/output_record_generator.py +77 -0
  74. sygra-1.0.0/sygra/recipes/evol_instruct/breadth.py +13 -0
  75. sygra-1.0.0/sygra/recipes/evol_instruct/depth.py +42 -0
  76. sygra-1.0.0/sygra/recipes/evol_instruct/graph_config.yaml +25 -0
  77. sygra-1.0.0/sygra/recipes/evol_instruct/instruct_mgr.py +17 -0
  78. sygra-1.0.0/sygra/recipes/evol_instruct/task_executor.py +19 -0
  79. sygra-1.0.0/sygra/tools/__main__.py +6 -0
  80. sygra-1.0.0/sygra/tools/base_tool.py +52 -0
  81. sygra-1.0.0/sygra/tools/cli.py +36 -0
  82. sygra-1.0.0/sygra/tools/config/config.yaml +16 -0
  83. sygra-1.0.0/sygra/tools/config/config_data_quality.yaml +25 -0
  84. sygra-1.0.0/sygra/tools/config/config_oasst_mapper.yaml +8 -0
  85. sygra-1.0.0/sygra/tools/config/test_config.yaml +10 -0
  86. sygra-1.0.0/sygra/tools/config.py +76 -0
  87. sygra-1.0.0/sygra/tools/executor.py +192 -0
  88. sygra-1.0.0/sygra/tools/registry.py +62 -0
  89. sygra-1.0.0/sygra/tools/toolkits/data_quality/processor.py +254 -0
  90. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/conversation_pretokenization_task.py +120 -0
  91. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/data_characteristics.py +101 -0
  92. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/language_tagging.py +93 -0
  93. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/llm_based_quality.py +111 -0
  94. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/metadata_tagging.py +147 -0
  95. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/ppl_ifd_scorer.py +259 -0
  96. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/reward_score.py +178 -0
  97. sygra-1.0.0/sygra/tools/toolkits/data_quality/tasks/ttr_tagging.py +116 -0
  98. sygra-1.0.0/sygra/tools/toolkits/dummy_processor/processor.py +52 -0
  99. sygra-1.0.0/sygra/tools/toolkits/oasst_mapper/processor.py +50 -0
  100. sygra-1.0.0/sygra/utils/audio_utils.py +220 -0
  101. sygra-1.0.0/sygra/utils/constants.py +94 -0
  102. sygra-1.0.0/sygra/utils/decorators.py +18 -0
  103. sygra-1.0.0/sygra/utils/dotenv.py +80 -0
  104. sygra-1.0.0/sygra/utils/graph_utils.py +44 -0
  105. sygra-1.0.0/sygra/utils/image_utils.py +184 -0
  106. sygra-1.0.0/sygra/utils/tool_utils.py +145 -0
  107. sygra-1.0.0/sygra/utils/utils.py +574 -0
  108. sygra-1.0.0/sygra/validators/custom_schemas.py +135 -0
  109. sygra-1.0.0/sygra/validators/custom_validations.py +51 -0
  110. sygra-1.0.0/sygra/validators/schema_validator_base.py +170 -0
  111. sygra-1.0.0/sygra/validators/schema_validator_custom.py +17 -0
  112. sygra-1.0.0/sygra/validators/type_parser.py +109 -0
  113. sygra-1.0.0/sygra/validators/yaml_loader.py +87 -0
  114. sygra-1.0.0/sygra/workflow/__init__.py +1012 -0
  115. sygra-1.0.0/sygra.egg-info/PKG-INFO +218 -0
  116. sygra-1.0.0/sygra.egg-info/SOURCES.txt +117 -0
  117. sygra-1.0.0/sygra.egg-info/dependency_links.txt +1 -0
  118. sygra-1.0.0/sygra.egg-info/requires.txt +29 -0
  119. sygra-1.0.0/sygra.egg-info/top_level.txt +1 -0
sygra-1.0.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
sygra-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: sygra
3
+ Version: 1.0.0
4
+ Summary: Graph-oriented Synthetic data generation Pipeline library
5
+ Author-email: "Bidyapati Pradhan, Surajit Dasgupta, Amit Kumar Saha, Sriram Puttagunta, Omkar Anustoop, Vipul Mittal, Gopal Sarda, Jishnu S Nair" <sygra_team@servicenow.com>
6
+ Maintainer-email: SyGra Team <sygra_team@servicenow.com>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/ServiceNow/SyGra
9
+ Project-URL: Issues, https://github.com/ServiceNow/SyGra/issues
10
+ Keywords: llm,fine-tuning,data generation,synthetic data,nlp,sft,dpo,data quality,metadata tagging,graph
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Operating System :: OS Independent
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: aiohttp
25
+ Requires-Dist: datasets
26
+ Requires-Dist: httpx
27
+ Requires-Dist: httpx-sse
28
+ Requires-Dist: huggingface-hub
29
+ Requires-Dist: langchain-community
30
+ Requires-Dist: langchain-core
31
+ Requires-Dist: langchain-mistralai
32
+ Requires-Dist: langgraph
33
+ Requires-Dist: mistralai
34
+ Requires-Dist: openai
35
+ Requires-Dist: PyYAML
36
+ Requires-Dist: transformers
37
+ Requires-Dist: grandalf
38
+ Requires-Dist: sentencepiece
39
+ Requires-Dist: protobuf
40
+ Requires-Dist: Jinja2
41
+ Requires-Dist: pathvalidate
42
+ Requires-Dist: ujson
43
+ Requires-Dist: fasttext
44
+ Requires-Dist: lexicalrichness
45
+ Requires-Dist: langchain-openai
46
+ Requires-Dist: ollama
47
+ Requires-Dist: torch
48
+ Requires-Dist: mlxtend
49
+ Requires-Dist: pandarallel
50
+ Requires-Dist: sentence-transformers
51
+ Requires-Dist: soundfile
52
+ Requires-Dist: types-pyyaml
53
+ Dynamic: license-file
54
+
55
+ <div align="center">
56
+ <img width=30% src="https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_logo.png">
57
+
58
+ <h1>SyGra: Graph-oriented Synthetic data generation Pipeline</h1>
59
+
60
+ <a href="https://github.com/ServiceNow/SyGra/actions/workflows/ci.yaml">
61
+ <img alt="CI" src="https://github.com/ServiceNow/SyGra/actions/workflows/ci.yaml/badge.svg"/></a>
62
+ <a href="https://github.com/ServiceNow/SyGra/releases">
63
+ <img alt="Releases" src="https://img.shields.io/github/v/release/ServiceNow/SyGra?logo=bookstack&logoColor=white"/></a>
64
+ <a href="https://servicenow.github.io/SyGra">
65
+ <img alt="Documentation" src="https://img.shields.io/badge/MkDocs-Documentation-green.svg"/></a>
66
+ <a href="http://arxiv.org/abs/2508.15432">
67
+ <img src="https://img.shields.io/badge/arXiv-2508.15432-B31B1B.svg" alt="arXiv"></a>
68
+ <a href="LICENSE">
69
+ <img alt="Licence" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
70
+
71
+ <br>
72
+ <br>
73
+ <br>
74
+ </div>
75
+
76
+
77
+ Framework to easily generate complex synthetic data pipelines by visualizing and configuring the pipeline as a
78
+ computational graph. [LangGraph](https://python.langchain.com/docs/langgraph/) is used as the underlying graph
79
+ configuration/execution library. Refer
80
+ to [LangGraph examples](https://github.com/langchain-ai/langgraph/tree/main/examples) to get a sense of the different
81
+ kinds of computational graph which can be configured.
82
+ <br>
83
+ <br>
84
+
85
+ ## Introduction
86
+
87
+ SyGra Framework is created to generate synthetic data. As it is a complex process to define the flow, this design simplifies the synthetic data generation process. SyGra platform will support the following:
88
+ - Defining the seed data configuration
89
+ - Define a task, which involves graph node configuration, flow between nodes and conditions between the node
90
+ - Define the output location to dump the generated data
91
+
92
+ Seed data can be pulled from either Huggingface or file system. Once the seed data is loaded, SyGra platform allows datagen users to write any data processing using the data transformation module. When the data is ready, users can define the data flow with various types of nodes. A node can also be a subgraph defined in another yaml file.
93
+
94
+ Each node can be defined with preprocessing, post processing, and LLM prompt with model parameters. Prompts can use seed data as python template keys.
95
+ Edges define the flow between nodes, which can be conditional or non-conditional, with support for parallel and one-to-many flows.
96
+
97
+ At the end, generated data is collected in the graph state for a specific record, processed further to generate the final dictionary to be written to the configured data sink.
98
+
99
+ ![SygraFramework](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_architecture.png)
100
+
101
+ ---
102
+
103
+ # Installation
104
+
105
+ Pick how you want to use **SyGra**:
106
+
107
+ <div align="center">
108
+
109
+ <a href="https://servicenow.github.io/SyGra/installation/">
110
+ <img src="https://img.shields.io/badge/Use%20as-Framework-4F46E5?style=for-the-badge" alt="Install as Framework">
111
+ </a>
112
+ &nbsp;&nbsp;
113
+ <a href="https://servicenow.github.io/SyGra/sygra_library/">
114
+ <img src="https://img.shields.io/badge/Use%20as-Library-10B981?style=for-the-badge" alt="Install as Library">
115
+ </a>
116
+
117
+ </div>
118
+
119
+ ### Which one should I choose?
120
+ - **Framework** → Run end-to-end pipelines from YAML graphs + CLI tooling and project scaffolding.
121
+ (Start here: **[`Installation`](https://servicenow.github.io/SyGra/installation/)**)
122
+
123
+ - **Library** → Import SyGra in your own Python app/notebook; call APIs directly.
124
+ (Start here: **[`SyGra Library`](https://servicenow.github.io/SyGra/sygra_library/)**)
125
+
126
+
127
+ <details>
128
+ <summary><strong>TL;DR – Framework Setup</strong></summary>
129
+
130
+ See full steps in <a href="https://servicenow.github.io/SyGra/installation/">Installation</a>.
131
+
132
+ ```bash
133
+ git clone git@github.com:ServiceNow/SyGra.git
134
+
135
+ cd SyGra
136
+
137
+ poetry run python main.py --task examples.glaive_code_assistant --num_records=1
138
+ ```
139
+ </details>
140
+
141
+ <details>
142
+ <summary><strong>TL;DR – Library Setup</strong></summary>
143
+
144
+ See full steps in <a href="https://servicenow.github.io/SyGra/sygra_library/">Sygra Library</a>.
145
+
146
+ ```bash
147
+ pip install sygra
148
+ ```
149
+
150
+ ```python
151
+ import sygra
152
+
153
+ workflow = sygra.Workflow("tasks/examples/glaive_code_assistant")
154
+ workflow.run(num_records=1)
155
+ ```
156
+ </details>
157
+
158
+ ---
159
+
160
+ ## Components
161
+ The SyGra architecture is composed of multiple components. The following diagrams illustrate the four primary components and their associated modules.
162
+
163
+ ### Data Handler
164
+ Data handler is used for reading and writing the data. Currently, it supports file handler with various file types and huggingface handler.
165
+ When reading data from huggingface, it can read the whole dataset and process, or it can stream chunk of data.
166
+
167
+ <kbd> ![DataHandler](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_data_handler.png) </kbd>
168
+
169
+ ### Graph Node Module
170
+ This module is responsible for building various kind of nodes like LLM node, Multi-LLM node, Lambda node, Agent node etc.
171
+ Each node is defined for various task, for example multi-llm node is used to load-balance the data among various inference point running same model.
172
+
173
+ <kbd> ![Nodes](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_nodes.png) </kbd>
174
+
175
+ ### Graph Edge Connection
176
+ Once node are built, we can connect them with simple edge or conditional edge.
177
+ Conditional edge uses python code to decide the path. Conditional edge helps implimenting if-else flow as well as loops in the graph.
178
+
179
+ <kbd> ![Edges](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_edges.png) </kbd>
180
+
181
+ ### Model clients
182
+ SyGra doesn't support inference within the framework, but it supports various clients, which helps connecting with different kind of servers.
183
+ For example, openai client is being supported by Huggingface TGI, vLLM server and Azure services. However, model configuration does not allow to change clients, but it can be configured in models code.
184
+
185
+ <kbd> ![ModelClient](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_model_client.png) </kbd>
186
+
187
+ ## Task Components
188
+
189
+ SyGra supports extendability and ease of implementation—most tasks are defined as graph configuration YAML files. Each task consists of two major components: a graph configuration and Python code to define conditions and processors.
190
+ YAML contains various parts:
191
+
192
+ - **Data configuration** : Configure file or huggingface as source and sink for the task.
193
+ - **Data transformation** : Configuration to transform the data into the format it can be used in the graph.
194
+ - **Node configuration** : Configure nodes and corresponding properties, preprocessor and post processor.
195
+ - **Edge configuration** : Connect the nodes configured above with or without conditions.
196
+ - **Output configuration** : Configuration for data tranformation before writing the data into sink.
197
+
198
+ A node is defined by the node module, supporting types like LLM call, multiple LLM call, lambda node, and sampler node.
199
+
200
+ LLM-based nodes require a model configured in `models.yaml` and runtime parameters. Sampler nodes pick random samples from static YAML lists. For custom node types, you can implement new nodes in the platform.
201
+
202
+ As of now, LLM inference is supported for TGI, vLLM, Azure, Azure OpenAI, Ollama and Triton compatible servers. Model deployment is external and configured in `models.yaml`.
203
+
204
+ <!-- ![SygraComponents](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_usecase2framework.png) -->
205
+
206
+
207
+ ## Contact
208
+
209
+ To contact us, please send us an [email](mailto:sygra_team@servicenow.com)!
210
+
211
+ ## License
212
+
213
+ The package is licensed by ServiceNow, Inc. under the Apache 2.0 license. See [LICENSE](LICENSE) for more details.
214
+
215
+ ---
216
+
217
+ **Questions?**
218
+ Open an [issue](https://github.com/ServiceNow/SyGra/issues) or start a [discussion](https://github.com/ServiceNow/SyGra/discussions)! Contributions are welcome.
sygra-1.0.0/README.md ADDED
@@ -0,0 +1,164 @@
1
+ <div align="center">
2
+ <img width=30% src="https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_logo.png">
3
+
4
+ <h1>SyGra: Graph-oriented Synthetic data generation Pipeline</h1>
5
+
6
+ <a href="https://github.com/ServiceNow/SyGra/actions/workflows/ci.yaml">
7
+ <img alt="CI" src="https://github.com/ServiceNow/SyGra/actions/workflows/ci.yaml/badge.svg"/></a>
8
+ <a href="https://github.com/ServiceNow/SyGra/releases">
9
+ <img alt="Releases" src="https://img.shields.io/github/v/release/ServiceNow/SyGra?logo=bookstack&logoColor=white"/></a>
10
+ <a href="https://servicenow.github.io/SyGra">
11
+ <img alt="Documentation" src="https://img.shields.io/badge/MkDocs-Documentation-green.svg"/></a>
12
+ <a href="http://arxiv.org/abs/2508.15432">
13
+ <img src="https://img.shields.io/badge/arXiv-2508.15432-B31B1B.svg" alt="arXiv"></a>
14
+ <a href="LICENSE">
15
+ <img alt="Licence" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
16
+
17
+ <br>
18
+ <br>
19
+ <br>
20
+ </div>
21
+
22
+
23
+ Framework to easily generate complex synthetic data pipelines by visualizing and configuring the pipeline as a
24
+ computational graph. [LangGraph](https://python.langchain.com/docs/langgraph/) is used as the underlying graph
25
+ configuration/execution library. Refer
26
+ to [LangGraph examples](https://github.com/langchain-ai/langgraph/tree/main/examples) to get a sense of the different
27
+ kinds of computational graph which can be configured.
28
+ <br>
29
+ <br>
30
+
31
+ ## Introduction
32
+
33
+ SyGra Framework is created to generate synthetic data. As it is a complex process to define the flow, this design simplifies the synthetic data generation process. SyGra platform will support the following:
34
+ - Defining the seed data configuration
35
+ - Define a task, which involves graph node configuration, flow between nodes and conditions between the node
36
+ - Define the output location to dump the generated data
37
+
38
+ Seed data can be pulled from either Huggingface or file system. Once the seed data is loaded, SyGra platform allows datagen users to write any data processing using the data transformation module. When the data is ready, users can define the data flow with various types of nodes. A node can also be a subgraph defined in another yaml file.
39
+
40
+ Each node can be defined with preprocessing, post processing, and LLM prompt with model parameters. Prompts can use seed data as python template keys.
41
+ Edges define the flow between nodes, which can be conditional or non-conditional, with support for parallel and one-to-many flows.
42
+
43
+ At the end, generated data is collected in the graph state for a specific record, processed further to generate the final dictionary to be written to the configured data sink.
44
+
45
+ ![SygraFramework](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_architecture.png)
46
+
47
+ ---
48
+
49
+ # Installation
50
+
51
+ Pick how you want to use **SyGra**:
52
+
53
+ <div align="center">
54
+
55
+ <a href="https://servicenow.github.io/SyGra/installation/">
56
+ <img src="https://img.shields.io/badge/Use%20as-Framework-4F46E5?style=for-the-badge" alt="Install as Framework">
57
+ </a>
58
+ &nbsp;&nbsp;
59
+ <a href="https://servicenow.github.io/SyGra/sygra_library/">
60
+ <img src="https://img.shields.io/badge/Use%20as-Library-10B981?style=for-the-badge" alt="Install as Library">
61
+ </a>
62
+
63
+ </div>
64
+
65
+ ### Which one should I choose?
66
+ - **Framework** → Run end-to-end pipelines from YAML graphs + CLI tooling and project scaffolding.
67
+ (Start here: **[`Installation`](https://servicenow.github.io/SyGra/installation/)**)
68
+
69
+ - **Library** → Import SyGra in your own Python app/notebook; call APIs directly.
70
+ (Start here: **[`SyGra Library`](https://servicenow.github.io/SyGra/sygra_library/)**)
71
+
72
+
73
+ <details>
74
+ <summary><strong>TL;DR – Framework Setup</strong></summary>
75
+
76
+ See full steps in <a href="https://servicenow.github.io/SyGra/installation/">Installation</a>.
77
+
78
+ ```bash
79
+ git clone git@github.com:ServiceNow/SyGra.git
80
+
81
+ cd SyGra
82
+
83
+ poetry run python main.py --task examples.glaive_code_assistant --num_records=1
84
+ ```
85
+ </details>
86
+
87
+ <details>
88
+ <summary><strong>TL;DR – Library Setup</strong></summary>
89
+
90
+ See full steps in <a href="https://servicenow.github.io/SyGra/sygra_library/">Sygra Library</a>.
91
+
92
+ ```bash
93
+ pip install sygra
94
+ ```
95
+
96
+ ```python
97
+ import sygra
98
+
99
+ workflow = sygra.Workflow("tasks/examples/glaive_code_assistant")
100
+ workflow.run(num_records=1)
101
+ ```
102
+ </details>
103
+
104
+ ---
105
+
106
+ ## Components
107
+ The SyGra architecture is composed of multiple components. The following diagrams illustrate the four primary components and their associated modules.
108
+
109
+ ### Data Handler
110
+ Data handler is used for reading and writing the data. Currently, it supports file handler with various file types and huggingface handler.
111
+ When reading data from huggingface, it can read the whole dataset and process, or it can stream chunk of data.
112
+
113
+ <kbd> ![DataHandler](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_data_handler.png) </kbd>
114
+
115
+ ### Graph Node Module
116
+ This module is responsible for building various kind of nodes like LLM node, Multi-LLM node, Lambda node, Agent node etc.
117
+ Each node is defined for various task, for example multi-llm node is used to load-balance the data among various inference point running same model.
118
+
119
+ <kbd> ![Nodes](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_nodes.png) </kbd>
120
+
121
+ ### Graph Edge Connection
122
+ Once node are built, we can connect them with simple edge or conditional edge.
123
+ Conditional edge uses python code to decide the path. Conditional edge helps implimenting if-else flow as well as loops in the graph.
124
+
125
+ <kbd> ![Edges](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_edges.png) </kbd>
126
+
127
+ ### Model clients
128
+ SyGra doesn't support inference within the framework, but it supports various clients, which helps connecting with different kind of servers.
129
+ For example, openai client is being supported by Huggingface TGI, vLLM server and Azure services. However, model configuration does not allow to change clients, but it can be configured in models code.
130
+
131
+ <kbd> ![ModelClient](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/component_model_client.png) </kbd>
132
+
133
+ ## Task Components
134
+
135
+ SyGra supports extendability and ease of implementation—most tasks are defined as graph configuration YAML files. Each task consists of two major components: a graph configuration and Python code to define conditions and processors.
136
+ YAML contains various parts:
137
+
138
+ - **Data configuration** : Configure file or huggingface as source and sink for the task.
139
+ - **Data transformation** : Configuration to transform the data into the format it can be used in the graph.
140
+ - **Node configuration** : Configure nodes and corresponding properties, preprocessor and post processor.
141
+ - **Edge configuration** : Connect the nodes configured above with or without conditions.
142
+ - **Output configuration** : Configuration for data tranformation before writing the data into sink.
143
+
144
+ A node is defined by the node module, supporting types like LLM call, multiple LLM call, lambda node, and sampler node.
145
+
146
+ LLM-based nodes require a model configured in `models.yaml` and runtime parameters. Sampler nodes pick random samples from static YAML lists. For custom node types, you can implement new nodes in the platform.
147
+
148
+ As of now, LLM inference is supported for TGI, vLLM, Azure, Azure OpenAI, Ollama and Triton compatible servers. Model deployment is external and configured in `models.yaml`.
149
+
150
+ <!-- ![SygraComponents](https://raw.githubusercontent.com/ServiceNow/SyGra/refs/heads/main/docs/resources/images/sygra_usecase2framework.png) -->
151
+
152
+
153
+ ## Contact
154
+
155
+ To contact us, please send us an [email](mailto:sygra_team@servicenow.com)!
156
+
157
+ ## License
158
+
159
+ The package is licensed by ServiceNow, Inc. under the Apache 2.0 license. See [LICENSE](LICENSE) for more details.
160
+
161
+ ---
162
+
163
+ **Questions?**
164
+ Open an [issue](https://github.com/ServiceNow/SyGra/issues) or start a [discussion](https://github.com/ServiceNow/SyGra/discussions)! Contributions are welcome.