Prompt Chain

Synthesize Insights with Multi-LLM Collaboration

A LlamaIndex pack implementing Mixture-of-Agents layered architecture where multiple LLMs collaborate-proposers generate diverse responses, aggregators

Works with openaimistralai

57
Spark score
out of 100
Updated 4 days ago
Version 0.14.22
Models

Add to Favorites

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

01

Generate diverse contexts and perspectives using multiple LLM 'proposers'.

02

Synthesize proposals into a single, high-quality output using 'aggregator' LLMs.

03

Iteratively refine responses through multiple layers of LLM collaboration.

04

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

01
Install the LlamaPack

pip install llama-index-packs-mixture-of-agents

02
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" )

03
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, )

04
Run the pack with a query

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.