Flare Query Engine#

Query engines based on the FLARE paper.

Active Retrieval Augmented Generation.

class llama_index.query_engine.flare.base.FLAREInstructQueryEngine(query_engine: BaseQueryEngine, service_context: Optional[ServiceContext] = None, instruct_prompt: Optional[BasePromptTemplate] = None, lookahead_answer_inserter: Optional[BaseLookaheadAnswerInserter] = None, done_output_parser: Optional[IsDoneOutputParser] = None, query_task_output_parser: Optional[QueryTaskOutputParser] = None, max_iterations: int = 10, max_lookahead_query_tasks: int = 1, callback_manager: Optional[CallbackManager] = None, verbose: bool = False)#

FLARE Instruct query engine.

This is the version of FLARE that uses retrieval-encouraging instructions.

NOTE: this is a beta feature. Interfaces might change, and it might not always give correct answers.

Parameters
  • query_engine (BaseQueryEngine) โ€“ query engine to use

  • service_context (Optional[ServiceContext]) โ€“ service context. Defaults to None.

  • instruct_prompt (Optional[PromptTemplate]) โ€“ instruct prompt. Defaults to None.

  • lookahead_answer_inserter (Optional[BaseLookaheadAnswerInserter]) โ€“ lookahead answer inserter. Defaults to None.

  • done_output_parser (Optional[IsDoneOutputParser]) โ€“ done output parser. Defaults to None.

  • query_task_output_parser (Optional[QueryTaskOutputParser]) โ€“ query task output parser. Defaults to None.

  • max_iterations (int) โ€“ max iterations. Defaults to 10.

  • max_lookahead_query_tasks (int) โ€“ max lookahead query tasks. Defaults to 1.

  • callback_manager (Optional[CallbackManager]) โ€“ callback manager. Defaults to None.

  • verbose (bool) โ€“ give verbose outputs. Defaults to False.

as_query_component(partial: Optional[Dict[str, Any]] = None, **kwargs: Any) QueryComponent#

Get query component.

get_prompts() Dict[str, BasePromptTemplate]#

Get a prompt.

update_prompts(prompts_dict: Dict[str, BasePromptTemplate]) None#

Update prompts.

Other prompts will remain in place.