Query Decomposition
QueryDecomposition Class Documentation
Overview
The QueryDecomposition
class is used to decompose a multi-hop question into multiple single-hop questions using a LLM model. The class uses a default decomposition prompt from the Visconde paper. And default prompt is derived from few-shot prompts from the strategyQA dataset.
Usage
Initialize
To use the QueryDecomposition
class, you first need to create an instance of the class.
You can put additional parameter model_name
and api_base
for using custom model.
Decompose
After the QueryDecomposition
instance has been initialized, you can use the decompose
method to decompose a query into multiple single-hop questions. The decompose
method takes a query (a string) as input and returns a list of decomposed queries.
If the input query is not multi-hop question, so it doesn't need any decomposition, it returns empty list.
Last updated