Modify Pipeline Parameters at Query Time

You can override component parameters set in the pipeline configuration for a specific query. This helps you test different settings without changing the pipeline file.

Parameters You Can Modify

At query time, you can modify the run() method parameters of the components in your pipeline. To check the parameters you can change for a specific component:

  • For Haystack components:
    1. Go to the Haystack API documentation and find the component you want to modify.
    2. On the component page, scroll down to its run() method. You can adjust any of the listed parameters.
      For example, for CohereRanker, you can find the parameters here.
  • For deepset Components (components whose names start with Deepset):
    1. Go to the component documentation.
    2. Scroll down to the Run Method Parameter section. These are the parameters you can modify at query time.
      For example, for DeepsetAnswerBuilder, you can find the parameters here.

ℹ️

You can't modify component connections at query time.

Parameter Format

Pass parameters as a JSON dictionary using the following format:

{
   "component1_name":{ // this is the name you gave to your component in your pipeline
      "parameter1_name":"parameter1_value",
      "parameter2_name":"parameter2_value"
   },
   "component2_name":{
      "parameter3_name":"parameter3_value"
   }
}

For example, to change the Retriever's top_k parameter for a specific query, use this code:

{ 
  "retriever":{"top_k":5}
}

⚠️

Important

The component names must match those defined in your pipeline. The parameters you set must be valid run() method parameters for the corresponding components.

Passing Parameters

You can modify parameter values at query time in three ways:

  • Through the Search API endpoint
  • In Playground
  • In a query set for a job

Passing Parameters Through the Search API

When querying your pipeline with the Search API endpoint, include the params field in your request. Inside params, specify the component names and the parameters you want to modify.

This is an example request that changes the embedding_retriever's top_k to 1 for the query "Who was in the first all-girl jazz bands?":

curl --request POST \
     --url https://api.cloud.deepset.ai/api/v1/workspaces/my_workspace/pipelines/my_pipeline/search \
     --header 'accept: application/json' \
     --header 'authorization: Bearer deepset_API_key' \
     --header 'content-type: application/json' \
     --data '
{
  "debug": true,
  "params": {
    "embedding_retriever": { "top_k": 1 }
  },
  "view_prompts": false,
  "queries": [
    "who was in the first all-girl jazz bands?"
  ]
}
'

Passing Parameters in Playground

When testing your pipeline in deepset Playground, you can set runtime parameters in the Configurations window. This is the fastest and easiest way to see how different settings affect pipeline results.

To update parameters in Playground:

  1. In deepset AI Platform, go to Playground.

  2. Choose the pipeline you want to test and click the Configurations button in the top right corner.

  3. In the Configurations window, enter the components and parameters you want to update as a JSON dictionary using this format: { "component_name": { "parameter1_name": "parameter1_value" }}:

  4. Type your query and run the search.

To compare results, run another search without modifying the parameters.

Passing Parameters in a Query Set

When creating a query set for a job, list the components and parameters you want to change in the params column.

For details and examples, see Example query set with parameters.