Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 5fa4446

Browse files
committed
Add versioning to custom SDG flow file format
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
1 parent 0078948 commit 5fa4446

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/sdg/sdg-flow-yaml.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ block_configs = flow.render()
2525
The YAML file format will mirror the API and look like this:
2626

2727
```yaml
28+
version: 1.0
2829
block_configs:
2930
- block_type: LLMBlock
3031
block_config: # LLMBlock constructor kwargs
@@ -44,6 +45,29 @@ block_configs:
4445
drop_columns: ["judgment", "explanation"]
4546
```
4647
48+
## Versioning
49+
50+
A mandatory `version` field in the YAML file expresses major and minor versions (e.g., 1.0, 1.1, 2.0).
51+
52+
Compatibility rules
53+
54+
1. If the major version of the YAML file is higher than the parser can handle, the parser should reject the file.
55+
2. If the minor version of the YAML file is higher than the highest version the parser is aware of, the parser should read the file but ignore any unrecognized content.
56+
3. If the file’s version is lower than the parser’s version, the parser should provide default values for any configuration introduced in later versions.
57+
58+
Example parsing logic:
59+
60+
```python
61+
def parse_custom_flow(content):
62+
version = content['version']
63+
major, minor = map(int, version.split('.'))
64+
65+
if major > PARSER_MAJOR:
66+
raise IncompatibleVersionError("The custom flow file format is from a future major version.")
67+
elif major <= PARSER_MAJOR and minor > PARSER_MINOR:
68+
logger.warning("The custom flow file may have new features that will be ignored.")
69+
```
70+
4771
### Flow Params
4872

4973
The following parameters are supplied to a Flow constructor and used by the render() method:

0 commit comments

Comments
 (0)