Saltar al contenido principal

LLMQueryDecomposer

QueryTransformation
DashAI.back.models.RAG.transformation.LLMQueryDecomposer

Decomposes a complex question into independently retrievable sub-queries.

The model decides how many sub-queries are needed. max_subqueries caps the result, defaulting to :data:DEFAULT_MAX_SUBQUERIES; set it to None to keep every sub-query the model produced.

Parameters​

prompt : object
The prompt used to instruct the transformation model.
llm_model : object
The language model that transforms the user message.
history_window : integer, default=2
Number of previous conversation messages provided to the prompt as context.
function_call_max_trials : integer, default=3
Maximum number of function-call attempts, including the first. When the model returns an unusable call or unparseable JSON arguments, the call is retried until this limit is reached. Only applies to models with function calling.
reranker
Optional chunk scorer that reorders the merged chunks of every transformed query against the original user message and keeps its top-k. Only retrievers that can score chunks are offered; choose null to disable reranking.
max_subqueries, default=3
Optional upper bound on the number of sub-queries. Defaults to three; set it to null for no limit.

Methods​

close(self) -> 'None'

Defined on LLMQueryTransformation

Release the transformation LLM, when it exposes a close hook.

Returns

None
Nothing.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_metadata(cls) -> 'Dict[str, Any]'

Defined on BaseQueryTransformation

Return the technique metadata declared by the subclass.

Returns

Dict[str, Any]
A copy of the class metadata attribute, or an empty dict when the subclass does not declare one.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

transform(self, message: 'str', history: 'Sequence[Dict[str, str]]') -> 'QueryTransformationResult'

Defined on LLMQueryTransformation

Transform a user message into one or more search queries.

Parameters

message : str
The current user message.
history : Sequence[Dict[str, str]]
Previous conversation entries, oldest first.

Returns

QueryTransformationResult
The cleaned, deduplicated queries plus the optional user-facing narrative the model supplied alongside them.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.