autorag.nodes.promptmaker package

Submodules

autorag.nodes.promptmaker.base module

class autorag.nodes.promptmaker.base.BasePromptMaker(project_dir: str | Path, *args, **kwargs)[source]

Bases: BaseModule

cast_to_run(previous_result: DataFrame, *args, **kwargs)[source]

This function is for cast function (a.k.a decorator) only for pure function in the whole node.

autorag.nodes.promptmaker.fstring module

class autorag.nodes.promptmaker.fstring.Fstring(project_dir: str | Path, *args, **kwargs)[source]

Bases: BasePromptMaker

pure(previous_result: DataFrame, *args, **kwargs)[source]

autorag.nodes.promptmaker.long_context_reorder module

class autorag.nodes.promptmaker.long_context_reorder.LongContextReorder(project_dir: str | Path, *args, **kwargs)[source]

Bases: BasePromptMaker

pure(previous_result: DataFrame, *args, **kwargs)[source]

autorag.nodes.promptmaker.run module

autorag.nodes.promptmaker.run.evaluate_generator_result(result_df: DataFrame, metric_inputs: List[MetricInput], metrics: List[str] | List[Dict]) DataFrame[source]
autorag.nodes.promptmaker.run.evaluate_one_prompt_maker_node(prompts: List[str], generator_classes: List, generator_params: List[Dict], metric_inputs: List[MetricInput], metrics: List[str] | List[Dict], project_dir, strategy_name: str) DataFrame[source]
autorag.nodes.promptmaker.run.make_generator_callable_params(strategy_dict: Dict)[source]
autorag.nodes.promptmaker.run.run_prompt_maker_node(modules: List, module_params: List[Dict], previous_result: DataFrame, node_line_dir: str, strategies: Dict) DataFrame[source]

Run prompt maker node. With this function, you can select the best prompt maker module. As default, when you can use only one module, the evaluation will be skipped. If you want to select the best prompt among modules, you can use strategies. When you use them, you must pass ‘generator_modules’ and its parameters at strategies. Because it uses generator modules and generator metrics for evaluation this module. It is recommended to use one params and modules for evaluation, but you can use multiple params and modules for evaluation. When you don’t set generator module at strategies, it will use the default generator module. The default generator module is llama_index_llm with openai gpt-3.5-turbo model.

Parameters:
  • modules – Prompt maker module classes to run.

  • module_params – Prompt maker module parameters.

  • previous_result – Previous result dataframe. Could be query expansion’s best result or qa data.

  • node_line_dir – This node line’s directory.

  • strategies – Strategies for prompt maker node.

Returns:

The best result dataframe. It contains previous result columns and prompt maker’s result columns which is ‘prompts’.

autorag.nodes.promptmaker.window_replacement module

class autorag.nodes.promptmaker.window_replacement.WindowReplacement(project_dir: str, *args, **kwargs)[source]

Bases: BasePromptMaker

pure(previous_result: DataFrame, *args, **kwargs)[source]

Module contents