GithubHelp home page GithubHelp logo

open-swarm-net / gpt-swarm Goto Github PK

View Code? Open in Web Editor NEW
223.0 9.0 37.0 9.37 MB

GPT-Swarm is an open-source project that harnesses the power of swarm intelligence to enhance the capabilities of state-of-the-art language models. By leveraging collective problem-solving and distributed decision-making, GPT-Swarm creates a robust, adaptive, and scalable framework for tackling complex tasks across various domains.

License: Apache License 2.0

Python 44.39% Jupyter Notebook 54.83% Dockerfile 0.64% Batchfile 0.06% Shell 0.08%

gpt-swarm's Introduction

GPT-Swarm

License Python Version Discord Follow

Project logo

Videos submission for the lablab hackathon
Simple frontend demo

GPT-Swarm is a groundbreaking project that combines swarm intelligence and advanced language models to tackle complex tasks across diverse domains. Our innovative framework is robust, adaptive, and scalable, outperforming single models by leveraging the power of collective problem-solving and distributed decision-making. Not to mention the lightning-fast speed with which it performs the research.

Table of Contents

Why

What Swarm Intelligence Is

GPT-Swarm is inspired by the principles of emergence. In nature, when you allow simple agents to interract with each other, they show fundamentally new capabilities. Typical examples are bees or ant hives, or even countries and cultures.

Unprecedented Scalability and Diversity

You can add any models with any capabilities to the swarm and make them work together with each other.

Adaptive Intelligence without Retraining

By utilizing shared vector-based memory, and giving the swarm the ability to adjust itself and it's behavior, we achieve similar adaptability as in reinforcement learning, but without expensive retraining of base-models.

What it can do

Swarm is the only intelligence system to date that can effectively do complex tasks like performing market research or generating whole software solutions.

References:

Architecture overview

Project diagram

Installation and Usage

  1. First, you need to create a keys.json file in the root folder. GOOGLE_API_KEY and CUSTOM_SEARCH_ENGINE_ID are needed for the models to be able to use google search.

    {
        "OPENAI_API_KEY": "sk-YoUrKey",
        "GOOGLE_API_KEY": "blablablaapiKey", 
        "CUSTOM_SEARCH_ENGINE_ID": "12345678aa25"
    }
  2. Then you can specify the swarm configuration and tasks in
    swarm_config.yaml

  3. After that, to run the swarm simply run

    # On Linux or Mac:
    ./run.sh start
    # On Windows:
    .\run.bat
  4. After some time the swarm will start producing a report and storing it in the run folder. By default it's in:
    ./tmp/swarm/output.txt and ./tmp/swarm/output.json

Advanced usage

  1. If you are brave, you can go though the logs. Be careful, because the swarm produces incredible amount of data very fast. You can find logs in ./tmp/swarm/swarm.json. You can also use ./tests/_explore_logs.ipynb to more easily digest the logs.

  2. The shared memory in the run is persistent. You can ask additional questions to this memory using ./tests/_task_to_vdb.ipynb

Next-ups

  • Make adding new models as easy as possible, including custom deployed ones like llama
  • Multi-key support for higher scalability

๐Ÿšง Docker

Build Multi-Arch image:

docker buildx build --platform linux/amd64,linux/arm64 --tag gpt-swarm/gpt-swarm:0.0.0 .

How to Contribute

  • Follow the SOLID principles and don't break the abstractions
  • Create bite-sized PRs

gpt-swarm's People

Contributors

hajowieland avatar nicelir1996 avatar odiseo0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpt-swarm's Issues

Make adding new agents to the swarm as easy as possible

Currently adding new capabilities includes:

  • adding a new Task type
  • creating by hand the agent code, adding him available task types
  • hardcoding which tasks and agents are supported in the swarm

Desired flow:

  • defining the agents in a yaml, like you would define a container in kubernetes
  • agging the reference and the number of agents to the swarm_config

Docker container

Create a simple Dockerfile for Python to containerize the application.

Show current progress

For users it would be nice to have some feedback about the current progress or an estimate for the swarm execution.

Add the capability for the agents to QA the task solutions

Is your feature request related to a problem? Please describe.
Agents grab tasks from the task queue and then submit the solutions. After that, the task goes into "done" mode. However, sometimes they submit 'I'm an AI language model' solutions =).

Why
I think this feature can significantly improve the quality of the final result and reduce the amount of garbage in the memory.

Describe the solution you'd like
After submission we can give QA_pending status to the task and the managers need to check the quality of the solution and then decide whether to send it to done or reopen the tasks.

Describe alternatives you've considered
Alternatively, we can have a self-check mechanism right before the submission. I wonder how AutoGPT did it

Find a better challenge for the swarm

Requirements for the challenge:

  • both the problem statement and solutions must be plain text
  • take advantage of the swarm: variety of models + parallelism
  • be easily relatable to a target audience
  • sufficiently hard even for gpt-4 or autogpt + allows for the evolution of quality in time
  • evaluation: there should be some sort of evaluation score that returns a number from 0 to 1

Problems with the leetcode challenge:

  • too easy for gpt-3.5 (probably was in the training set?)
  • doesn't need agent variety
  • evaluation sometimes hangs the thread if the code has an infinite loop
  • not easily hypeable

Problems installing Chroma

Sounds like a great project would love for it to work....

Describe the bug
After entering the keys in keys.json
Typed to run - ./run.sh start

python: can't open file '/Users/xxx/Documents/GPT/GPT-Swarm/scripts/check_requirements.py': [Errno 2] No such file or directory
Traceback (most recent call last):
File "/Users/xxx/anaconda3/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/xxx/anaconda3/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/xxx/Documents/GPT/GPT-Swarm/swarmai/main.py", line 7, in
from swarmai.Swarm import Swarm
File "/Users/xxx/Documents/GPT/GPT-Swarm/swarmai/Swarm.py", line 14, in
from swarmai.utils.memory import VectorMemory
File "/Users/xxx/Documents/GPT/GPT-Swarm/swarmai/utils/memory/init.py", line 1, in
from .VectorMemory import VectorMemory
File "/Users/xxx/Documents/GPT/GPT-Swarm/swarmai/utils/memory/VectorMemory.py", line 2, in
from langchain.vectorstores import Chroma
ModuleNotFoundError: No module named 'langchain'
Press any key to continue...

Shared memory vs. local interactions swarm paradigm

On the one hand, all the typical swarm algorithms rely on local interactions, where agents exchange information with the neighbors using the environment (stigmergy). This local interaction are proven to result in emergent behavior. It will also allow agents groups that are far away to research independent parts of the solution space.

On the other hand, it's possible to create a shared memory (current architecture) with which all the agents can interact. But I assume it can result in the system more likely getting stuck in the local minima.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.