Skip to main content

An LLM Multi-Agent framework.

Project description

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 [Insert Paper Title Here]. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multi_agent_llm-0.1.2.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

multi_agent_llm-0.1.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file multi_agent_llm-0.1.2.tar.gz.

File metadata

  • Download URL: multi_agent_llm-0.1.2.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for multi_agent_llm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cfbbf19ad8592ec5ab72f8a7368a802d7c6b746a7f8614bab27af8f15f7cf3bc
MD5 7c69cbe55c2c434a3090c0f56c49d1dd
BLAKE2b-256 107e241b7514192d85a162e3f9906f6e82298d4a37a1e0a02340a8d8c4b5ee5f

See more details on using hashes here.

File details

Details for the file multi_agent_llm-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for multi_agent_llm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fde1ce159eafaaa9040f99ce8f1ceebd2af651112c29fcc1cd977faff83b018a
MD5 958a55cedf5ac770d01f653e1959dc3c
BLAKE2b-256 33978908c3b907b38476f05592863212d9d545d01e98d7ce2671d28f1a8506a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page