name: train_test_split_jsonl_with_sklearn
description: |
  Split JSONL Data into training and validation data using scikit-learn.
  Args:
      training_data_path (str):
          Output path for the training data (JSONL format).
      validation_data_path (str):
          Output path for the validation data (JSONL format).
      input_data_path (str):
          Input data in JSON lines format.
      validation_split (Optional[float]):
          Fraction of data that will make up validation dataset. Default is 0.2 (20% as validation
          data, the rest as training data).
      random_seed (Optional[int]):
        Global random seed to ensure the output is deterministic.
inputs:
- {name: input_data_path, type: String}
- {name: validation_split, type: Float, default: '0.2', optional: true}
- {name: random_seed, type: Integer, default: '0', optional: true}
outputs:
- {name: training_data_path, type: JSONLines}
- {name: validation_data_path, type: JSONLines}

implementation:
  container:
    image: gcr.io/ml-pipeline/google-cloud-pipeline-components:latest
    # command is a list of strings (command-line arguments).
    # The YAML language has two syntaxes for lists and you can use either of them.
    # Here we use the "flow syntax" - comma-separated strings inside square brackets.
    command: [python3, -m, google_cloud_pipeline_components.container.experimental.sklearn.train_test_split_jsonl]
    args:
      - --input-data-path
      - {inputValue: input_data_path}
      - --validataion-split
      - {inputValue: validation_split}
      - --random-seed
      - {inputValue: random_seed}
      - --training-data-path
      - {outputPath: training_data_path}
      - --validation-data-path
      - {outputPath: validation_data_path}
