agentscope.strategy.mixture_of_agent module

Utils for mixing model’s answers in agentscope

class agentscope.strategy.mixture_of_agent.MixtureOfAgents(main_model: str | ModelWrapperBase, reference_models: List[str | ModelWrapperBase], rounds: int = 1, aggregator_prompt: str = 'You have been provided with a set of responses from various open-source models to the latest user query. Your task is to synthesize these responses into a single, high-quality response. It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect. Your response should not simply replicate the given answers but should offer a refined, accurate, and comprehensive reply to the instruction. Ensure your response is well-structured, coherent, and adheres to the highest standards of accuracy and reliability.\n\nResponses from models:', show_internal: bool = False)[源代码]

基类:object

The MoA model that take multiple models and aggregate their responses, leverages the collective strengths of multiple LLMs to enhance performance. Reference from the project [MoA](https://github.com/togethercomputer/MoA).

__init__(main_model: str | ModelWrapperBase, reference_models: List[str | ModelWrapperBase], rounds: int = 1, aggregator_prompt: str = 'You have been provided with a set of responses from various open-source models to the latest user query. Your task is to synthesize these responses into a single, high-quality response. It is crucial to critically evaluate the information provided in these responses, recognizing that some of it may be biased or incorrect. Your response should not simply replicate the given answers but should offer a refined, accurate, and comprehensive reply to the instruction. Ensure your response is well-structured, coherent, and adheres to the highest standards of accuracy and reliability.\n\nResponses from models:', show_internal: bool = False) None[源代码]
参数:
  • main_model (Union[str, ModelWrapperBase]) – The main_model will make the final aggregation in the last round, summarizing all the previous responses from models. Can take both config name of model or model instance as input.

  • reference_models (List[Union[str, ModelWrapperBase]]) – The reference_models used for generating different responses in each round. Can take both config name of model or model instance as input. We encourage using different models to get better diversity. Empirically, responses generated by heterogeneous models contribute more than those produced by the same model.

  • rounds (int) – The number of processing rounds to refine the responses. Can range from 0 to inf.

  • aggregator_prompt (str) – The prompt used for aggregating responses. Using the prompt from paper MoA by default.

  • show_internal (bool) – Whether to show the internal process of MoA.