LLMQueryExpander
Expands a user message into up to n_queries search queries.
The requested count is an upper-bound expectation: expansion is best-effort, so the model may return fewer distinct queries without the transformation failing.
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.
- n_queries : integer, default=
3 - Number of queries the model must produce.
Methods
close(self) -> 'None'
LLMQueryTransformationRelease the transformation LLM, when it exposes a close hook.
Returns
- None
- Nothing.
get_credential(self, name: str)
ConfigObjectResolve 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]'
BaseQueryTransformationReturn the technique metadata declared by the subclass.
Returns
- Dict[str, Any]
- A copy of the class
metadataattribute, or an empty dict when the subclass does not declare one.
get_schema(cls) -> dict
ConfigObjectGenerates 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'
LLMQueryTransformationTransform 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
ConfigObjectIt 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.