Configuring Nodes' Parameters

Learn which parameters you can change for which nodes and how to pass them.

Defining Parameters in YAML and in the REST API

Parameters in pipeline YAML are the init parameters you can specify for the nodes, either when creating a pipeline in deepset Cloud or when uploading a ready-made YAML through a REST API endpoint.

Runtime parameters in the REST API are request body parameters you define when making a request with the Search REST API endpoint. You can configure these parameters for all the nodes in the pipeline, or you can target specific nodes. See the reference documentation for a particular node in this section to check the parameters you can modify. If there are no REST API parameters listed for a node, it means you can't define any runtime parameters for it.

Passing YAML Parameters

You customize these parameters in the components section of the YAML, in the params object for a particular node, like this:

components:
  - name: componentName
    type: componentType
    params:
      param1: value1
      param2: value2

The name is a custom name you give to a pipeline node. The type is the class this node belongs to. You can check the class in a particular node's documentation.

Examples

This example shows how to customize the DocumentStore and EmbeddingRetriever in the YAML:

components:
  - name: DocumentStore
    type: DeepsetCloudDocumentStore 
    params:
      embedding_dim: 768
      similarity: cosine
  - name: EmbeddingRetriever 
    type: EmbeddingRetriever 
    params:
      document_store: DocumentStore
      model_format: sentence_transformers
      embedding_model: intfloat/e5-base-v2 
      top_k: 20 
      ...

For more examples, see Pipeline Examples, Pipeline Nodes, and About Pipelines.

Passing Runtime Parameters to the REST API

You can pass runtime parameters to influence the behavior of nodes in a pipeline when it's executed. To do this, pass the name of the node whose parameter you want to change together with the dictionary of the parameters, like this:

payload = {
    "params": {
        "node_name":{
          "param1": value1,
          "param2": value2
        },
    },
}

You can also do this for multiple nodes at once. Simply pass the names of the nodes and the parameters you want to modify:

payload = {
    "params": {
        "node1_name":{
          "param1": value1,
          "param2": value2
        },
        "node2_name":{
          "param": value
        },
        "node3_name":{
          "param3": value3
        },
    },
}

To pass a parameter to all nodes in a pipeline, use the parameter name and value without listing node names:

payload = {
    "params": {
        "param": value,
        "param2": value2
    }
}

The parameters are applied to all nodes that accept them and are ignored for all other nodes.

Examples

Customizing a Single Node

In this example, we're changing the EmbeddingRetriever's top_k parameter that determines the number of documents the retriever fetches from the document store:

payload = {
    "debug": True,
    "params": {
        "EmbeddingRetriever":{
          "top_k": 2
        },
    },
    "queries": ["Where does Horned sungem live?"]
}

Customizing Multiple Nodes

This example passes different parameters to the EmbeddingRetriever, Reranker, and PromptNode nodes:

payload = {
    "debug": True,
    "params": {
        "EmbeddingRetriever":{
          "top_k": 10
        },
        "Reranker":{
          "top_k": 4
        },
        "PromptNode":{
          "max_tokens": 500
        },
    },
    "queries": ["Where does Horned sungem live?"]
}