Command Line Interface (CLI)¶
This section contains the API reference for the CLI. For more information on how to use the CLI, see Tutorial - CLI.
Utility functions for the distilabel pipeline
sub-commands¶
Here are some utility functions to help working with the pipelines in the console.
utils
¶
parse_runtime_parameters(params)
¶
Parses the runtime parameters from the CLI format to the format expected by the
Pipeline.run
method. The CLI format is a list of tuples, where the first element is
a list of keys and the second element is the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params
|
List[Tuple[List[str], str]]
|
A list of tuples, where the first element is a list of keys and the second element is the value. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Dict[str, Any]]
|
A dictionary with the runtime parameters in the format expected by the |
Dict[str, Dict[str, Any]]
|
|
Source code in src/distilabel/cli/pipeline/utils.py
valid_http_url(url)
¶
Check if the URL is a valid HTTP URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/distilabel/cli/pipeline/utils.py
get_config_from_url(url)
¶
Loads the pipeline configuration from a URL pointing to a JSON or YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL pointing to the pipeline configuration file. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The pipeline configuration as a dictionary. |
Raises:
Type | Description |
---|---|
ValueError
|
If the file format is not supported. |
Source code in src/distilabel/cli/pipeline/utils.py
get_pipeline_from_url(url, pipeline_name='pipeline')
¶
Downloads the file to the current working directory and loads the pipeline object from a python script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL pointing to the python script with the pipeline definition. |
required |
pipeline_name
|
str
|
The name of the pipeline in the script.
I.e: |
'pipeline'
|
Returns:
Type | Description |
---|---|
BasePipeline
|
The pipeline instantiated. |
Raises:
Type | Description |
---|---|
ValueError
|
If the file format is not supported. |
Source code in src/distilabel/cli/pipeline/utils.py
get_pipeline(config_or_script, pipeline_name='pipeline')
¶
Get a pipeline from a configuration file or a remote python script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_or_script
|
str
|
The path or URL to the pipeline configuration file or URL to a python script. |
required |
pipeline_name
|
str
|
The name of the pipeline in the script.
I.e: |
'pipeline'
|
Returns:
Type | Description |
---|---|
BasePipeline
|
The pipeline. |
Raises:
Type | Description |
---|---|
ValueError
|
If the file format is not supported. |
FileNotFoundError
|
If the configuration file does not exist. |
Source code in src/distilabel/cli/pipeline/utils.py
display_pipeline_information(pipeline)
¶
Displays the pipeline information to the console.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline
|
BasePipeline
|
The pipeline. |
required |