Skip to main content

LLM based Multi-Agent methods

Welcome to the LLM based Multi-Agent repository! This repository provides a lean implementation of cutting-edge techniques and methods for leveraging Large Language Models (LLMs) with multi-agent architectures for various tasks. This includes methods developed by Agnostiq Inc. as well as other state-of-the-art methods. The repository is designed to be modular and easy to use, allowing for quick experimentation and please use it with caution for production purposes.

Installation

pip install -U multi-agent-llm

Quick example

import os; os.environ['OPENAI_API_KEY'] = "your_openai_api_key"

from multi_agent_llm import OpenAILLM, AIOT
from pydantic import BaseModel, Field

llm = OpenAILLM(model_name="gpt-4o-mini") # Currently we only have wrapper for OpenAI, but it can be easily extended to other LLMs

# Define the answer schema
class QueryAnswer(BaseModel):
    explanation: str = Field(description="Explanation of the answer")
    answer: str = Field(description="Final Answer")

# Initialize AIOT with the LLM and run a sample query
aiot = AIOT(llm=llm, iterations=2, answer_schema=QueryAnswer)
result = aiot.run("How many R's are there in the word 'Strawberry'?")

print(result)
Discussion Result
-----------------

How many R's are there in the word 'Strawberry'?

Thought Process:

Iteration 1:
IDA: Let's break down the word 'Strawberry'. First, count the letters in the word and then specifically look for the letter 'R'. Remember to pay attention to uppercase and lowercase letters, but focus primarily on the letter 'R'. How many instances of 'R' do you find?
LLMA:
{
  explanation: The word 'Strawberry' contains a total of three instances of the letter 'R'. This includes two uppercase 'R's and one lowercase 'r'. Therefore, when counting the letter 'R' in both forms, we find that there are 3 occurrences in total.
  answer: 3
}

Final Answer:
{
  explanation: The word 'Strawberry' contains a total of three instances of the letter 'R'. This includes two uppercase 'R's and one lowercase 'r'. Therefore, when counting the letter 'R' in both forms, we find that there are 3 occurrences in total.
  answer: 3
}

Implemented Methods

Method Description
AIoT Autonomous Iteration of Thought (AIoT) dynamically adapts its reasoning paths based on the evolving state of the conversation without generating alternate explorative thoughts that are ultimately discarded. Quick Example
GIoT Guided Iteration of Thought (GIoT) forces the LLM to continue iterating for a predefined number of steps, ensuring a thorough exploration of reasoning paths. Quick Example

This repository also contains the results for the paper Iteration of Thought. You can find the relevant experimental setups, datasets, and results. The folder contains results from various tasks. Feel free to explore these folders to reproduce the experiments or to get a deeper understanding of how the AIOT and GIOT frameworks work in practice.

Metadata

Release files for generalist-multi-agent-llm 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for generalist-multi-agent-llm 0.1.2
File Size Uploaded Provenance
generalist_multi_agent_llm-0.1.2.tar.gz 20.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for generalist-multi-agent-llm 0.1.2
File Interpreter ABI Platform
generalist_multi_agent_llm-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / generalist_multi_agent_llm-0.1.2.tar.gz

Download URL generalist_multi_agent_llm-0.1.2.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7d77c072dabb75cb4c5a72a24748eefde689da17cc33f3856e43309c2ccc78af
BLAKE2b-256 checksum
How to use checksums
44ca032f069b04317443df5c92562688528fa2b6f7b30719884d98ae122b8bf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.13

Release files / generalist_multi_agent_llm-0.1.2-py3-none-any.whl

Download URL generalist_multi_agent_llm-0.1.2-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c943e27eeb8e3d1eada7bc745afa244ab32923040f36e355a94a05eb54f48cf2
BLAKE2b-256 checksum
How to use checksums
af746a1edd2388ddff326ebe217c7eacb612771b61a6a23f1125951edb6f9e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.13

Security for generalist-multi-agent-llm 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page