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:
- Go to the Haystack API documentation and find the component you want to modify.
- On the component page, scroll down to its
run()
method. You can adjust any of the listed parameters.
For example, forCohereRanker
, you can find the parameters here.
- For deepset Components (components whose names start with
Deepset
):- Go to the component documentation.
- Scroll down to the Run Method Parameter section. These are the parameters you can modify at query time.
For example, forDeepsetAnswerBuilder
, 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:
-
In deepset AI Platform, go to Playground.
-
Choose the pipeline you want to test and click the Configurations button in the top right corner.
-
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" }}
: -
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.
Updated 6 days ago