EvolInstructPipeline
- templates (Type[EvolInstructTemplates]): Template class containing evolution strategy and method definitions. Must provide
EVOL_METHODS
andSTRATEGY
attributes. (default: :obj:EvolInstructTemplates
) - agent (Optional[ChatAgent]): Chat agent instance for LLM interaction.
- If: obj:
None
, initializes with a default ChatAgent. (default: :obj:None
)
init
- templates (Type[EvolInstructTemplates]): Template class containing evolution strategy configurations. (default: :obj:
EvolInstructTemplates
) - agent (Optional[ChatAgent]): Preconfigured chat agent instance. Creates a default ChatAgent if not provided. (default: :obj:
None
)
_resolve_evolution_method
- method_key (str): Input method identifier. Can be: - Direct method key from templates.EVOL_METHODS - Strategy name from templates.STRATEGY keys
_get_evolution_methods
- method (Union[str, List[str]]): Specification for method selection. Can be: - Strategy name for methods from that strategy - Specific method name - List of method specifications
- num_generations (int): Number of methods to return.
_generate_single_evolution
- prompt (str): The seed prompt to evolve.
- method (str): The evolution method key to use.
- return_method (bool): If True, returns method along with prompt.
_generate_multiple_evolutions
- prompt (str): Seed prompt to evolve.
- method (Union[str, List[str]]): Evolution method specification.
- num_generations (int): Candidates to generate per iteration.
- keep_original (bool): Whether to keep the original prompt.
- num_threads (int): Number of threads for parallel processing.
_generate_iterative_evolutions
- prompt (str): Seed prompt to evolve.
- evolution_spec (Union[str, List[Union[str, List[str]]]]): Evolution method specification. If a list is provided and num_iterations is None, then num_iterations is set to the length of the list.
- num_generations (int): Candidates to generate per iteration.
- num_iterations (Optional[int]): Number of evolution iterations. Defaults to the length of evolution_spec.
- keep_original (bool): Include original prompt in results.
- scorer (Optional[BaseScorer]): Scoring model for candidate.
- num_threads (int): Number of threads for parallel processing.
generate
- prompts (List[str]): Seed prompts to evolve.
- evolution_spec (Union[str, List[Union[str, List[str]]]]): Evolution method specification. If a list is provided and num_iterations is None, then num_iterations is set to the length of the list.
- num_generations (int): Candidates to generate per iteration.
- num_iterations (Optional[int]): Number of evolution iterations. Defaults to the length of evolution_spec.
- keep_original (bool): Include original prompts in results.
- scorer (Optional[BaseScorer]): Scoring model for candidate.
- num_chunks (int): Number of parallel processing chunks.
- retry_limit (int): Max retries for failed generations.
- retry_delay (float): Delay between retries in seconds.
- num_threads (int): Number of threads for parallel processing.