Synthesize Insights with Multi-LLM Collaboration
A LlamaIndex pack implementing Mixture-of-Agents layered architecture where multiple LLMs collaborate-proposers generate diverse responses, aggregators
Why it matters
Leverage a layered architecture of multiple LLMs to refine and enhance responses, maximizing collective expertise for superior outcomes.
Outcomes
What it gets done
Generate diverse contexts and perspectives using multiple LLM 'proposers'.
Synthesize proposals into a single, high-quality output using 'aggregator' LLMs.
Iteratively refine responses through multiple layers of LLM collaboration.
Integrate with OpenAI and MistralAI models for enhanced LLM capabilities.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-pack-packs-mixture-of-agents | bash Steps
Steps in the chain
pip install llama-index-packs-mixture-of-agents
from llama_index.core.llama_pack import download_llama_pack ### download and install dependencies MixtureOfAgentsPack = download_llama_pack( "MixtureOfAgentsPack", "./mixture_of_agents_pack" )
import nest_asyncio nest_asyncio.apply() from llama_index.llms.openai import OpenAI from llama_index.llms.mistralai import MistralAI mixture_of_agents_pack = MixtureOfAgentsPack( llm=OpenAI(model="gpt-4"), # Aggregator reference_llms=[ OpenAI(model="gpt-3.5-turbo"), MistralAI(model="mistral-medium"), ], # Proposers num_layers=3, temperature=0.1, timeout=200, )
response = mixture_of_agents_pack.run("What is LlamaIndex?")
Overview
Mixture-Of-Agents Pack
What it does
Implementation of the Mixture-of-Agents research paper as a LlamaPack, featuring a layered architecture where multiple LLMs collaborate to refine responses iteratively.
How it connects
Use when you want to combine multiple LLMs in a structured workflow where proposers generate diverse perspectives and aggregators synthesize them into enhanced outputs.
Source README
Description pending for li-pack-packs-mixture-of-agents.
Step 1: Install the LlamaPack
pip install llama-index-packs-mixture-of-agents
Step 2: Download LlamaPack
from llama_index.core.llama_pack import download_llama_pack
### download and install dependencies
MixtureOfAgentsPack = download_llama_pack(
"MixtureOfAgentsPack", "./mixture_of_agents_pack"
)Step 3: Initialize the MixtureOfAgentsPack
import nest_asyncio
nest_asyncio.apply()
from llama_index.llms.openai import OpenAI
from llama_index.llms.mistralai import MistralAI
mixture_of_agents_pack = MixtureOfAgentsPack(
llm=OpenAI(model="gpt-4"), # Aggregator
reference_llms=[
OpenAI(model="gpt-3.5-turbo"),
MistralAI(model="mistral-medium"),
], # Proposers
num_layers=3,
temperature=0.1,
timeout=200,
)Step 4: Run the pack with a query
response = mixture_of_agents_pack.run("What is LlamaIndex?")Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.