# Pipeline Default Parameters

The pipeline allows you to define **default parameters** that will later be used by the functions executed in each step.\
These defaults can be provided either directly as **keyword arguments** (*kwargs*) or via a **configuration file** in YAML format.\
Defaults are optional and can be set in two ways:

* When creating the pipeline (through the constructor)
* Later, using the `set_defaults()` method

```
pipeline = CIPipe(
    pipeline_input,
    file_system=self._file_system,
    defaults={'factor': 3, 'multiplier': 4}
)

pipeline = CIPipe(
    pipeline_input,
    file_system=self._file_system,
    defaults_path=config_path
)
```

Here, `defaults` is a dictionary with key-value pairs, while `defaults_path` is the path to a **YAML file** that contains default parameter definitions in this format:

```
factor: 5
multiplier: 2
```

The pipeline automatically reads the YAML and converts it to a Python dictionary internally.

***

#### Setting defaults after initialization

You can also define or override default values later using `set_defaults()`:

```
pipeline.set_defaults(factor=3)

pipeline.set_defaults(defaults_path=config_path)
```

Both options can also be combined:

```
pipeline.set_defaults(factor=10, defaults_path=config_path)

pipeline = CIPipe(
    pipeline_input,
    file_system=self._file_system,
    defaults={'factor': 10},
    defaults_path=config_path
)
```

***

#### Combined behavior and precedence

When both types of defaults are provided, the pipeline **merges them**, giving **priority to the manually passed parameters** over the YAML values.

For example, if the YAML file contains:

```
factor: 15
multiplier: 2
offset: 5
```

and you execute:

```
pipeline.set_defaults(factor=10, defaults_path=config_path)
```

the final default values used during pipeline execution will be:

```
{
    "factor": 10,
    "multiplier": 2,
    "offset": 5
}
```

The value of `factor` is overwritten by the manually passed parameter, while the other values are kept from the YAML file.

Perfecto, ya está todo listo para GitBook. Puedes copiar y pegar tal cual en tu página; los títulos y bloques de código están formateados correctamente.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cipipe.gitbook.io/cipipe-docs/creating-a-pipeline/pipeline-default-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
