@ -0,0 +1,29 @@
|
||||
OPENAI_API_KEY="sk-"
|
||||
GOOGLE_API_KEY=""
|
||||
ANTHROPIC_API_KEY=""
|
||||
AI21_API_KEY="your_api_key_here"
|
||||
COHERE_API_KEY="your_api_key_here"
|
||||
ALEPHALPHA_API_KEY="your_api_key_here"
|
||||
HUGGINFACEHUB_API_KEY="your_api_key_here"
|
||||
SWARMS_API_KEY=""
|
||||
|
||||
EVAL_PORT=8000
|
||||
MODEL_NAME="gpt-4"
|
||||
|
||||
USE_GPU=True
|
||||
PLAYGROUND_DIR="playground"
|
||||
|
||||
LOG_LEVEL="INFO"
|
||||
BOT_NAME="Orca"
|
||||
HF_API_KEY="your_huggingface_api_key_here"
|
||||
|
||||
USE_TELEMETRY=True
|
||||
AGENTOPS_API_KEY=""
|
||||
FIREWORKS_API_KEY=""
|
||||
OPENAI_API_KEY=your_openai_api_key
|
||||
ANTHROPIC_API_KEY=your_anthropic_api_key
|
||||
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint
|
||||
AZURE_OPENAI_DEPLOYMENT=your_azure_openai_deployment
|
||||
OPENAI_API_VERSION=your_openai_api_version
|
||||
AZURE_OPENAI_API_KEY=your_azure_openai_api_key
|
||||
AZURE_OPENAI_AD_TOKEN=your_azure_openai_ad_token
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
# These are supported funding model platforms
|
||||
github: [kyegomez]
|
||||
# patreon: # Replace with a single Patreon username
|
||||
# open_collective: # Replace with a single Open Collective username
|
||||
# ko_fi: # Replace with a single Ko-fi username
|
||||
# tidelift: # Replace with a single Tidelift platform-name/package-name
|
||||
# community_bridge: # Replace with a single Community Bridge project-name
|
||||
# liberapay: # Replace with a single Liberapay username
|
||||
# issuehunt: # Replace with a single IssueHunt username
|
||||
# otechie: # Replace with a single Otechie username
|
||||
# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name
|
||||
# custom: #Nothing
|
@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG] "
|
||||
labels: bug
|
||||
assignees: kyegomez
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: 'kyegomez'
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
@ -0,0 +1,29 @@
|
||||
Thank you for contributing to Swarms!
|
||||
|
||||
Replace this comment with:
|
||||
- Description: a description of the change,
|
||||
- Issue: the issue # it fixes (if applicable),
|
||||
- Dependencies: any dependencies required for this change,
|
||||
- Tag maintainer: for a quicker response, tag the relevant maintainer (see below),
|
||||
- Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out!
|
||||
|
||||
Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.
|
||||
|
||||
See contribution guidelines for more information on how to write/run tests, lint, etc:
|
||||
https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md
|
||||
|
||||
If you're adding a new integration, please include:
|
||||
1. a test for the integration, preferably unit tests that do not rely on network access,
|
||||
2. an example notebook showing its use.
|
||||
|
||||
|
||||
Maintainer responsibilities:
|
||||
- General / Misc / if you don't know who to tag: kye@apac.ai
|
||||
- DataLoaders / VectorStores / Retrievers: kye@apac.ai
|
||||
- swarms.models: kye@apac.ai
|
||||
- swarms.memory: kye@apac.ai
|
||||
- swarms.structures: kye@apac.ai
|
||||
|
||||
If no one reviews your PR within a few days, feel free to email Kye at kye@apac.ai
|
||||
|
||||
See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/kyegomez/swarms
|
@ -0,0 +1,33 @@
|
||||
---
|
||||
name: "Init Environment"
|
||||
description: "Initialize environment for tests"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout actions
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install and configure Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
installer-parallel: true
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{hashFiles('**/poetry.lock') }}
|
||||
- name: Install dependencies
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
run: poetry install --no-interaction --no-root --with test --with dev --all-extras
|
||||
shell: bash
|
||||
- name: Activate venv
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
echo PATH=$PATH >> $GITHUB_ENV
|
||||
shell: bash
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
@ -0,0 +1,34 @@
|
||||
---
|
||||
documentation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: ["docs/**", "*.md"]
|
||||
tests:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "tests/**"
|
||||
agents:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/agents/**"
|
||||
artifacts:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/artifacts/**"
|
||||
memory:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/memory/**"
|
||||
models:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/models/**"
|
||||
prompts:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/prompts/**"
|
||||
structs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/structs/**"
|
||||
telemetry:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/telemetry/**"
|
||||
tools:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/tools/**"
|
||||
utils:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "swarms/utils/**"
|
@ -0,0 +1,47 @@
|
||||
---
|
||||
name: release
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
env:
|
||||
POETRY_VERSION: "1.4.2"
|
||||
jobs:
|
||||
if_release:
|
||||
if: |
|
||||
${{ github.event.pull_request.merged == true }}
|
||||
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install poetry
|
||||
run: pipx install poetry==$POETRY_VERSION
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.9"
|
||||
cache: "poetry"
|
||||
- name: Build project for distribution
|
||||
run: poetry build
|
||||
- name: Check Version
|
||||
id: check-version
|
||||
run: |
|
||||
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "dist/*"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
draft: false
|
||||
generateReleaseNotes: true
|
||||
tag: v${{ steps.check-version.outputs.version }}
|
||||
commit: master
|
||||
- name: Publish to PyPI
|
||||
env:
|
||||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
||||
run: |-
|
||||
poetry publish
|
@ -0,0 +1,25 @@
|
||||
name: autofix.ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: ["main"]
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
autofix:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
- run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest
|
||||
- run: yamlfmt .
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- run: pip install ruff
|
||||
- run: ruff format .
|
||||
- run: ruff check --fix .
|
||||
|
||||
- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
|
@ -0,0 +1,45 @@
|
||||
---
|
||||
name: Codacy
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
pull_request:
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "0 0 * * "
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
codacy-security-scan:
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||
name: Codacy Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to
|
||||
# get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
verbose: true
|
||||
output: results.sarif
|
||||
format: sarif
|
||||
# Adjust severity of non-security issues
|
||||
gh-code-scanning-compat: true
|
||||
# Force 0 exit code to allow SARIF file generation
|
||||
# This will handover control about PR rejection to the GitHub side
|
||||
max-allowed-issues: 2147483647
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF results file
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
@ -0,0 +1,41 @@
|
||||
---
|
||||
name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "33 12 * * 5"
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 360
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ["python"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
@ -0,0 +1,16 @@
|
||||
name: Documentation Links
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
documentation-links:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: readthedocs/actions/preview@v1
|
||||
with:
|
||||
project-slug: "swarms"
|
@ -0,0 +1,24 @@
|
||||
name: Documentation
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- develop
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.11
|
||||
- run: pip install mkdocs-material
|
||||
- run: pip install mkdocs-glightbox
|
||||
- run: pip install "mkdocstrings[python]"
|
||||
- run: pip3 install mkdocs-git-authors-plugin
|
||||
- run: pip install mkdocs-jupyter==0.16.0
|
||||
- run: pip install --upgrade lxml_html_clean
|
||||
- run: pip install mkdocs-git-committers-plugin
|
||||
- run: pip3 install mkdocs-git-revision-date-localized-plugin
|
||||
- run: mkdocs gh-deploy --force -f docs/mkdocs.yml
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
# This workflow will triage pull requests and apply a label based on the
|
||||
# paths that are modified in the pull request.
|
||||
#
|
||||
# To use this workflow, you will need to set up a .github/labeler.yml
|
||||
# file with configuration. For more information, see:
|
||||
# https://github.com/actions/labeler
|
||||
|
||||
name: Labeler
|
||||
on: [pull_request_target]
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
@ -0,0 +1,33 @@
|
||||
---
|
||||
name: Lint
|
||||
on: [push, pull_request] # yamllint disable-line rule:truthy
|
||||
jobs:
|
||||
yaml-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
- run: pip install yamllint
|
||||
- run: yamllint .
|
||||
flake8-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
- run: pip install flake8
|
||||
- run: flake8 .
|
||||
ruff-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
- run: pip install ruff
|
||||
- run: ruff format .
|
||||
- run: ruff check --fix .
|
||||
pylint-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
- run: pip install pylint
|
||||
- run: pylint swarms --recursive=y
|
@ -0,0 +1,49 @@
|
||||
---
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Stale
|
||||
on:
|
||||
schedule:
|
||||
# Scheduled to run at 1.30 UTC everyday
|
||||
- cron: "0 0 * * *"
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-issue-stale: 14
|
||||
days-before-issue-close: 14
|
||||
stale-issue-label: "status:stale"
|
||||
close-issue-reason: not_planned
|
||||
any-of-labels: "status:awaiting user response,status:more data needed"
|
||||
stale-issue-message: >
|
||||
Marking this issue as stale since it has been open for 14 days with no
|
||||
activity. This issue will be closed if no further activity occurs.
|
||||
|
||||
close-issue-message: >
|
||||
This issue was closed because it has been inactive for 28 days. Please
|
||||
post a new issue if you need further assistance. Thanks!
|
||||
|
||||
days-before-pr-stale: 14
|
||||
days-before-pr-close: 14
|
||||
stale-pr-label: "status:stale"
|
||||
stale-pr-message: >
|
||||
Marking this pull request as stale since it has been open for 14 days
|
||||
with no activity. This PR will be closed if no further activity occurs.
|
||||
|
||||
close-pr-message: >
|
||||
This pull request was closed because it has been inactive for 28 days.
|
||||
Please open a new pull request if you need further assistance. Thanks!
|
||||
|
||||
# Label that can be assigned to issues to exclude them from being marked as stale
|
||||
exempt-issue-labels: "override-stale"
|
||||
# Label that can be assigned to PRs to exclude them from being marked as stale
|
||||
exempt-pr-labels: "override-stale"
|
@ -0,0 +1,60 @@
|
||||
name: Tests
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v5
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
- name: Setup a local virtual environment
|
||||
run: |
|
||||
poetry config virtualenvs.create true --local
|
||||
poetry config virtualenvs.in-project true --local
|
||||
- uses: actions/cache@v4
|
||||
name: Define a cache for the virtual environment
|
||||
file
|
||||
with:
|
||||
path: ./.venv
|
||||
key: venv-${{ hashFiles('poetry.lock') }}
|
||||
- name: Install the project dependencies
|
||||
run: poetry install
|
||||
- name: Install OpenCV
|
||||
run: sudo apt-get install python3-opencv
|
||||
- name: Enter the virtual environment
|
||||
run: source $VENV
|
||||
- name: Run the tests
|
||||
run: poetry run pytest --verbose
|
||||
run-examples:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v5
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
- name: Setup a local virtual environment
|
||||
run: |
|
||||
poetry config virtualenvs.create true --local
|
||||
poetry config virtualenvs.in-project true --local
|
||||
- uses: actions/cache@v4
|
||||
name: Define a cache for the virtual environment
|
||||
file
|
||||
with:
|
||||
path: ./.venv
|
||||
key: venv-${{ hashFiles('poetry.lock') }}
|
||||
- name: Install the project dependencies
|
||||
run: poetry install
|
||||
- name: Install OpenCV
|
||||
run: sudo apt-get install python3-opencv
|
||||
- name: Enter the virtual environment
|
||||
run: source $VENV
|
||||
- name: Make Script Executable and Run
|
||||
run: |-
|
||||
chmod +x ./scripts/run_examples.sh
|
||||
./scripts/run_examples.sh
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Welcome
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
jobs:
|
||||
build:
|
||||
name: 👋 Welcome
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1.3.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message:
|
||||
"Hello there, thank you for opening an Issue ! 🙏🏻 The team
|
||||
was notified and they will get back to you asap."
|
||||
pr-message:
|
||||
"Hello there, thank you for opening an PR ! 🙏🏻 The team was
|
||||
notified and they will get back to you asap."
|
@ -0,0 +1,219 @@
|
||||
__pycache__/
|
||||
.venv/
|
||||
|
||||
.env
|
||||
|
||||
image/
|
||||
audio/
|
||||
video/
|
||||
artifacts_three
|
||||
dataframe/
|
||||
|
||||
static/generated
|
||||
runs
|
||||
Financial-Analysis-Agent_state.json
|
||||
artifacts_five
|
||||
errors
|
||||
chroma
|
||||
agent_workspace
|
||||
Accounting Assistant_state.json
|
||||
Unit Testing Agent_state.json
|
||||
Devin_state.json
|
||||
hire_researchers
|
||||
json_logs
|
||||
Medical Image Diagnostic Agent_state.json
|
||||
flight agent_state.json
|
||||
D_state.json
|
||||
artifacts_six
|
||||
artifacts_seven
|
||||
swarms/__pycache__
|
||||
artifacts_once
|
||||
transcript_generator.json
|
||||
venv
|
||||
.DS_Store
|
||||
Cargo.lock
|
||||
.DS_STORE
|
||||
artifacts_logs
|
||||
Cargo.lock
|
||||
Medical Treatment Recommendation Agent_state.json
|
||||
swarms/agents/.DS_Store
|
||||
artifacts_two
|
||||
logs
|
||||
T_state.json
|
||||
_build
|
||||
conversation.txt
|
||||
t1_state.json
|
||||
stderr_log.txt
|
||||
t2_state.json
|
||||
.vscode
|
||||
.DS_STORE
|
||||
# Byte-compiled / optimized / DLL files
|
||||
Transcript Generator_state.json
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
.grit
|
||||
swarm-worker-01_state.json
|
||||
error.txt
|
||||
Devin Worker 2_state.json
|
||||
# C extensions
|
||||
*.so
|
||||
.ruff_cache
|
||||
|
||||
|
||||
errors.txt
|
||||
|
||||
Autonomous-Agent-XYZ1B_state.json
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
.DS_Store
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
.vscode/settings.json
|
@ -0,0 +1,18 @@
|
||||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: 'v0.0.255'
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [----unsafe-fixes]
|
||||
- repo: https://github.com/nbQA-dev/nbQA
|
||||
rev: 1.6.3
|
||||
hooks:
|
||||
- id: nbqa-black
|
||||
additional_dependencies: [ipython==8.12, black]
|
||||
- id: nbqa-ruff
|
||||
args: ["--ignore=I001"]
|
||||
additional_dependencies: [ipython==8.12, ruff]
|
@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
kye@apac.ai.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
@ -0,0 +1,82 @@
|
||||
# Contributing to Swarms 🛠️
|
||||
|
||||
Thank you for your interest in contributing to Swarms! This guide will help you get started with your contribution.
|
||||
|
||||
## Essential Steps for Contributing
|
||||
|
||||
### 1. Fork and Clone the Repository
|
||||
|
||||
1. Fork the Swarms repository to your GitHub account by clicking the "Fork" button in the top-right corner of the repository page.
|
||||
2. Clone your forked repository to your local machine:
|
||||
```
|
||||
git clone https://github.com/kyegomez/swarms.git
|
||||
```
|
||||
|
||||
### 2. Make Changes
|
||||
|
||||
1. Create a new branch for your changes:
|
||||
```
|
||||
git checkout -b your-branch-name
|
||||
```
|
||||
2. Make your desired changes to the codebase.
|
||||
|
||||
### 3. Commit and Push Changes
|
||||
|
||||
1. Stage your changes:
|
||||
```
|
||||
git add .
|
||||
```
|
||||
2. Commit your changes:
|
||||
```
|
||||
git commit -m "Your descriptive commit message"
|
||||
```
|
||||
3. Push your changes to your fork:
|
||||
```
|
||||
git push -u origin your-branch-name
|
||||
```
|
||||
|
||||
### 4. Create a Pull Request
|
||||
|
||||
1. Go to the original Swarms repository on GitHub.
|
||||
2. Click on "Pull Requests" and then "New Pull Request".
|
||||
3. Select your fork and branch as the compare branch.
|
||||
4. Click "Create Pull Request".
|
||||
5. Fill in the pull request description and submit.
|
||||
|
||||
## Important Considerations
|
||||
|
||||
- Ensure your code follows the project's coding standards.
|
||||
- Include tests for new features or bug fixes.
|
||||
- Update documentation as necessary.
|
||||
- Make sure your branch is up-to-date with the main repository before submitting a pull request.
|
||||
|
||||
## Additional Information
|
||||
|
||||
### Code Quality
|
||||
|
||||
We use pre-commit hooks to maintain code quality. To set up pre-commit:
|
||||
|
||||
1. Install pre-commit:
|
||||
```
|
||||
pip install pre-commit
|
||||
```
|
||||
2. Set up the git hook scripts:
|
||||
```
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
- We use mkdocs for documentation. To serve the docs locally:
|
||||
```
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
- Run tests using pytest:
|
||||
```
|
||||
pytest
|
||||
```
|
||||
|
||||
For more detailed information on code quality, documentation, and testing, please refer to the full contributing guidelines in the repository.
|
@ -0,0 +1,340 @@
|
||||
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution 4.0 International Public License ("Public License"). To the
|
||||
extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of
|
||||
these terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the
|
||||
Licensed Material available under these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
@ -0,0 +1,38 @@
|
||||
# Security Policy
|
||||
===============
|
||||
|
||||
| Security Feature | Benefit | Description |
|
||||
|-------------------------------|------------------------------------------|-----------------------------------------------------------------------------|
|
||||
| Environment Variables | Secure Configuration | Uses environment variables to manage sensitive configurations securely. |
|
||||
| No Telemetry | Enhanced Privacy | Prioritizes user privacy by not collecting telemetry data. |
|
||||
| Data Encryption | Data Protection | Encrypts sensitive data to protect it from unauthorized access. |
|
||||
| Authentication | Access Control | Ensures that only authorized users can access the system. |
|
||||
| Authorization | Fine-grained Access | Provides specific access rights to users based on roles and permissions. |
|
||||
| Dependency Security | Reduced Vulnerabilities | Securely manages dependencies to prevent vulnerabilities. |
|
||||
| Secure Installation | Integrity Assurance | Ensures the integrity of the software through verified sources and checksums.|
|
||||
| Regular Updates | Ongoing Protection | Keeps the system secure by regularly updating to patch vulnerabilities. |
|
||||
| Logging and Monitoring | Operational Oversight | Tracks system activity for security monitoring and anomaly detection. |
|
||||
| Error Handling | Robust Security | Manages errors securely to prevent leakage of sensitive information. |
|
||||
| Data Storage Security | Secure Data Handling | Stores data securely, ensuring confidentiality and integrity. |
|
||||
| Data Transmission Security | Secure Data Transfer | Protects data during transit from eavesdropping and tampering. |
|
||||
| Access Control Mechanisms | Restricted Access | Limits system access to authorized personnel only. |
|
||||
| Vulnerability Management | Proactive Protection | Identifies and mitigates security vulnerabilities effectively. |
|
||||
| Regulatory Compliance | Legal Conformity | Ensures that the system adheres to relevant legal and regulatory standards. |
|
||||
| Security Audits |
|
||||
|
||||
|
||||
# Reporting a Vulnerability
|
||||
-------------------------
|
||||
|
||||
* * * * *
|
||||
|
||||
If you discover a security vulnerability in any of the above versions, please report it immediately to our security team by sending an email to kye@apac.ai. We take security vulnerabilities seriously and appreciate your efforts in disclosing them responsibly.
|
||||
|
||||
Please provide detailed information on the vulnerability, including steps to reproduce, potential impact, and any known mitigations. Our security team will acknowledge receipt of your report within 24 hours and will provide regular updates on the progress of the investigation.
|
||||
|
||||
Once the vulnerability has been thoroughly assessed, we will take the necessary steps to address it. This may include releasing a security patch, issuing a security advisory, or implementing other appropriate mitigations.
|
||||
|
||||
We aim to respond to all vulnerability reports in a timely manner and work towards resolving them as quickly as possible. We thank you for your contribution to the security of our software.
|
||||
|
||||
Please note that any vulnerability reports that are not related to the specified versions or do not provide sufficient information may be declined.
|
||||
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
version: 2
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.11"
|
||||
mkdocs:
|
||||
configuration: docs/mkdocs.yml
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
@ -0,0 +1,978 @@
|
||||
## Building Analyst Agents with Swarms to write Business Reports
|
||||
|
||||
> Jupyter Notebook accompanying this post is accessible at: [Business Analyst Agent Notebook](https://github.com/kyegomez/swarms/blob/master/playground/demos/business_analysis_swarm/business-analyst-agent.ipynb)
|
||||
|
||||
Solving a business problem often involves preparing a Business Case Report. This report comprehensively analyzes the problem, evaluates potential solutions, and provides evidence-based recommendations and an implementation plan to effectively address the issue and drive business value. While the process of preparing one requires an experienced business analyst, the workflow can be augmented using AI agents. Two candidates stick out as areas to work on:
|
||||
|
||||
- Developing an outline to solve the problem
|
||||
- Doing background research and gathering data
|
||||
|
||||
In this post, we will explore how Swarms agents can be used to tackle a busuiness problem by outlining the solution, conducting background research and generating a preliminary report.
|
||||
|
||||
Before we proceed, this blog uses 3 API tools. Please obtain the following keys and store them in a `.env` file in the same folder as this file.
|
||||
|
||||
- **[OpenAI API](https://openai.com/blog/openai-api)** as `OPENAI_API_KEY`
|
||||
- **[TavilyAI API](https://app.tavily.com/home)** `TAVILY_API_KEY`
|
||||
- **[KayAI API](https://www.kay.ai/)** as `KAY_API_KEY`
|
||||
|
||||
```python
|
||||
import dotenv
|
||||
dotenv.load_dotenv() # Load environment variables from .env file
|
||||
```
|
||||
|
||||
### Developing an Outline to solve the problem
|
||||
|
||||
Assume the business problem is: **How do we improve Nike's revenue in Q3 2024?** We first create a planning agent to break down the problem into dependent sub-problems.
|
||||
|
||||
|
||||
#### Step 1. Defining the Data Model and Tool Schema
|
||||
|
||||
Using Pydantic, we define a structure to help the agent generate sub-problems.
|
||||
|
||||
- **QueryType:** Questions are either standalone or involve a combination of multiple others
|
||||
- **Query:** Defines structure of a question.
|
||||
- **QueryPlan:** Allows generation of a dependency graph of sub-questions
|
||||
|
||||
|
||||
```python
|
||||
import enum
|
||||
from typing import List
|
||||
from pydantic import Field, BaseModel
|
||||
|
||||
class QueryType(str, enum.Enum):
|
||||
"""Enumeration representing the types of queries that can be asked to a question answer system."""
|
||||
|
||||
SINGLE_QUESTION = "SINGLE"
|
||||
MERGE_MULTIPLE_RESPONSES = "MERGE_MULTIPLE_RESPONSES"
|
||||
|
||||
class Query(BaseModel):
|
||||
"""Class representing a single question in a query plan."""
|
||||
|
||||
id: int = Field(..., description="Unique id of the query")
|
||||
question: str = Field(
|
||||
...,
|
||||
description="Question asked using a question answering system",
|
||||
)
|
||||
dependencies: List[int] = Field(
|
||||
default_factory=list,
|
||||
description="List of sub questions that need to be answered before asking this question",
|
||||
)
|
||||
node_type: QueryType = Field(
|
||||
default=QueryType.SINGLE_QUESTION,
|
||||
description="Type of question, either a single question or a multi-question merge",
|
||||
)
|
||||
|
||||
class QueryPlan(BaseModel):
|
||||
"""Container class representing a tree of questions to ask a question answering system."""
|
||||
|
||||
query_graph: List[Query] = Field(
|
||||
..., description="The query graph representing the plan"
|
||||
)
|
||||
|
||||
def _dependencies(self, ids: List[int]) -> List[Query]:
|
||||
"""Returns the dependencies of a query given their ids."""
|
||||
|
||||
return [q for q in self.query_graph if q.id in ids]
|
||||
```
|
||||
|
||||
Also, a `tool_schema` needs to be defined. It is an instance of `QueryPlan` and is used to initialize the agent.
|
||||
|
||||
```python
|
||||
tool_schema = QueryPlan(
|
||||
query_graph = [query.dict() for query in [
|
||||
Query(
|
||||
id=1,
|
||||
question="How do we improve Nike's revenue in Q3 2024?",
|
||||
dependencies=[2],
|
||||
node_type=QueryType('SINGLE')
|
||||
),
|
||||
# ... other queries ...
|
||||
]]
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 2. Defining the Planning Agent
|
||||
|
||||
We specify the query, task specification and an appropriate system prompt.
|
||||
|
||||
```python
|
||||
from swarms import OpenAIChat
|
||||
from swarms import Agent
|
||||
|
||||
query = "How do we improve Nike's revenue in Q3 2024?"
|
||||
task = f"Consider: {query}. Generate just the correct query plan in JSON format."
|
||||
system_prompt = (
|
||||
"You are a world class query planning algorithm "
|
||||
"capable of breaking apart questions into its "
|
||||
"dependency queries such that the answers can be "
|
||||
"used to inform the parent question. Do not answer "
|
||||
"the questions, simply provide a correct compute "
|
||||
"graph with good specific questions to ask and relevant "
|
||||
"dependencies. Before you call the function, think "
|
||||
"step-by-step to get a better understanding of the problem."
|
||||
)
|
||||
llm = OpenAIChat(
|
||||
temperature=0.0, model_name="gpt-4", max_tokens=4000
|
||||
)
|
||||
```
|
||||
|
||||
Then, we proceed with agent definition.
|
||||
|
||||
```python
|
||||
# Initialize the agent
|
||||
agent = Agent(
|
||||
agent_name="Query Planner",
|
||||
system_prompt=system_prompt,
|
||||
# Set the tool schema to the JSON string -- this is the key difference
|
||||
tool_schema=tool_schema,
|
||||
llm=llm,
|
||||
max_loops=1,
|
||||
autosave=True,
|
||||
dashboard=False,
|
||||
streaming_on=True,
|
||||
verbose=True,
|
||||
interactive=False,
|
||||
# Set the output type to the tool schema which is a BaseModel
|
||||
output_type=tool_schema, # or dict, or str
|
||||
metadata_output_type="json",
|
||||
# List of schemas that the agent can handle
|
||||
list_base_models=[tool_schema],
|
||||
function_calling_format_type="OpenAI",
|
||||
function_calling_type="json", # or soon yaml
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 3. Obtaining Outline from Planning Agent
|
||||
|
||||
We now run the agent, and since its output is in JSON format, we can load it as a dictionary.
|
||||
|
||||
```python
|
||||
generated_data = agent.run(task)
|
||||
```
|
||||
|
||||
At times the agent could return extra content other than JSON. Below function will filter it out.
|
||||
|
||||
```python
|
||||
def process_json_output(content):
|
||||
# Find the index of the first occurrence of '```json\n'
|
||||
start_index = content.find('```json\n')
|
||||
if start_index == -1:
|
||||
# If '```json\n' is not found, return the original content
|
||||
return content
|
||||
# Return the part of the content after '```json\n' and remove the '```' at the end
|
||||
return content[start_index + len('```json\n'):].rstrip('`')
|
||||
|
||||
# Use the function to clean up the output
|
||||
json_content = process_json_output(generated_data.content)
|
||||
|
||||
import json
|
||||
|
||||
# Load the JSON string into a Python object
|
||||
json_object = json.loads(json_content)
|
||||
|
||||
# Convert the Python object back to a JSON string
|
||||
json_content = json.dumps(json_object, indent=2)
|
||||
|
||||
# Print the JSON string
|
||||
print(json_content)
|
||||
```
|
||||
|
||||
Below is the output this produces
|
||||
|
||||
```json
|
||||
{
|
||||
"main_query": "How do we improve Nike's revenue in Q3 2024?",
|
||||
"sub_queries": [
|
||||
{
|
||||
"id": "1",
|
||||
"query": "What is Nike's current revenue trend?"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"query": "What are the projected market trends for the sports apparel industry in 2024?"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"query": "What are the current successful strategies being used by Nike's competitors?",
|
||||
"dependencies": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"query": "What are the current and projected economic conditions in Nike's major markets?",
|
||||
"dependencies": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"query": "What are the current consumer preferences in the sports apparel industry?",
|
||||
"dependencies": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"query": "What are the potential areas of improvement in Nike's current business model?",
|
||||
"dependencies": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "7",
|
||||
"query": "What are the potential new markets for Nike to explore in 2024?",
|
||||
"dependencies": [
|
||||
"2",
|
||||
"4"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "8",
|
||||
"query": "What are the potential new products or services Nike could introduce in 2024?",
|
||||
"dependencies": [
|
||||
"5"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"query": "What are the potential marketing strategies Nike could use to increase its revenue in Q3 2024?",
|
||||
"dependencies": [
|
||||
"3",
|
||||
"5",
|
||||
"7",
|
||||
"8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"query": "What are the potential cost-saving strategies Nike could implement to increase its net revenue in Q3 2024?",
|
||||
"dependencies": [
|
||||
"6"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The JSON dictionary is not convenient for humans to process. We make a directed graph out of it.
|
||||
|
||||
```python
|
||||
import networkx as nx
|
||||
import matplotlib.pyplot as plt
|
||||
import textwrap
|
||||
import random
|
||||
|
||||
# Create a directed graph
|
||||
G = nx.DiGraph()
|
||||
|
||||
# Define a color map
|
||||
color_map = {}
|
||||
|
||||
# Add nodes and edges to the graph
|
||||
for sub_query in json_object['sub_queries']:
|
||||
# Check if 'dependencies' key exists in sub_query, if not, initialize it as an empty list
|
||||
if 'dependencies' not in sub_query:
|
||||
sub_query['dependencies'] = []
|
||||
# Assign a random color for each node
|
||||
color_map[sub_query['id']] = "#{:06x}".format(random.randint(0, 0xFFFFFF))
|
||||
G.add_node(sub_query['id'], label=textwrap.fill(sub_query['query'], width=20))
|
||||
for dependency in sub_query['dependencies']:
|
||||
G.add_edge(dependency, sub_query['id'])
|
||||
|
||||
# Draw the graph
|
||||
pos = nx.spring_layout(G)
|
||||
nx.draw(G, pos, with_labels=True, node_size=800, node_color=[color_map[node] for node in G.nodes()], node_shape="o", alpha=0.5, linewidths=40)
|
||||
|
||||
# Prepare labels for legend
|
||||
labels = nx.get_node_attributes(G, 'label')
|
||||
handles = [plt.Line2D([0], [0], marker='o', color=color_map[node], label=f"{node}: {label}", markersize=10, linestyle='None') for node, label in labels.items()]
|
||||
|
||||
# Create a legend
|
||||
plt.legend(handles=handles, title="Queries", bbox_to_anchor=(1.05, 1), loc='upper left')
|
||||
|
||||
plt.show()
|
||||
```
|
||||
|
||||
This produces the below diagram which makes the plan much more convenient to understand.
|
||||
|
||||
![Query Plan Diagram](../assets/img/docs/query-plan.png)
|
||||
|
||||
### Doing Background Research and Gathering Data
|
||||
|
||||
At this point, we have solved the first half of the problem. We have an outline consisting of sub-problems to to tackled to solve our business problem. This will form the overall structure of our report. We now need to research information for each sub-problem in order to write an informed report. This mechanically intensive and is the aspect that will most benefit from Agentic intervention.
|
||||
|
||||
Essentially, we can spawn parallel agents to gather the data. Each agent will have 2 tools:
|
||||
|
||||
- Internet access
|
||||
- Financial data retrieval
|
||||
|
||||
As they run parallely, they will add their knowledge into a common long-term memory. We will then spawn a separate report writing agent with access to this memory to generate our business case report.
|
||||
|
||||
#### Step 4. Defining Tools for Worker Agents
|
||||
|
||||
Let us first define the 2 tools.
|
||||
|
||||
```python
|
||||
import os
|
||||
from typing import List, Dict
|
||||
|
||||
from swarms import tool
|
||||
|
||||
os.environ['TAVILY_API_KEY'] = os.getenv('TAVILY_API_KEY')
|
||||
os.environ["KAY_API_KEY"] = os.getenv('KAY_API_KEY')
|
||||
|
||||
from langchain_community.tools.tavily_search import TavilySearchResults
|
||||
from langchain_core.pydantic_v1 import BaseModel, Field
|
||||
|
||||
from kay.rag.retrievers import KayRetriever
|
||||
|
||||
@tool
|
||||
def browser(query: str) -> str:
|
||||
"""
|
||||
Search the query in the browser with the Tavily API tool.
|
||||
Args:
|
||||
query (str): The query to search in the browser.
|
||||
Returns:
|
||||
str: The search results
|
||||
"""
|
||||
internet_search = TavilySearchResults()
|
||||
results = internet_search.invoke({"query": query})
|
||||
response = ''
|
||||
for result in results:
|
||||
response += (result['content'] + '\n')
|
||||
return response
|
||||
|
||||
@tool
|
||||
def kay_retriever(query: str) -> str:
|
||||
"""
|
||||
Search the financial data query with the KayAI API tool.
|
||||
Args:
|
||||
query (str): The query to search in the KayRetriever.
|
||||
Returns:
|
||||
str: The first context retrieved as a string.
|
||||
"""
|
||||
# Initialize the retriever
|
||||
retriever = KayRetriever(dataset_id = "company", data_types=["10-K", "10-Q", "8-K", "PressRelease"])
|
||||
# Query the retriever
|
||||
context = retriever.query(query=query,num_context=1)
|
||||
return context[0]['chunk_embed_text']
|
||||
```
|
||||
|
||||
#### Step 5. Defining Long-Term Memory
|
||||
|
||||
As mentioned previously, the worker agents running parallely, will pool their knowledge into a common memory. Let us define that.
|
||||
|
||||
```python
|
||||
import logging
|
||||
import os
|
||||
import uuid
|
||||
from typing import Callable, List, Optional
|
||||
|
||||
import chromadb
|
||||
import numpy as np
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from swarms.utils.data_to_text import data_to_text
|
||||
from swarms.utils.markdown_message import display_markdown_message
|
||||
from swarms.memory.base_vectordb import AbstractVectorDatabase
|
||||
|
||||
|
||||
# Results storage using local ChromaDB
|
||||
class ChromaDB(AbstractVectorDatabase):
|
||||
"""
|
||||
|
||||
ChromaDB database
|
||||
|
||||
Args:
|
||||
metric (str): The similarity metric to use.
|
||||
output (str): The name of the collection to store the results in.
|
||||
limit_tokens (int, optional): The maximum number of tokens to use for the query. Defaults to 1000.
|
||||
n_results (int, optional): The number of results to retrieve. Defaults to 2.
|
||||
|
||||
Methods:
|
||||
add: _description_
|
||||
query: _description_
|
||||
|
||||
Examples:
|
||||
>>> chromadb = ChromaDB(
|
||||
>>> metric="cosine",
|
||||
>>> output="results",
|
||||
>>> llm="gpt3",
|
||||
>>> openai_api_key=OPENAI_API_KEY,
|
||||
>>> )
|
||||
>>> chromadb.add(task, result, result_id)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
metric: str = "cosine",
|
||||
output_dir: str = "swarms",
|
||||
limit_tokens: Optional[int] = 1000,
|
||||
n_results: int = 3,
|
||||
embedding_function: Callable = None,
|
||||
docs_folder: str = None,
|
||||
verbose: bool = False,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
self.metric = metric
|
||||
self.output_dir = output_dir
|
||||
self.limit_tokens = limit_tokens
|
||||
self.n_results = n_results
|
||||
self.docs_folder = docs_folder
|
||||
self.verbose = verbose
|
||||
|
||||
# Disable ChromaDB logging
|
||||
if verbose:
|
||||
logging.getLogger("chromadb").setLevel(logging.INFO)
|
||||
|
||||
# Create Chroma collection
|
||||
chroma_persist_dir = "chroma"
|
||||
chroma_client = chromadb.PersistentClient(
|
||||
settings=chromadb.config.Settings(
|
||||
persist_directory=chroma_persist_dir,
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
# Embedding model
|
||||
if embedding_function:
|
||||
self.embedding_function = embedding_function
|
||||
else:
|
||||
self.embedding_function = None
|
||||
|
||||
# Create ChromaDB client
|
||||
self.client = chromadb.Client()
|
||||
|
||||
# Create Chroma collection
|
||||
self.collection = chroma_client.get_or_create_collection(
|
||||
name=output_dir,
|
||||
metadata={"hnsw:space": metric},
|
||||
embedding_function=self.embedding_function,
|
||||
# data_loader=self.data_loader,
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
display_markdown_message(
|
||||
"ChromaDB collection created:"
|
||||
f" {self.collection.name} with metric: {self.metric} and"
|
||||
f" output directory: {self.output_dir}"
|
||||
)
|
||||
|
||||
# If docs
|
||||
if docs_folder:
|
||||
display_markdown_message(
|
||||
f"Traversing directory: {docs_folder}"
|
||||
)
|
||||
self.traverse_directory()
|
||||
|
||||
def add(
|
||||
self,
|
||||
document: str,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Add a document to the ChromaDB collection.
|
||||
|
||||
Args:
|
||||
document (str): The document to be added.
|
||||
condition (bool, optional): The condition to check before adding the document. Defaults to True.
|
||||
|
||||
Returns:
|
||||
str: The ID of the added document.
|
||||
"""
|
||||
try:
|
||||
doc_id = str(uuid.uuid4())
|
||||
self.collection.add(
|
||||
ids=[doc_id],
|
||||
documents=[document],
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
print('-----------------')
|
||||
print("Document added successfully")
|
||||
print('-----------------')
|
||||
return doc_id
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to add document: {str(e)}")
|
||||
|
||||
def query(
|
||||
self,
|
||||
query_text: str,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Query documents from the ChromaDB collection.
|
||||
|
||||
Args:
|
||||
query (str): The query string.
|
||||
n_docs (int, optional): The number of documents to retrieve. Defaults to 1.
|
||||
|
||||
Returns:
|
||||
dict: The retrieved documents.
|
||||
"""
|
||||
try:
|
||||
docs = self.collection.query(
|
||||
query_texts=[query_text],
|
||||
n_results=self.n_results,
|
||||
*args,
|
||||
**kwargs,
|
||||
)["documents"]
|
||||
return docs[0]
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to query documents: {str(e)}")
|
||||
|
||||
def traverse_directory(self):
|
||||
"""
|
||||
Traverse through every file in the given directory and its subdirectories,
|
||||
and return the paths of all files.
|
||||
Parameters:
|
||||
- directory_name (str): The name of the directory to traverse.
|
||||
Returns:
|
||||
- list: A list of paths to each file in the directory and its subdirectories.
|
||||
"""
|
||||
added_to_db = False
|
||||
|
||||
for root, dirs, files in os.walk(self.docs_folder):
|
||||
for file in files:
|
||||
file = os.path.join(self.docs_folder, file)
|
||||
_, ext = os.path.splitext(file)
|
||||
data = data_to_text(file)
|
||||
added_to_db = self.add([data])
|
||||
print(f"{file} added to Database")
|
||||
|
||||
return added_to_db
|
||||
```
|
||||
|
||||
We can now proceed to initialize the memory.
|
||||
|
||||
```python
|
||||
from chromadb.utils import embedding_functions
|
||||
default_ef = embedding_functions.DefaultEmbeddingFunction()
|
||||
|
||||
memory = ChromaDB(
|
||||
metric="cosine",
|
||||
n_results=3,
|
||||
output_dir="results",
|
||||
embedding_function=default_ef
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 6. Defining Worker Agents
|
||||
|
||||
The Worker Agent sub-classes the `Agent` class. The only different between these 2 is in how the `run()` method works. In the `Agent` class, `run()` simply returns the set of tool commands to run, but does not execute it. We, however, desire this. In addition, after we run our tools, we get the relevant information as output. We want to add this information to our memory. Hence, to incorporate these 2 changes, we define `WorkerAgent` as follows.
|
||||
|
||||
```python
|
||||
class WorkerAgent(Agent):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def run(self, task, *args, **kwargs):
|
||||
response = super().run(task, *args, **kwargs)
|
||||
print(response.content)
|
||||
|
||||
json_dict = json.loads(process_json_output(response.content))
|
||||
|
||||
#print(json.dumps(json_dict, indent=2))
|
||||
|
||||
if response!=None:
|
||||
try:
|
||||
commands = json_dict["commands"]
|
||||
except:
|
||||
commands = [json_dict['command']]
|
||||
|
||||
for command in commands:
|
||||
tool_name = command["name"]
|
||||
|
||||
if tool_name not in ['browser', 'kay_retriever']:
|
||||
continue
|
||||
|
||||
query = command["args"]["query"]
|
||||
|
||||
# Get the tool by its name
|
||||
tool = globals()[tool_name]
|
||||
tool_response = tool(query)
|
||||
|
||||
# Add tool's output to long term memory
|
||||
self.long_term_memory.add(tool_response)
|
||||
```
|
||||
|
||||
We can then instantiate an object of the `WorkerAgent` class.
|
||||
|
||||
```python
|
||||
worker_agent = WorkerAgent(
|
||||
agent_name="Worker Agent",
|
||||
system_prompt=(
|
||||
"Autonomous agent that can interact with browser, "
|
||||
"financial data retriever and other agents. Be Helpful "
|
||||
"and Kind. Use the tools provided to assist the user. "
|
||||
"Generate the plan with list of commands in JSON format."
|
||||
),
|
||||
llm=OpenAIChat(
|
||||
temperature=0.0, model_name="gpt-4", max_tokens=4000
|
||||
),
|
||||
max_loops="auto",
|
||||
autosave=True,
|
||||
dashboard=False,
|
||||
streaming_on=True,
|
||||
verbose=True,
|
||||
stopping_token="<DONE>",
|
||||
interactive=True,
|
||||
tools=[browser, kay_retriever],
|
||||
long_term_memory=memory,
|
||||
code_interpreter=True,
|
||||
)
|
||||
```
|
||||
|
||||
#### Step 7. Running the Worker Agents
|
||||
|
||||
At this point, we need to setup a concurrent workflow. While the order of adding tasks to the workflow doesn't matter (since they will all run concurrently late when executed), we can take some time to define an order for these tasks. This order will come in handy later when writing the report using our Writer Agent.
|
||||
|
||||
The order we will follow is Breadth First Traversal (BFT) of the sub-queries in the graph we had made earlier (shown below again for reference). BFT makes sense to be used here because we want all the dependent parent questions to be answered before answering the child question. Also, since we could have independent subgraphs, we will also perform BFT separately on each subgraph.
|
||||
|
||||
![Query Plan Mini](../assets/img/docs/query-plan-mini.png)
|
||||
|
||||
Below is the code that produces the order of processing sub-queries.
|
||||
|
||||
```python
|
||||
from collections import deque, defaultdict
|
||||
|
||||
# Define the graph nodes
|
||||
nodes = json_object['sub_queries']
|
||||
|
||||
# Create a graph from the nodes
|
||||
graph = defaultdict(list)
|
||||
for node in nodes:
|
||||
for dependency in node['dependencies']:
|
||||
graph[dependency].append(node['id'])
|
||||
|
||||
# Find all nodes with no dependencies (potential starting points)
|
||||
start_nodes = [node['id'] for node in nodes if not node['dependencies']]
|
||||
|
||||
# Adjust the BFT function to handle dependencies correctly
|
||||
def bft_corrected(start, graph, nodes_info):
|
||||
visited = set()
|
||||
queue = deque([start])
|
||||
order = []
|
||||
|
||||
while queue:
|
||||
node = queue.popleft()
|
||||
if node not in visited:
|
||||
# Check if all dependencies of the current node are visited
|
||||
node_dependencies = [n['id'] for n in nodes if n['id'] == node][0]
|
||||
dependencies_met = all(dep in visited for dep in nodes_info[node_dependencies]['dependencies'])
|
||||
|
||||
if dependencies_met:
|
||||
visited.add(node)
|
||||
order.append(node)
|
||||
# Add only nodes to the queue whose dependencies are fully met
|
||||
for next_node in graph[node]:
|
||||
if all(dep in visited for dep in nodes_info[next_node]['dependencies']):
|
||||
queue.append(next_node)
|
||||
else:
|
||||
# Requeue the node to check dependencies later
|
||||
queue.append(node)
|
||||
|
||||
return order
|
||||
|
||||
# Dictionary to access node information quickly
|
||||
nodes_info = {node['id']: node for node in nodes}
|
||||
|
||||
# Perform BFT for each unvisited start node using the corrected BFS function
|
||||
visited_global = set()
|
||||
bfs_order = []
|
||||
|
||||
for start in start_nodes:
|
||||
if start not in visited_global:
|
||||
order = bft_corrected(start, graph, nodes_info)
|
||||
bfs_order.extend(order)
|
||||
visited_global.update(order)
|
||||
|
||||
print("BFT Order:", bfs_order)
|
||||
```
|
||||
|
||||
This produces the following output.
|
||||
|
||||
```python
|
||||
BFT Order: ['1', '6', '10', '2', '3', '4', '5', '7', '8', '9']
|
||||
```
|
||||
|
||||
Now, let's define our `ConcurrentWorkflow` and run it.
|
||||
|
||||
```python
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from swarms import Agent, ConcurrentWorkflow, OpenAIChat, Task
|
||||
|
||||
# Create a workflow
|
||||
workflow = ConcurrentWorkflow(max_workers=5)
|
||||
task_list = []
|
||||
|
||||
for node in bfs_order:
|
||||
sub_query =nodes_info[node]['query']
|
||||
task = Task(worker_agent, sub_query)
|
||||
print('-----------------')
|
||||
print("Added task: ", sub_query)
|
||||
print('-----------------')
|
||||
task_list.append(task)
|
||||
|
||||
workflow.add(tasks=task_list)
|
||||
|
||||
# Run the workflow
|
||||
workflow.run()
|
||||
```
|
||||
|
||||
Below is part of the output this workflow produces. We clearly see the thought process of the agent and the plan it came up to solve a particular sub-query. In addition, we see the tool-calling schema it produces in `"command"`.
|
||||
|
||||
```python
|
||||
...
|
||||
...
|
||||
content='\n{\n "thoughts": {\n "text": "To find out Nike\'s current revenue trend, I will use the financial data retriever tool to search for \'Nike revenue trend\'.",\n "reasoning": "The financial data retriever tool allows me to search for specific financial data, so I can look up the current revenue trend of Nike.", \n "plan": "Use the financial data retriever tool to search for \'Nike revenue trend\'. Parse the result to get the current revenue trend and format that into a readable report."\n },\n "command": {\n "name": "kay_retriever", \n "args": {\n "query": "Nike revenue trend"\n }\n }\n}\n```' response_metadata={'token_usage': {'completion_tokens': 152, 'prompt_tokens': 1527, 'total_tokens': 1679}, 'model_name': 'gpt-4', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}
|
||||
Saved agent state to: Worker Agent_state.json
|
||||
|
||||
{
|
||||
"thoughts": {
|
||||
"text": "To find out Nike's current revenue trend, I will use the financial data retriever tool to search for 'Nike revenue trend'.",
|
||||
"reasoning": "The financial data retriever tool allows me to search for specific financial data, so I can look up the current revenue trend of Nike.",
|
||||
"plan": "Use the financial data retriever tool to search for 'Nike revenue trend'. Parse the result to get the current revenue trend and format that into a readable report."
|
||||
},
|
||||
"command": {
|
||||
"name": "kay_retriever",
|
||||
"args": {
|
||||
"query": "Nike revenue trend"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-----------------
|
||||
Document added successfully
|
||||
-----------------
|
||||
...
|
||||
...
|
||||
```
|
||||
|
||||
Here, `"name"` pertains to the name of the tool to be called and `"args"` is the arguments to be passed to the tool call. Like mentioned before, we modify `Agent`'s default behaviour in `WorkerAgent`. Hence, the tool call is executed here and its results (information from web pages and Kay Retriever API) are added to long-term memory. We get confirmation for this from the message `Document added successfully`.
|
||||
|
||||
|
||||
#### Step 7. Generating the report using Writer Agent
|
||||
|
||||
At this point, our Worker Agents have gathered all the background information required to generate the report. We have also defined a coherent structure to write the report, which is following the BFT order to answering the sub-queries. Now it's time to define a Writer Agent and call it sequentially in the order of sub-queries.
|
||||
|
||||
```python
|
||||
from swarms import Agent, OpenAIChat, tool
|
||||
|
||||
agent = Agent(
|
||||
agent_name="Writer Agent",
|
||||
agent_description=(
|
||||
"This agent writes reports based on information in long-term memory"
|
||||
),
|
||||
system_prompt=(
|
||||
"You are a world-class financial report writer. "
|
||||
"Write analytical and accurate responses using memory to answer the query. "
|
||||
"Do not mention use of long-term memory in the report. "
|
||||
"Do not mention Writer Agent in response."
|
||||
"Return only response content in strict markdown format."
|
||||
),
|
||||
llm=OpenAIChat(temperature=0.2, model='gpt-3.5-turbo'),
|
||||
max_loops=1,
|
||||
autosave=True,
|
||||
verbose=True,
|
||||
long_term_memory=memory,
|
||||
)
|
||||
```
|
||||
|
||||
The report individual sections of the report will be collected in a list.
|
||||
|
||||
```python
|
||||
report = []
|
||||
```
|
||||
|
||||
Let us now run the writer agent.
|
||||
|
||||
```python
|
||||
for node in bfs_order:
|
||||
sub_query =nodes_info[node]['query']
|
||||
print("Running task: ", sub_query)
|
||||
out = agent.run(f"Consider: {sub_query}. Write response in strict markdown format using long-term memory. Do not mention Writer Agent in response.")
|
||||
print(out)
|
||||
try:
|
||||
report.append(out.content)
|
||||
except:
|
||||
pass
|
||||
```
|
||||
|
||||
Now, we need to clean up the repoort a bit to make it render professionally.
|
||||
|
||||
```python
|
||||
# Remove any content before the first "#" as that signals start of heading
|
||||
# Anything before this usually contains filler content
|
||||
stripped_report = [entry[entry.find('#'):] if '#' in entry else entry for entry in report]
|
||||
report = stripped_report
|
||||
|
||||
# At times the LLM outputs \\n instead of \n
|
||||
cleaned_report = [entry.replace("\\n", "\n") for entry in report]
|
||||
import re
|
||||
|
||||
# Function to clean up unnecessary metadata from the report entries
|
||||
def clean_report(report):
|
||||
cleaned_report = []
|
||||
for entry in report:
|
||||
# This pattern matches 'response_metadata={' followed by any characters that are not '}' (non-greedy),
|
||||
# possibly nested inside other braces, until the closing '}'.
|
||||
cleaned_entry = re.sub(r"response_metadata=\{[^{}]*(?:\{[^{}]*\}[^{}]*)*\}", "", entry, flags=re.DOTALL)
|
||||
cleaned_report.append(cleaned_entry)
|
||||
return cleaned_report
|
||||
|
||||
# Apply the cleaning function to the markdown report
|
||||
cleaned_report = clean_report(cleaned_report)
|
||||
```
|
||||
|
||||
After cleaning, we append parts of the report together to get out final report.
|
||||
|
||||
```python
|
||||
final_report = ' \n '.join(cleaned_report)
|
||||
```
|
||||
|
||||
In Jupyter Notebook, we can use the below code to render it in Markdown.
|
||||
|
||||
```python
|
||||
from IPython.display import display, Markdown
|
||||
|
||||
display(Markdown(final_report))
|
||||
```
|
||||
|
||||
|
||||
## Final Generated Report
|
||||
|
||||
|
||||
### Nike's Current Revenue Trend
|
||||
|
||||
Nike's current revenue trend has been steadily increasing over the past few years. In the most recent fiscal year, Nike reported a revenue of $37.4 billion, which was a 7% increase from the previous year. This growth can be attributed to strong sales in key markets, successful marketing campaigns, and a focus on innovation in product development. Overall, Nike continues to demonstrate strong financial performance and is well-positioned for future growth.
|
||||
### Potential Areas of Improvement in Nike's Business Model
|
||||
|
||||
1. **Sustainability Practices**: Nike could further enhance its sustainability efforts by reducing its carbon footprint, using more eco-friendly materials, and ensuring ethical labor practices throughout its supply chain.
|
||||
|
||||
2. **Diversification of Product Portfolio**: While Nike is known for its athletic footwear and apparel, diversifying into new product categories or expanding into untapped markets could help drive growth and mitigate risks associated with a single product line.
|
||||
|
||||
3. **E-commerce Strategy**: Improving the online shopping experience, investing in digital marketing, and leveraging data analytics to personalize customer interactions could boost online sales and customer loyalty.
|
||||
|
||||
4. **Innovation and R&D**: Continuously investing in research and development to stay ahead of competitors, introduce new technologies, and enhance product performance could help maintain Nike's competitive edge in the market.
|
||||
|
||||
5. **Brand Image and Reputation**: Strengthening brand image through effective marketing campaigns, community engagement, and transparent communication with stakeholders can help build trust and loyalty among consumers.
|
||||
### Potential Cost-Saving Strategies for Nike to Increase Net Revenue in Q3 2024
|
||||
|
||||
1. **Supply Chain Optimization**: Streamlining the supply chain, reducing transportation costs, and improving inventory management can lead to significant cost savings for Nike.
|
||||
|
||||
2. **Operational Efficiency**: Implementing lean manufacturing practices, reducing waste, and optimizing production processes can help lower production costs and improve overall efficiency.
|
||||
|
||||
3. **Outsourcing Non-Core Functions**: Outsourcing non-core functions such as IT services, customer support, or logistics can help reduce overhead costs and focus resources on core business activities.
|
||||
|
||||
4. **Energy Efficiency**: Investing in energy-efficient technologies, renewable energy sources, and sustainable practices can lower utility costs and demonstrate a commitment to environmental responsibility.
|
||||
|
||||
5. **Negotiating Supplier Contracts**: Negotiating better terms with suppliers, leveraging economies of scale, and exploring alternative sourcing options can help lower procurement costs and improve margins.
|
||||
|
||||
By implementing these cost-saving strategies, Nike can improve its bottom line and increase net revenue in Q3 2024.
|
||||
### Projected Market Trends for the Sports Apparel Industry in 2024
|
||||
|
||||
1. **Sustainable Fashion**: Consumers are increasingly demanding eco-friendly and sustainable products, leading to a rise in sustainable sportswear options in the market.
|
||||
|
||||
2. **Digital Transformation**: The sports apparel industry is expected to continue its shift towards digital platforms, with a focus on e-commerce, personalized shopping experiences, and digital marketing strategies.
|
||||
|
||||
3. **Athleisure Wear**: The trend of athleisure wear, which combines athletic and leisure clothing, is projected to remain popular in 2024 as consumers seek comfort and versatility in their apparel choices.
|
||||
|
||||
4. **Innovative Materials**: Advances in technology and material science are likely to drive the development of innovative fabrics and performance-enhancing materials in sports apparel, catering to the demand for high-quality and functional products.
|
||||
|
||||
5. **Health and Wellness Focus**: With a growing emphasis on health and wellness, sports apparel brands are expected to incorporate features that promote comfort, performance, and overall well-being in their products.
|
||||
|
||||
Overall, the sports apparel industry in 2024 is anticipated to be characterized by sustainability, digitalization, innovation, and a focus on consumer health and lifestyle trends.
|
||||
### Current Successful Strategies Used by Nike's Competitors
|
||||
|
||||
1. **Adidas**: Adidas has been successful in leveraging collaborations with celebrities and designers to create limited-edition collections that generate hype and drive sales. They have also focused on sustainability initiatives, such as using recycled materials in their products, to appeal to environmentally conscious consumers.
|
||||
|
||||
2. **Under Armour**: Under Armour has differentiated itself by targeting performance-driven athletes and emphasizing technological innovation in their products. They have also invested heavily in digital marketing and e-commerce to reach a wider audience and enhance the customer shopping experience.
|
||||
|
||||
3. **Puma**: Puma has successfully capitalized on the athleisure trend by offering stylish and versatile sportswear that can be worn both in and out of the gym. They have also focused on building partnerships with influencers and sponsoring high-profile athletes to increase brand visibility and credibility.
|
||||
|
||||
4. **Lululemon**: Lululemon has excelled in creating a strong community around its brand, hosting events, classes, and collaborations to engage with customers beyond just selling products. They have also prioritized customer experience by offering personalized services and creating a seamless omnichannel shopping experience.
|
||||
|
||||
5. **New Balance**: New Balance has carved out a niche in the market by emphasizing quality craftsmanship, heritage, and authenticity in their products. They have also focused on customization and personalization options for customers, allowing them to create unique and tailored footwear and apparel.
|
||||
|
||||
Overall, Nike's competitors have found success through a combination of innovative product offerings, strategic marketing initiatives, and a focus on customer engagement and experience.
|
||||
### Current and Projected Economic Conditions in Nike's Major Markets
|
||||
|
||||
1. **United States**: The United States, being one of Nike's largest markets, is currently experiencing moderate economic growth driven by consumer spending, low unemployment rates, and a rebound in manufacturing. However, uncertainties surrounding trade policies, inflation, and interest rates could impact consumer confidence and spending in the near future.
|
||||
|
||||
2. **China**: China remains a key market for Nike, with a growing middle class and increasing demand for sportswear and athletic footwear. Despite recent trade tensions with the U.S., China's economy is projected to continue expanding, driven by domestic consumption, infrastructure investments, and technological advancements.
|
||||
|
||||
3. **Europe**: Economic conditions in Europe vary across countries, with some experiencing sluggish growth due to Brexit uncertainties, political instability, and trade tensions. However, overall consumer confidence is improving, and the sports apparel market is expected to grow, driven by e-commerce and sustainability trends.
|
||||
|
||||
4. **Emerging Markets**: Nike's presence in emerging markets such as India, Brazil, and Southeast Asia provides opportunities for growth, given the rising disposable incomes, urbanization, and increasing focus on health and fitness. However, challenges such as currency fluctuations, regulatory changes, and competition from local brands could impact Nike's performance in these markets.
|
||||
|
||||
Overall, Nike's major markets exhibit a mix of opportunities and challenges, with economic conditions influenced by global trends, geopolitical factors, and consumer preferences."
|
||||
### Current Consumer Preferences in the Sports Apparel Industry
|
||||
|
||||
1. **Sustainability**: Consumers are increasingly seeking eco-friendly and sustainable options in sports apparel, driving brands to focus on using recycled materials, reducing waste, and promoting ethical practices.
|
||||
|
||||
2. **Athleisure**: The trend of athleisure wear continues to be popular, with consumers looking for versatile and comfortable clothing that can be worn both during workouts and in everyday life.
|
||||
|
||||
3. **Performance and Functionality**: Consumers prioritize performance-enhancing features in sports apparel, such as moisture-wicking fabrics, breathable materials, and ergonomic designs that enhance comfort and mobility.
|
||||
|
||||
4. **Personalization**: Customization options, personalized fit, and unique design elements are appealing to consumers who seek individuality and exclusivity in their sports apparel choices.
|
||||
|
||||
5. **Brand Transparency**: Consumers value transparency in brand practices, including supply chain transparency, ethical sourcing, and clear communication on product quality and manufacturing processes.
|
||||
|
||||
Overall, consumer preferences in the sports apparel industry are shifting towards sustainability, versatility, performance, personalization, and transparency, influencing brand strategies and product offerings.
|
||||
### Potential New Markets for Nike to Explore in 2024
|
||||
|
||||
1. **India**: With a growing population, increasing disposable incomes, and a rising interest in health and fitness, India presents a significant opportunity for Nike to expand its presence and tap into a large consumer base.
|
||||
|
||||
2. **Africa**: The African market, particularly countries with emerging economies and a young population, offers potential for Nike to introduce its products and capitalize on the growing demand for sportswear and athletic footwear.
|
||||
|
||||
3. **Middle East**: Countries in the Middle East, known for their luxury shopping destinations and a growing interest in sports and fitness activities, could be strategic markets for Nike to target and establish a strong foothold.
|
||||
|
||||
4. **Latin America**: Markets in Latin America, such as Brazil, Mexico, and Argentina, present opportunities for Nike to cater to a diverse consumer base and leverage the region's passion for sports and active lifestyles.
|
||||
|
||||
5. **Southeast Asia**: Rapid urbanization, increasing urban middle-class population, and a trend towards health and wellness in countries like Indonesia, Thailand, and Vietnam make Southeast Asia an attractive region for Nike to explore and expand its market reach.
|
||||
|
||||
By exploring these new markets in 2024, Nike can diversify its geographical presence, reach untapped consumer segments, and drive growth in emerging economies.
|
||||
### Potential New Products or Services Nike Could Introduce in 2024
|
||||
|
||||
1. **Smart Apparel**: Nike could explore the integration of technology into its apparel, such as smart fabrics that monitor performance metrics, provide feedback, or enhance comfort during workouts.
|
||||
|
||||
2. **Athletic Accessories**: Introducing a line of athletic accessories like gym bags, water bottles, or fitness trackers could complement Nike's existing product offerings and provide additional value to customers.
|
||||
|
||||
3. **Customization Platforms**: Offering personalized design options for footwear and apparel through online customization platforms could appeal to consumers seeking unique and tailored products.
|
||||
|
||||
4. **Athletic Recovery Gear**: Developing recovery-focused products like compression wear, recovery sandals, or massage tools could cater to athletes and fitness enthusiasts looking to enhance post-workout recovery.
|
||||
|
||||
5. **Sustainable Collections**: Launching sustainable collections made from eco-friendly materials, recycled fabrics, or biodegradable components could align with consumer preferences for environmentally conscious products.
|
||||
|
||||
By introducing these new products or services in 2024, Nike can innovate its product portfolio, cater to evolving consumer needs, and differentiate itself in the competitive sports apparel market.
|
||||
### Potential Marketing Strategies for Nike to Increase Revenue in Q3 2024
|
||||
|
||||
1. **Influencer Partnerships**: Collaborating with popular athletes, celebrities, or social media influencers to promote Nike products can help reach a wider audience and drive sales.
|
||||
|
||||
2. **Interactive Campaigns**: Launching interactive marketing campaigns, contests, or events that engage customers and create buzz around new product releases can generate excitement and increase brand visibility.
|
||||
|
||||
3. **Social Media Engagement**: Leveraging social media platforms to connect with consumers, share user-generated content, and respond to feedback can build brand loyalty and encourage repeat purchases.
|
||||
|
||||
4. **Localized Marketing**: Tailoring marketing messages, promotions, and product offerings to specific regions or target demographics can enhance relevance and appeal to diverse consumer groups.
|
||||
|
||||
5. **Customer Loyalty Programs**: Implementing loyalty programs, exclusive offers, or rewards for repeat customers can incentivize brand loyalty, increase retention rates, and drive higher lifetime customer value.
|
||||
|
||||
By employing these marketing strategies in Q3 2024, Nike can enhance its brand presence, attract new customers, and ultimately boost revenue growth.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
## **Applications of Swarms: Revolutionizing Customer Support**
|
||||
|
||||
---
|
||||
|
||||
**Introduction**:
|
||||
In today's fast-paced digital world, responsive and efficient customer support is a linchpin for business success. The introduction of AI-driven swarms in the customer support domain can transform the way businesses interact with and assist their customers. By leveraging the combined power of multiple AI agents working in concert, businesses can achieve unprecedented levels of efficiency, customer satisfaction, and operational cost savings.
|
||||
|
||||
---
|
||||
|
||||
### **The Benefits of Using Swarms for Customer Support:**
|
||||
|
||||
1. **24/7 Availability**: Swarms never sleep. Customers receive instantaneous support at any hour, ensuring constant satisfaction and loyalty.
|
||||
|
||||
2. **Infinite Scalability**: Whether it's ten inquiries or ten thousand, swarms can handle fluctuating volumes with ease, eliminating the need for vast human teams and minimizing response times.
|
||||
|
||||
3. **Adaptive Intelligence**: Swarms learn collectively, meaning that a solution found for one customer can be instantly applied to benefit all. This leads to constantly improving support experiences, evolving with every interaction.
|
||||
|
||||
---
|
||||
|
||||
### **Features - Reinventing Customer Support**:
|
||||
|
||||
- **AI Inbox Monitor**: Continuously scans email inboxes, identifying and categorizing support requests for swift responses.
|
||||
|
||||
- **Intelligent Debugging**: Proactively helps customers by diagnosing and troubleshooting underlying issues.
|
||||
|
||||
- **Automated Refunds & Coupons**: Seamless integration with payment systems like Stripe allows for instant issuance of refunds or coupons if a problem remains unresolved.
|
||||
|
||||
- **Full System Integration**: Holistically connects with CRM, email systems, and payment portals, ensuring a cohesive and unified support experience.
|
||||
|
||||
- **Conversational Excellence**: With advanced LLMs (Language Model Transformers), the swarm agents can engage in natural, human-like conversations, enhancing customer comfort and trust.
|
||||
|
||||
- **Rule-based Operation**: By working with rule engines, swarms ensure that all actions adhere to company guidelines, ensuring consistent, error-free support.
|
||||
|
||||
- **Turing Test Ready**: Crafted to meet and exceed the Turing Test standards, ensuring that every customer interaction feels genuine and personal.
|
||||
|
||||
---
|
||||
|
||||
**Conclusion**:
|
||||
Swarms are not just another technological advancement; they represent the future of customer support. Their ability to provide round-the-clock, scalable, and continuously improving support can redefine customer experience standards. By adopting swarms, businesses can stay ahead of the curve, ensuring unparalleled customer loyalty and satisfaction.
|
||||
|
||||
**Experience the future of customer support. Dive into the swarm revolution.**
|
||||
|
@ -0,0 +1,105 @@
|
||||
## Usage Documentation: Discord Bot with Advanced Features
|
||||
|
||||
---
|
||||
|
||||
### Overview:
|
||||
|
||||
This code provides a structure for a Discord bot with advanced features such as voice channel interactions, image generation, and text-based interactions using OpenAI models.
|
||||
|
||||
---
|
||||
|
||||
### Setup:
|
||||
|
||||
1. Ensure that the necessary libraries are installed:
|
||||
```bash
|
||||
pip install discord.py python-dotenv dalle3 invoke openai
|
||||
```
|
||||
|
||||
2. Create a `.env` file in the same directory as your bot script and add the following:
|
||||
```
|
||||
DISCORD_TOKEN=your_discord_bot_token
|
||||
STORAGE_SERVICE=your_storage_service_endpoint
|
||||
SAVE_DIRECTORY=path_to_save_generated_images
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Bot Class and its Methods:
|
||||
|
||||
#### `__init__(self, agent, llm, command_prefix="!")`:
|
||||
|
||||
Initializes the bot with the given agent, language model (`llm`), and a command prefix (default is `!`).
|
||||
|
||||
#### `add_command(self, name, func)`:
|
||||
|
||||
Allows you to dynamically add new commands to the bot. The `name` is the command's name and `func` is the function to execute when the command is called.
|
||||
|
||||
#### `run(self)`:
|
||||
|
||||
Starts the bot using the `DISCORD_TOKEN` from the `.env` file.
|
||||
|
||||
---
|
||||
|
||||
### Commands:
|
||||
|
||||
1. **!greet**: Greets the user.
|
||||
|
||||
2. **!help_me**: Provides a list of commands and their descriptions.
|
||||
|
||||
3. **!join**: Joins the voice channel the user is in.
|
||||
|
||||
4. **!leave**: Leaves the voice channel the bot is currently in.
|
||||
|
||||
5. **!listen**: Starts listening to voice in the current voice channel and records the audio.
|
||||
|
||||
6. **!generate_image [prompt]**: Generates images based on the provided prompt using the DALL-E3 model.
|
||||
|
||||
7. **!send_text [text] [use_agent=True]**: Sends the provided text to the worker (either the agent or the LLM) and returns the response.
|
||||
|
||||
---
|
||||
|
||||
### Usage:
|
||||
|
||||
Initialize the `llm` (Language Learning Model) with your OpenAI API key:
|
||||
|
||||
```python
|
||||
from swarms.models import OpenAIChat
|
||||
|
||||
llm = OpenAIChat(
|
||||
openai_api_key="Your_OpenAI_API_Key",
|
||||
temperature=0.5,
|
||||
)
|
||||
```
|
||||
|
||||
Initialize the bot with the `llm`:
|
||||
|
||||
```python
|
||||
from apps.discord import Bot
|
||||
|
||||
bot = Bot(llm=llm)
|
||||
```
|
||||
|
||||
Send a task to the bot:
|
||||
|
||||
```python
|
||||
task = "What were the winning Boston Marathon times for the past 5 years (ending in 2022)? Generate a table of the year, name, country of origin, and times."
|
||||
bot.send_text(task)
|
||||
```
|
||||
|
||||
Start the bot:
|
||||
|
||||
```python
|
||||
bot.run()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Additional Notes:
|
||||
|
||||
- The bot makes use of the `dalle3` library for image generation. Ensure you have the model and necessary setup for it.
|
||||
|
||||
- For the storage service, you might want to integrate with a cloud service like Google Cloud Storage or AWS S3 to store and retrieve generated images. The given code assumes a method `.upload()` for the storage service to upload files.
|
||||
|
||||
- Ensure that you've granted the bot necessary permissions on Discord, especially if you want to use voice channel features.
|
||||
|
||||
- Handle API keys and tokens securely. Avoid hardcoding them directly into your code. Use environment variables or secure secret management tools.
|
@ -0,0 +1,18 @@
|
||||
|
||||
/* Further customization as needed */
|
||||
|
||||
|
||||
.md-typeset__table {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.md-typeset table:not([class]) {
|
||||
display: table;
|
||||
}
|
||||
|
||||
/*
|
||||
:root {
|
||||
--md-primary-fg-color: #EE0F0F;
|
||||
--md-primary-fg-color--light: #ECB7B7;
|
||||
--md-primary-fg-color--dark: #90030C;
|
||||
} */
|
After Width: | Height: | Size: 200 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 390 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 283 KiB |
After Width: | Height: | Size: 184 KiB |
After Width: | Height: | Size: 235 KiB |
After Width: | Height: | Size: 148 KiB |
@ -0,0 +1,123 @@
|
||||
# Contributing
|
||||
|
||||
Thank you for your interest in contributing to Swarms! We welcome contributions from the community to help improve usability and readability. By contributing, you can be a part of creating a dynamic and interactive AI system.
|
||||
|
||||
To get started, please follow the guidelines below.
|
||||
|
||||
|
||||
## Optimization Priorities
|
||||
|
||||
To continuously improve Swarms, we prioritize the following design objectives:
|
||||
|
||||
1. **Usability**: Increase the ease of use and user-friendliness of the swarm system to facilitate adoption and interaction with basic input.
|
||||
|
||||
2. **Reliability**: Improve the swarm's ability to obtain the desired output even with basic and un-detailed input.
|
||||
|
||||
3. **Speed**: Reduce the time it takes for the swarm to accomplish tasks by improving the communication layer, critiquing, and self-alignment with meta prompting.
|
||||
|
||||
4. **Scalability**: Ensure that the system is asynchronous, concurrent, and self-healing to support scalability.
|
||||
|
||||
Our goal is to continuously improve Swarms by following this roadmap while also being adaptable to new needs and opportunities as they arise.
|
||||
|
||||
## Join the Swarms Community
|
||||
|
||||
Join the Swarms community on Discord to connect with other contributors, coordinate work, and receive support.
|
||||
|
||||
- [Join the Swarms Discord Server](https://discord.gg/qUtxnK2NMf)
|
||||
|
||||
|
||||
## Report and Issue
|
||||
The easiest way to contribute to our docs is through our public [issue tracker](https://github.com/kyegomez/swarms-docs/issues). Feel free to submit bugs, request features or changes, or contribute to the project directly.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Swarms docs are built using [MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/).
|
||||
|
||||
To directly contribute to Swarms documentation, first fork the [swarms-docs](https://github.com/kyegomez/swarms-docs) repository to your GitHub account. Then clone your repository to your local machine.
|
||||
|
||||
From inside the directory run:
|
||||
|
||||
```pip install -r requirements.txt```
|
||||
|
||||
To run `swarms-docs` locally run:
|
||||
|
||||
```mkdocs serve```
|
||||
|
||||
You should see something similar to the following:
|
||||
|
||||
```
|
||||
INFO - Building documentation...
|
||||
INFO - Cleaning site directory
|
||||
INFO - Documentation built in 0.19 seconds
|
||||
INFO - [09:28:33] Watching paths for changes: 'docs', 'mkdocs.yml'
|
||||
INFO - [09:28:33] Serving on http://127.0.0.1:8000/
|
||||
INFO - [09:28:37] Browser connected: http://127.0.0.1:8000/
|
||||
```
|
||||
|
||||
Follow the typical PR process to contribute changes.
|
||||
|
||||
* Create a feature branch.
|
||||
* Commit changes.
|
||||
* Submit a PR.
|
||||
|
||||
|
||||
-------
|
||||
---
|
||||
|
||||
## Taking on Tasks
|
||||
|
||||
We have a growing list of tasks and issues that you can contribute to. To get started, follow these steps:
|
||||
|
||||
1. Visit the [Swarms GitHub repository](https://github.com/kyegomez/swarms) and browse through the existing issues.
|
||||
|
||||
2. Find an issue that interests you and make a comment stating that you would like to work on it. Include a brief description of how you plan to solve the problem and any questions you may have.
|
||||
|
||||
3. Once a project coordinator assigns the issue to you, you can start working on it.
|
||||
|
||||
If you come across an issue that is unclear but still interests you, please post in the Discord server mentioned above. Someone from the community will be able to help clarify the issue in more detail.
|
||||
|
||||
We also welcome contributions to documentation, such as updating markdown files, adding docstrings, creating system architecture diagrams, and other related tasks.
|
||||
|
||||
## Submitting Your Work
|
||||
|
||||
To contribute your changes to Swarms, please follow these steps:
|
||||
|
||||
1. Fork the Swarms repository to your GitHub account. You can do this by clicking on the "Fork" button on the repository page.
|
||||
|
||||
2. Clone the forked repository to your local machine using the `git clone` command.
|
||||
|
||||
3. Before making any changes, make sure to sync your forked repository with the original repository to keep it up to date. You can do this by following the instructions [here](https://docs.github.com/en/github/collaborating-with-pull-requests/syncing-a-fork).
|
||||
|
||||
4. Create a new branch for your changes. This branch should have a descriptive name that reflects the task or issue you are working on.
|
||||
|
||||
5. Make your changes in the branch, focusing on a small, focused change that only affects a few files.
|
||||
|
||||
6. Run any necessary formatting or linting tools to ensure that your changes adhere to the project's coding standards.
|
||||
|
||||
7. Once your changes are ready, commit them to your branch with descriptive commit messages.
|
||||
|
||||
8. Push the branch to your forked repository.
|
||||
|
||||
9. Create a pull request (PR) from your branch to the main Swarms repository. Provide a clear and concise description of your changes in the PR.
|
||||
|
||||
10. Request a review from the project maintainers. They will review your changes, provide feedback, and suggest any necessary improvements.
|
||||
|
||||
11. Make any required updates or address any feedback provided during the review process.
|
||||
|
||||
12. Once your changes have been reviewed and approved, they will be merged into the main branch of the Swarms repository.
|
||||
|
||||
13. Congratulations! You have successfully contributed to Swarms.
|
||||
|
||||
Please note that during the review process, you may be asked to make changes or address certain issues. It is important to engage in open and constructive communication with the project maintainers to ensure the quality of your contributions.
|
||||
|
||||
## Developer Setup
|
||||
|
||||
If you are interested in setting up the Swarms development environment, please follow the instructions provided in the [developer setup guide](docs/developer-setup.md). This guide provides an overview of the different tools and technologies used in the project.
|
||||
|
||||
## Join the Agora Community
|
||||
|
||||
Swarms is brought to you by Agora, the open-source AI research organization. Join the Agora community to connect with other researchers and developers working on AI projects.
|
||||
|
||||
- [Join the Agora Discord Server](https://discord.gg/qUtxnK2NMf)
|
||||
|
||||
Thank you for your contributions and for being a part of the Swarms and Agora community! Together, we can advance Humanity through the power of AI.
|
@ -0,0 +1,254 @@
|
||||
### Understanding Agent Evaluation Mechanisms
|
||||
|
||||
Agent evaluation mechanisms play a crucial role in ensuring that autonomous agents, particularly in multi-agent systems, perform their tasks effectively and efficiently. This blog delves into the intricacies of agent evaluation, the importance of accuracy tracking, and the methodologies used to measure and visualize agent performance. We'll use Mermaid graphs to provide clear visual representations of these processes.
|
||||
|
||||
#### 1. Introduction to Agent Evaluation Mechanisms
|
||||
|
||||
Agent evaluation mechanisms refer to the processes and criteria used to assess the performance of agents within a system. These mechanisms are essential for:
|
||||
|
||||
- **Ensuring Reliability:** Agents must consistently perform their designated tasks correctly.
|
||||
- **Improving Performance:** Evaluation helps in identifying areas where agents can improve.
|
||||
- **Maintaining Accountability:** It provides a way to hold agents accountable for their actions.
|
||||
|
||||
### 2. Key Components of Agent Evaluation
|
||||
|
||||
To effectively evaluate agents, several components and metrics are considered:
|
||||
|
||||
#### a. Performance Metrics
|
||||
|
||||
These are quantitative measures used to assess how well an agent is performing. Common performance metrics include:
|
||||
|
||||
- **Accuracy:** The percentage of correct actions or decisions made by the agent.
|
||||
- **Precision and Recall:** Precision measures the number of true positive results divided by the number of all positive results, while recall measures the number of true positive results divided by the number of positives that should have been retrieved.
|
||||
- **F1 Score:** The harmonic mean of precision and recall.
|
||||
- **Response Time:** How quickly an agent responds to a given task or query.
|
||||
|
||||
#### b. Evaluation Criteria
|
||||
|
||||
Evaluation criteria define the standards or benchmarks against which agent performance is measured. These criteria are often task-specific and may include:
|
||||
|
||||
- **Task Completion Rate:** The percentage of tasks successfully completed by the agent.
|
||||
- **Error Rate:** The frequency of errors made by the agent during task execution.
|
||||
- **Resource Utilization:** How efficiently an agent uses resources such as memory and CPU.
|
||||
|
||||
### 3. The Process of Agent Evaluation
|
||||
|
||||
The evaluation process involves several steps, which can be visualized using Mermaid graphs:
|
||||
|
||||
#### a. Define Evaluation Metrics
|
||||
|
||||
The first step is to define the metrics that will be used to evaluate the agent. This involves identifying the key performance indicators (KPIs) relevant to the agent's tasks.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Define Evaluation Metrics] --> B[Identify KPIs]
|
||||
B --> C[Accuracy]
|
||||
B --> D[Precision and Recall]
|
||||
B --> E[F1 Score]
|
||||
B --> F[Response Time]
|
||||
```
|
||||
|
||||
#### b. Collect Data
|
||||
|
||||
Data collection involves gathering information on the agent's performance. This data can come from logs, user feedback, or direct observations.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Collect Data] --> B[Logs]
|
||||
A --> C[User Feedback]
|
||||
A --> D[Direct Observations]
|
||||
```
|
||||
|
||||
#### c. Analyze Performance
|
||||
|
||||
Once data is collected, it is analyzed to assess the agent's performance against the defined metrics. This step may involve statistical analysis, machine learning models, or other analytical techniques.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Analyze Performance] --> B[Statistical Analysis]
|
||||
A --> C[Machine Learning Models]
|
||||
A --> D[Other Analytical Techniques]
|
||||
```
|
||||
|
||||
#### d. Generate Reports
|
||||
|
||||
After analysis, performance reports are generated. These reports provide insights into how well the agent is performing and identify areas for improvement.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Generate Reports] --> B[Performance Insights]
|
||||
B --> C[Identify Areas for Improvement]
|
||||
```
|
||||
|
||||
### 4. Tracking Agent Accuracy
|
||||
|
||||
Accuracy tracking is a critical aspect of agent evaluation. It involves measuring how often an agent's actions or decisions are correct. The following steps outline the process of tracking agent accuracy:
|
||||
|
||||
#### a. Define Correctness Criteria
|
||||
|
||||
The first step is to define what constitutes a correct action or decision for the agent.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Define Correctness Criteria] --> B[Task-Specific Standards]
|
||||
B --> C[Action Accuracy]
|
||||
B --> D[Decision Accuracy]
|
||||
```
|
||||
|
||||
#### b. Monitor Agent Actions
|
||||
|
||||
Agents' actions are continuously monitored to track their performance. This monitoring can be done in real-time or through periodic evaluations.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Monitor Agent Actions] --> B[Real-Time Monitoring]
|
||||
A --> C[Periodic Evaluations]
|
||||
```
|
||||
|
||||
#### c. Compare Against Correctness Criteria
|
||||
|
||||
Each action or decision made by the agent is compared against the defined correctness criteria to determine its accuracy.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Compare Against Correctness Criteria] --> B[Evaluate Each Action]
|
||||
B --> C[Correct or Incorrect?]
|
||||
```
|
||||
|
||||
#### d. Calculate Accuracy Metrics
|
||||
|
||||
Accuracy metrics are calculated based on the comparison results. These metrics provide a quantitative measure of the agent's accuracy.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Calculate Accuracy Metrics] --> B[Accuracy Percentage]
|
||||
A --> C[Error Rate]
|
||||
```
|
||||
|
||||
### 5. Measuring Agent Accuracy
|
||||
|
||||
Measuring agent accuracy involves several steps and considerations:
|
||||
|
||||
#### a. Data Labeling
|
||||
|
||||
To measure accuracy, the data used for evaluation must be accurately labeled. This involves annotating the data with the correct actions or decisions.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Data Labeling] --> B[Annotate Data with Correct Actions]
|
||||
B --> C[Ensure Accuracy of Labels]
|
||||
```
|
||||
|
||||
#### b. Establish Baseline Performance
|
||||
|
||||
A baseline performance level is established by evaluating a sample set of data. This baseline serves as a reference point for measuring improvements or declines in accuracy.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Establish Baseline Performance] --> B[Evaluate Sample Data]
|
||||
B --> C[Set Performance Benchmarks]
|
||||
```
|
||||
|
||||
#### c. Regular Evaluations
|
||||
|
||||
Agents are regularly evaluated to measure their accuracy over time. This helps in tracking performance trends and identifying any deviations from the expected behavior.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Regular Evaluations] --> B[Track Performance Over Time]
|
||||
B --> C[Identify Performance Trends]
|
||||
B --> D[Detect Deviations]
|
||||
```
|
||||
|
||||
#### d. Feedback and Improvement
|
||||
|
||||
Feedback from evaluations is used to improve the agent's performance. This may involve retraining the agent, adjusting its algorithms, or refining its decision-making processes.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Feedback and Improvement] --> B[Use Evaluation Feedback]
|
||||
B --> C[Retrain Agent]
|
||||
B --> D[Adjust Algorithms]
|
||||
B --> E[Refine Decision-Making Processes]
|
||||
```
|
||||
|
||||
### 6. Visualizing Agent Evaluation with Mermaid Graphs
|
||||
|
||||
Mermaid graphs provide a clear and concise way to visualize the agent evaluation process. Here are some examples of how Mermaid graphs can be used:
|
||||
|
||||
#### a. Overall Evaluation Process
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Define Evaluation Metrics] --> B[Collect Data]
|
||||
B --> C[Analyze Performance]
|
||||
C --> D[Generate Reports]
|
||||
```
|
||||
|
||||
#### b. Accuracy Tracking
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Define Correctness Criteria] --> B[Monitor Agent Actions]
|
||||
B --> C[Compare Against Correctness Criteria]
|
||||
C --> D[Calculate Accuracy Metrics]
|
||||
```
|
||||
|
||||
#### c. Continuous Improvement Cycle
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Regular Evaluations] --> B[Track Performance Over Time]
|
||||
B --> C[Identify Performance Trends]
|
||||
C --> D[Detect Deviations]
|
||||
D --> E[Feedback and Improvement]
|
||||
E --> A
|
||||
```
|
||||
|
||||
### 7. Case Study: Evaluating a Chatbot Agent
|
||||
|
||||
To illustrate the agent evaluation process, let's consider a case study involving a chatbot agent designed to assist customers in an e-commerce platform.
|
||||
|
||||
#### a. Define Evaluation Metrics
|
||||
|
||||
For the chatbot, key performance metrics might include:
|
||||
|
||||
- **Response Accuracy:** The percentage of correct responses provided by the chatbot.
|
||||
- **Response Time:** The average time taken by the chatbot to respond to user queries.
|
||||
- **Customer Satisfaction:** Measured through user feedback and ratings.
|
||||
|
||||
#### b. Collect Data
|
||||
|
||||
Data is collected from chatbot interactions, including user queries, responses, and feedback.
|
||||
|
||||
#### c. Analyze Performance
|
||||
|
||||
Performance analysis involves comparing the chatbot's responses against a predefined set of correct responses and calculating accuracy metrics.
|
||||
|
||||
#### d. Generate Reports
|
||||
|
||||
Reports are generated to provide insights into the chatbot's performance, highlighting areas where it excels and areas needing improvement.
|
||||
|
||||
### 8. Best Practices for Agent Evaluation
|
||||
|
||||
Here are some best practices to ensure effective agent evaluation:
|
||||
|
||||
#### a. Use Realistic Scenarios
|
||||
|
||||
Evaluate agents in realistic scenarios that closely mimic real-world conditions. This ensures that the evaluation results are relevant and applicable.
|
||||
|
||||
#### b. Continuous Monitoring
|
||||
|
||||
Continuously monitor agent performance to detect and address issues promptly. This helps in maintaining high performance levels.
|
||||
|
||||
#### c. Incorporate User Feedback
|
||||
|
||||
User feedback is invaluable for improving agent performance. Incorporate feedback into the evaluation process to identify and rectify shortcomings.
|
||||
|
||||
#### d. Regular Updates
|
||||
|
||||
Regularly update the evaluation metrics and criteria to keep pace with evolving tasks and requirements.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Agent evaluation mechanisms are vital for ensuring the reliability, efficiency, and effectiveness of autonomous agents. By defining clear evaluation metrics, continuously monitoring performance, and using feedback for improvement, we can develop agents that consistently perform at high levels. Visualizing the evaluation process with tools like Mermaid graphs further aids in understanding and communication. Through diligent evaluation and continuous improvement, we can harness the full potential of autonomous agents in various applications.
|
@ -0,0 +1,868 @@
|
||||
# Comparing LLM Provider Pricing: A Guide for Enterprises
|
||||
|
||||
Large language models (LLMs) have become a cornerstone of innovation for enterprises across various industries.
|
||||
|
||||
As executives contemplate which model to integrate into their operations, understanding the intricacies of LLM provider pricing is crucial.
|
||||
|
||||
This comprehensive guide delves into the tactical business considerations, unit economics, profit margins, and ROI calculations that will empower decision-makers to deploy the right AI solution for their organization.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Introduction to LLM Pricing Models](#introduction-to-llm-pricing-models)
|
||||
2. [Understanding Unit Economics in LLM Deployment](#understanding-unit-economics-in-llm-deployment)
|
||||
3. [Profit Margins and Cost Structures](#profit-margins-and-cost-structures)
|
||||
4. [LLM Pricing in Action: Case Studies](#llm-pricing-in-action-case-studies)
|
||||
5. [Calculating ROI for LLM Integration](#calculating-roi-for-llm-integration)
|
||||
6. [Comparative Analysis of Major LLM Providers](#comparative-analysis-of-major-llm-providers)
|
||||
7. [Hidden Costs and Considerations](#hidden-costs-and-considerations)
|
||||
8. [Optimizing LLM Usage for Cost-Efficiency](#optimizing-llm-usage-for-cost-efficiency)
|
||||
9. [Future Trends in LLM Pricing](#future-trends-in-llm-pricing)
|
||||
10. [Strategic Decision-Making Framework](#strategic-decision-making-framework)
|
||||
11. [Conclusion: Navigating the LLM Pricing Landscape](#conclusion-navigating-the-llm-pricing-landscape)
|
||||
|
||||
## 1. Introduction to LLM Pricing Models
|
||||
|
||||
The pricing of Large Language Models (LLMs) is a complex landscape that can significantly impact an enterprise's bottom line. As we dive into this topic, it's crucial to understand the various pricing models employed by LLM providers and how they align with different business needs.
|
||||
|
||||
### Pay-per-Token Model
|
||||
|
||||
The most common pricing structure in the LLM market is the pay-per-token model. In this system, businesses are charged based on the number of tokens processed by the model. A token can be as short as one character or as long as one word, depending on the language and the specific tokenization method used by the model.
|
||||
|
||||
**Advantages:**
|
||||
- Scalability: Costs scale directly with usage, allowing for flexibility as demand fluctuates.
|
||||
- Transparency: Easy to track and attribute costs to specific projects or departments.
|
||||
|
||||
**Disadvantages:**
|
||||
- Unpredictability: Costs can vary significantly based on the verbosity of inputs and outputs.
|
||||
- Potential for overruns: Without proper monitoring, costs can quickly escalate.
|
||||
|
||||
### Subscription-Based Models
|
||||
|
||||
Some providers offer subscription tiers that provide a set amount of compute resources or tokens for a fixed monthly or annual fee.
|
||||
|
||||
**Advantages:**
|
||||
- Predictable costs: Easier budgeting and financial planning.
|
||||
- Potential cost savings: Can be more economical for consistent, high-volume usage.
|
||||
|
||||
**Disadvantages:**
|
||||
- Less flexibility: May lead to underutilization or overages.
|
||||
- Commitment required: Often involves longer-term contracts.
|
||||
|
||||
### Custom Enterprise Agreements
|
||||
|
||||
For large-scale deployments, providers may offer custom pricing agreements tailored to the specific needs of an enterprise.
|
||||
|
||||
**Advantages:**
|
||||
- Optimized for specific use cases: Can include specialized support, SLAs, and pricing structures.
|
||||
- Potential for significant cost savings at scale.
|
||||
|
||||
**Disadvantages:**
|
||||
- Complexity: Negotiating and managing these agreements can be resource-intensive.
|
||||
- Less standardization: Difficult to compare across providers.
|
||||
|
||||
### Hybrid Models
|
||||
|
||||
Some providers are beginning to offer hybrid models that combine elements of pay-per-token and subscription-based pricing.
|
||||
|
||||
**Advantages:**
|
||||
- Flexibility: Can adapt to varying usage patterns.
|
||||
- Risk mitigation: Balances the benefits of both main pricing models.
|
||||
|
||||
**Disadvantages:**
|
||||
- Complexity: Can be more challenging to understand and manage.
|
||||
- Potential for suboptimal pricing if not carefully structured.
|
||||
|
||||
As we progress through this guide, we'll explore how these pricing models interact with various business considerations and how executives can leverage this understanding to make informed decisions.
|
||||
|
||||
## 2. Understanding Unit Economics in LLM Deployment
|
||||
|
||||
To make informed decisions about LLM deployment, executives must have a clear grasp of the unit economics involved. This section breaks down the components that contribute to the cost per unit of LLM usage and how they impact overall business economics.
|
||||
|
||||
### Defining the Unit
|
||||
|
||||
In the context of LLMs, a "unit" can be defined in several ways:
|
||||
|
||||
1. **Per Token**: The most granular unit, often used in pricing models.
|
||||
2. **Per Request**: A single API call to the LLM, which may process multiple tokens.
|
||||
3. **Per Task**: A complete operation, such as generating a summary or answering a question, which may involve multiple requests.
|
||||
4. **Per User Interaction**: In customer-facing applications, this could be an entire conversation or session.
|
||||
|
||||
Understanding which unit is most relevant to your use case is crucial for accurate economic analysis.
|
||||
|
||||
### Components of Unit Cost
|
||||
|
||||
1. **Direct LLM Costs**
|
||||
- Token processing fees
|
||||
- API call charges
|
||||
- Data transfer costs
|
||||
|
||||
2. **Indirect Costs**
|
||||
- Compute resources for pre/post-processing
|
||||
- Storage for inputs, outputs, and fine-tuning data
|
||||
- Networking costs
|
||||
|
||||
3. **Operational Costs**
|
||||
- Monitoring and management tools
|
||||
- Integration and maintenance engineering time
|
||||
- Customer support related to AI functions
|
||||
|
||||
4. **Overhead**
|
||||
- Legal and compliance costs
|
||||
- Training and documentation
|
||||
- Risk management and insurance
|
||||
|
||||
### Calculating Unit Economics
|
||||
|
||||
To calculate the true unit economics, follow these steps:
|
||||
|
||||
1. **Determine Total Costs**: Sum all direct, indirect, operational, and overhead costs over a fixed period (e.g., monthly).
|
||||
|
||||
2. **Measure Total Units**: Track the total number of relevant units processed in the same period.
|
||||
|
||||
3. **Calculate Cost per Unit**: Divide total costs by total units.
|
||||
|
||||
```
|
||||
Cost per Unit = Total Costs / Total Units
|
||||
```
|
||||
|
||||
4. **Analyze Revenue per Unit**: If the LLM is part of a revenue-generating product, calculate the revenue attributed to each unit.
|
||||
|
||||
5. **Determine Profit per Unit**: Subtract the cost per unit from the revenue per unit.
|
||||
|
||||
```
|
||||
Profit per Unit = Revenue per Unit - Cost per Unit
|
||||
```
|
||||
|
||||
### Example Calculation
|
||||
|
||||
Let's consider a hypothetical customer service AI chatbot:
|
||||
|
||||
- Monthly LLM API costs: $10,000
|
||||
- Indirect and operational costs: $5,000
|
||||
- Total monthly interactions: 100,000
|
||||
|
||||
```
|
||||
Cost per Interaction = ($10,000 + $5,000) / 100,000 = $0.15
|
||||
```
|
||||
|
||||
If each interaction generates an average of $0.50 in value (through cost savings or revenue):
|
||||
|
||||
```
|
||||
Profit per Interaction = $0.50 - $0.15 = $0.35
|
||||
```
|
||||
|
||||
### Economies of Scale
|
||||
|
||||
As usage increases, unit economics often improve due to:
|
||||
|
||||
- Volume discounts from LLM providers
|
||||
- Amortization of fixed costs over more units
|
||||
- Efficiency gains through learning and optimization
|
||||
|
||||
However, it's crucial to model how these economies of scale manifest in your specific use case, as they may plateau or even reverse at very high volumes due to increased complexity and support needs.
|
||||
|
||||
### Diseconomies of Scale
|
||||
|
||||
Conversely, be aware of potential diseconomies of scale:
|
||||
|
||||
- Increased complexity in managing large-scale deployments
|
||||
- Higher costs for specialized talent as operations grow
|
||||
- Potential for diminishing returns on very large language models
|
||||
|
||||
By thoroughly understanding these unit economics, executives can make more informed decisions about which LLM provider and pricing model best aligns with their business objectives and scale.
|
||||
|
||||
## 3. Profit Margins and Cost Structures
|
||||
|
||||
Understanding profit margins and cost structures is crucial for executives evaluating LLM integration. This section explores how different pricing models and operational strategies can impact overall profitability.
|
||||
|
||||
### Components of Profit Margin
|
||||
|
||||
1. **Gross Margin**: The difference between revenue and the direct costs of LLM usage.
|
||||
```
|
||||
Gross Margin = Revenue - Direct LLM Costs
|
||||
Gross Margin % = (Gross Margin / Revenue) * 100
|
||||
```
|
||||
|
||||
2. **Contribution Margin**: Gross margin minus variable operational costs.
|
||||
```
|
||||
Contribution Margin = Gross Margin - Variable Operational Costs
|
||||
```
|
||||
|
||||
3. **Net Margin**: The final profit after all costs, including fixed overheads.
|
||||
```
|
||||
Net Margin = Contribution Margin - Fixed Costs
|
||||
Net Margin % = (Net Margin / Revenue) * 100
|
||||
```
|
||||
|
||||
### Cost Structures in LLM Deployment
|
||||
|
||||
1. **Fixed Costs**
|
||||
- Subscription fees for LLM access (if using a subscription model)
|
||||
- Base infrastructure costs
|
||||
- Core team salaries
|
||||
- Licensing fees for essential software
|
||||
|
||||
2. **Variable Costs**
|
||||
- Per-token or per-request charges
|
||||
- Scaling infrastructure costs
|
||||
- Usage-based API fees
|
||||
- Performance-based team bonuses
|
||||
|
||||
3. **Step Costs**
|
||||
- Costs that increase in chunks as usage scales
|
||||
- Examples: Adding new server clusters, hiring additional support staff
|
||||
|
||||
### Analyzing Profit Margins Across Different Pricing Models
|
||||
|
||||
Let's compare how different LLM pricing models might affect profit margins for a hypothetical AI-powered writing assistant service:
|
||||
|
||||
**Scenario**: The service charges users $20/month and expects to process an average of 100,000 tokens per user per month.
|
||||
|
||||
1. **Pay-per-Token Model**
|
||||
- LLM cost: $0.06 per 1,000 tokens
|
||||
- Monthly LLM cost per user: $6
|
||||
- Gross margin per user: $14 (70%)
|
||||
|
||||
2. **Subscription Model**
|
||||
- Fixed monthly fee: $5,000 for up to 10 million tokens
|
||||
- At 1,000 users: $5 per user
|
||||
- Gross margin per user: $15 (75%)
|
||||
|
||||
3. **Hybrid Model**
|
||||
- Base fee: $2,000 per month
|
||||
- Reduced per-token rate: $0.04 per 1,000 tokens
|
||||
- Monthly LLM cost per user: $6 ($2 base + $4 usage)
|
||||
- Gross margin per user: $14 (70%)
|
||||
|
||||
### Strategies for Improving Profit Margins
|
||||
|
||||
1. **Optimize Token Usage**
|
||||
- Implement efficient prompting techniques
|
||||
- Cache common responses
|
||||
- Use compression algorithms for inputs and outputs
|
||||
|
||||
2. **Leverage Economies of Scale**
|
||||
- Negotiate better rates at higher volumes
|
||||
- Spread fixed costs across a larger user base
|
||||
|
||||
3. **Implement Tiered Pricing**
|
||||
- Offer different service levels to capture more value from power users
|
||||
- Example: Basic ($10/month, 50K tokens), Pro ($30/month, 200K tokens)
|
||||
|
||||
4. **Vertical Integration**
|
||||
- Invest in proprietary LLM development for core functionalities
|
||||
- Reduce dependency on third-party providers for critical operations
|
||||
|
||||
5. **Smart Caching and Pre-computation**
|
||||
- Store and reuse common LLM outputs
|
||||
- Perform batch processing during off-peak hours
|
||||
|
||||
6. **Hybrid Cloud Strategies**
|
||||
- Use on-premises solutions for consistent workloads
|
||||
- Leverage cloud elasticity for demand spikes
|
||||
|
||||
### Case Study: Margin Improvement
|
||||
|
||||
Consider a company that initially used a pay-per-token model:
|
||||
|
||||
**Initial State:**
|
||||
- Revenue per user: $20
|
||||
- LLM cost per user: $6
|
||||
- Other variable costs: $4
|
||||
- Fixed costs per user: $5
|
||||
- Net margin per user: $5 (25%)
|
||||
|
||||
**After Optimization:**
|
||||
- Implemented efficient prompting: Reduced token usage by 20%
|
||||
- Negotiated volume discount: 10% reduction in per-token price
|
||||
- Introduced tiered pricing: Average revenue per user increased to $25
|
||||
- Optimized operations: Reduced other variable costs to $3
|
||||
|
||||
**Result:**
|
||||
- New LLM cost per user: $4.32
|
||||
- New net margin per user: $12.68 (50.7%)
|
||||
|
||||
This case study demonstrates how a holistic approach to margin improvement, addressing both revenue and various cost components, can significantly enhance profitability.
|
||||
|
||||
Understanding these profit margin dynamics and cost structures is essential for executives to make informed decisions about LLM integration and to continuously optimize their AI-powered services for maximum profitability.
|
||||
|
||||
## 4. LLM Pricing in Action: Case Studies
|
||||
|
||||
To provide a concrete understanding of how LLM pricing models work in real-world scenarios, let's examine several case studies across different industries and use cases. These examples will illustrate the interplay between pricing models, usage patterns, and business outcomes.
|
||||
|
||||
### Case Study 1: E-commerce Product Description Generator
|
||||
|
||||
**Company**: GlobalMart, a large online retailer
|
||||
**Use Case**: Automated generation of product descriptions
|
||||
**LLM Provider**: GPT-4o
|
||||
|
||||
**Pricing Model**: Pay-per-token
|
||||
- Input: $5.00 per 1M tokens
|
||||
- Output: $15.00 per 1M tokens
|
||||
|
||||
**Usage Pattern**:
|
||||
- Average input: 50 tokens per product (product attributes)
|
||||
- Average output: 200 tokens per product (generated description)
|
||||
- Daily products processed: 10,000
|
||||
|
||||
**Daily Cost Calculation**:
|
||||
1. Input cost: (50 tokens * 10,000 products) / 1M * $5.00 = $2.50
|
||||
2. Output cost: (200 tokens * 10,000 products) / 1M * $15.00 = $30.00
|
||||
3. Total daily cost: $32.50
|
||||
|
||||
**Business Impact**:
|
||||
- Reduced time to market for new products by 70%
|
||||
- Improved SEO performance due to unique, keyword-rich descriptions
|
||||
- Estimated daily value generated: $500 (based on increased sales and efficiency)
|
||||
|
||||
**ROI Analysis**:
|
||||
- Daily investment: $32.50
|
||||
- Daily return: $500
|
||||
- ROI = (Return - Investment) / Investment * 100 = 1,438%
|
||||
|
||||
**Key Takeaway**: The pay-per-token model works well for this use case due to the predictable and moderate token usage per task. The high ROI justifies the investment in a more advanced model like GPT-4o.
|
||||
|
||||
### Case Study 2: Customer Service Chatbot
|
||||
|
||||
**Company**: TechSupport Inc., a software company
|
||||
**Use Case**: 24/7 customer support chatbot
|
||||
**LLM Provider**: Claude 3.5 Sonnet
|
||||
|
||||
**Pricing Model**: Input: $3 per 1M tokens, Output: $15 per 1M tokens
|
||||
|
||||
**Usage Pattern**:
|
||||
- Average conversation: 500 tokens input (customer queries + context), 1000 tokens output (bot responses)
|
||||
- Daily conversations: 5,000
|
||||
|
||||
**Daily Cost Calculation**:
|
||||
1. Input cost: (500 tokens * 5,000 conversations) / 1M * $3 = $7.50
|
||||
2. Output cost: (1000 tokens * 5,000 conversations) / 1M * $15 = $75.00
|
||||
3. Total daily cost: $82.50
|
||||
|
||||
**Business Impact**:
|
||||
- Reduced customer wait times by 90%
|
||||
- Resolved 70% of queries without human intervention
|
||||
- Estimated daily cost savings: $2,000 (based on reduced human support hours)
|
||||
|
||||
**ROI Analysis**:
|
||||
- Daily investment: $82.50
|
||||
- Daily return: $2,000
|
||||
- ROI = (Return - Investment) / Investment * 100 = 2,324%
|
||||
|
||||
**Key Takeaway**: The higher cost of Claude 3.5 Sonnet is justified by its superior performance in handling complex customer queries, resulting in significant cost savings and improved customer satisfaction.
|
||||
|
||||
### Case Study 3: Financial Report Summarization
|
||||
|
||||
**Company**: FinAnalyze, a financial services firm
|
||||
**Use Case**: Automated summarization of lengthy financial reports
|
||||
**LLM Provider**: GPT-3.5 Turbo
|
||||
|
||||
**Pricing Model**: Input: $0.50 per 1M tokens, Output: $1.50 per 1M tokens
|
||||
|
||||
**Usage Pattern**:
|
||||
- Average report: 20,000 tokens input, 2,000 tokens output
|
||||
- Daily reports processed: 100
|
||||
|
||||
**Daily Cost Calculation**:
|
||||
1. Input cost: (20,000 tokens * 100 reports) / 1M * $0.50 = $100
|
||||
2. Output cost: (2,000 tokens * 100 reports) / 1M * $1.50 = $30
|
||||
3. Total daily cost: $130
|
||||
|
||||
**Business Impact**:
|
||||
- Reduced analysis time by 80%
|
||||
- Improved consistency in report summaries
|
||||
- Enabled analysts to focus on high-value tasks
|
||||
- Estimated daily value generated: $1,000 (based on time savings and improved decision-making)
|
||||
|
||||
**ROI Analysis**:
|
||||
- Daily investment: $130
|
||||
- Daily return: $1,000
|
||||
- ROI = (Return - Investment) / Investment * 100 = 669%
|
||||
|
||||
**Key Takeaway**: The lower cost of GPT-3.5 Turbo is suitable for this task, which requires processing large volumes of text but doesn't necessarily need the most advanced language understanding. The high input token count makes the input pricing a significant factor in model selection.
|
||||
|
||||
### Case Study 4: AI-Powered Language Learning App
|
||||
|
||||
**Company**: LinguaLeap, an edtech startup
|
||||
**Use Case**: Personalized language exercises and conversations
|
||||
**LLM Provider**: Claude 3 Haiku
|
||||
|
||||
**Pricing Model**: Input: $0.25 per 1M tokens, Output: $1.25 per 1M tokens
|
||||
|
||||
**Usage Pattern**:
|
||||
- Average session: 300 tokens input (user responses + context), 500 tokens output (exercises + feedback)
|
||||
- Daily active users: 50,000
|
||||
- Average sessions per user per day: 3
|
||||
|
||||
**Daily Cost Calculation**:
|
||||
1. Input cost: (300 tokens * 3 sessions * 50,000 users) / 1M * $0.25 = $11.25
|
||||
2. Output cost: (500 tokens * 3 sessions * 50,000 users) / 1M * $1.25 = $93.75
|
||||
3. Total daily cost: $105
|
||||
|
||||
**Business Impact**:
|
||||
- Increased user engagement by 40%
|
||||
- Improved learning outcomes, leading to higher user retention
|
||||
- Enabled scaling to new languages without proportional increase in human tutors
|
||||
- Estimated daily revenue: $5,000 (based on subscription fees and in-app purchases)
|
||||
|
||||
**ROI Analysis**:
|
||||
- Daily investment: $105
|
||||
- Daily revenue: $5,000
|
||||
- ROI = (Revenue - Investment) / Investment * 100 = 4,662%
|
||||
|
||||
**Key Takeaway**: The high-volume, relatively simple interactions in this use case make Claude 3 Haiku an excellent choice. Its low cost allows for frequent interactions without prohibitive expenses, which is crucial for an app relying on regular user engagement.
|
||||
|
||||
### Case Study 5: Legal Document Analysis
|
||||
|
||||
**Company**: LegalEagle LLP, a large law firm
|
||||
**Use Case**: Contract review and risk assessment
|
||||
**LLM Provider**: Claude 3 Opus
|
||||
|
||||
**Pricing Model**: Input: $15 per 1M tokens, Output: $75 per 1M tokens
|
||||
|
||||
**Usage Pattern**:
|
||||
- Average contract: 10,000 tokens input, 3,000 tokens output (analysis and risk assessment)
|
||||
- Daily contracts processed: 50
|
||||
|
||||
**Daily Cost Calculation**:
|
||||
1. Input cost: (10,000 tokens * 50 contracts) / 1M * $15 = $7.50
|
||||
2. Output cost: (3,000 tokens * 50 contracts) / 1M * $75 = $11.25
|
||||
3. Total daily cost: $18.75
|
||||
|
||||
**Business Impact**:
|
||||
- Reduced contract review time by 60%
|
||||
- Improved accuracy in identifying potential risks
|
||||
- Enabled handling of more complex cases
|
||||
- Estimated daily value: $10,000 (based on time savings and improved risk management)
|
||||
|
||||
**ROI Analysis**:
|
||||
- Daily investment: $18.75
|
||||
- Daily value: $10,000
|
||||
- ROI = (Value - Investment) / Investment * 100 = 53,233%
|
||||
|
||||
**Key Takeaway**: Despite the high cost per token, Claude 3 Opus's advanced capabilities justify its use in this high-stakes environment where accuracy and nuanced understanding are critical. The high value generated per task offsets the higher token costs.
|
||||
|
||||
These case studies demonstrate how different LLM providers and pricing models can be optimal for various use cases, depending on factors such as token volume, task complexity, and the value generated by the AI application. Executives should carefully consider these factors when selecting an LLM provider and pricing model for their specific needs.
|
||||
|
||||
## 5. Calculating ROI for LLM Integration
|
||||
|
||||
Calculating the Return on Investment (ROI) for LLM integration is crucial for executives to justify the expenditure and assess the business value of AI implementation. This section will guide you through the process of calculating ROI, considering both tangible and intangible benefits.
|
||||
|
||||
### The ROI Formula
|
||||
|
||||
The basic ROI formula is:
|
||||
|
||||
```
|
||||
ROI = (Net Benefit / Cost of Investment) * 100
|
||||
```
|
||||
|
||||
For LLM integration, we can expand this to:
|
||||
|
||||
```
|
||||
ROI = ((Total Benefits - Total Costs) / Total Costs) * 100
|
||||
```
|
||||
|
||||
### Identifying Benefits
|
||||
|
||||
1. **Direct Cost Savings**
|
||||
- Reduced labor costs
|
||||
- Decreased operational expenses
|
||||
- Lower error-related costs
|
||||
|
||||
2. **Revenue Increases**
|
||||
- New product offerings enabled by LLM
|
||||
- Improved customer acquisition and retention
|
||||
- Upselling and cross-selling opportunities
|
||||
|
||||
3. **Productivity Gains**
|
||||
- Time saved on repetitive tasks
|
||||
- Faster decision-making processes
|
||||
- Improved employee efficiency
|
||||
|
||||
4. **Quality Improvements**
|
||||
- Enhanced accuracy in outputs
|
||||
- Consistency in service delivery
|
||||
- Reduced error rates
|
||||
|
||||
5. **Strategic Advantages**
|
||||
- Market differentiation
|
||||
- Faster time-to-market for new offerings
|
||||
- Improved competitive positioning
|
||||
|
||||
### Calculating Costs
|
||||
|
||||
1. **Direct LLM Costs**
|
||||
- API usage fees
|
||||
- Subscription costs
|
||||
|
||||
2. **Infrastructure Costs**
|
||||
- Cloud computing resources
|
||||
- Data storage
|
||||
- Networking expenses
|
||||
|
||||
3. **Integration and Development Costs**
|
||||
- Initial setup and integration
|
||||
- Ongoing maintenance and updates
|
||||
- Custom feature development
|
||||
|
||||
4. **Training and Support**
|
||||
- Employee training programs
|
||||
- User support and documentation
|
||||
- Change management initiatives
|
||||
|
||||
5. **Compliance and Security**
|
||||
- Data privacy measures
|
||||
- Security audits and implementations
|
||||
- Regulatory compliance efforts
|
||||
|
||||
### Step-by-Step ROI Calculation
|
||||
|
||||
1. **Define the Time Period**: Determine the timeframe for your ROI calculation (e.g., 1 year, 3 years).
|
||||
|
||||
2. **Estimate Total Benefits**:
|
||||
- Quantify direct cost savings and revenue increases
|
||||
- Assign monetary values to productivity gains and quality improvements
|
||||
- Estimate the value of strategic advantages (this may be more subjective)
|
||||
|
||||
3. **Calculate Total Costs**:
|
||||
- Sum up all direct and indirect costs related to LLM integration
|
||||
|
||||
4. **Apply the ROI Formula**:
|
||||
```
|
||||
ROI = ((Total Benefits - Total Costs) / Total Costs) * 100
|
||||
```
|
||||
|
||||
5. **Consider Time Value of Money**: For longer-term projections, use Net Present Value (NPV) to account for the time value of money.
|
||||
|
||||
### Example ROI Calculation
|
||||
|
||||
Let's consider a hypothetical customer service chatbot implementation:
|
||||
|
||||
**Time Period**: 1 year
|
||||
|
||||
**Benefits**:
|
||||
- Labor cost savings: $500,000
|
||||
- Increased sales from improved customer satisfaction: $300,000
|
||||
- Productivity gains from faster query resolution: $200,000
|
||||
|
||||
Total Benefits: $1,000,000
|
||||
|
||||
**Costs**:
|
||||
- LLM API fees: $100,000
|
||||
- Integration and development: $150,000
|
||||
- Training and support: $50,000
|
||||
- Infrastructure: $50,000
|
||||
|
||||
Total Costs: $350,000
|
||||
|
||||
**ROI Calculation**:
|
||||
```
|
||||
ROI = (($1,000,000 - $350,000) / $350,000) * 100 = 185.7%
|
||||
```
|
||||
|
||||
This indicates a strong positive return on investment, with benefits outweighing costs by a significant margin.
|
||||
|
||||
### Considerations for Accurate ROI Calculation
|
||||
|
||||
1. **Be Conservative in Estimates**: It's better to underestimate benefits and overestimate costs to provide a more realistic view.
|
||||
|
||||
2. **Account for Ramp-Up Time**: Full benefits may not be realized immediately. Consider a phased approach in your calculations.
|
||||
|
||||
3. **Include Opportunity Costs**: Consider the potential returns if the investment were made elsewhere.
|
||||
|
||||
4. **Factor in Risk**: Adjust your ROI based on the likelihood of achieving projected benefits.
|
||||
|
||||
5. **Consider Non-Financial Benefits**: Some benefits, like improved employee satisfaction or enhanced brand perception, may not have direct financial equivalents but are still valuable.
|
||||
|
||||
6. **Perform Sensitivity Analysis**: Calculate ROI under different scenarios (best case, worst case, most likely) to understand the range of possible outcomes.
|
||||
|
||||
7. **Benchmark Against Alternatives**: Compare the ROI of LLM integration against other potential investments or solutions.
|
||||
|
||||
### Long-Term ROI Considerations
|
||||
|
||||
While initial ROI calculations are crucial for decision-making, it's important to consider long-term implications:
|
||||
|
||||
1. **Scalability**: How will ROI change as usage increases?
|
||||
2. **Technological Advancements**: Will newer, more efficient models become available?
|
||||
3. **Market Changes**: How might shifts in the competitive landscape affect the value proposition?
|
||||
4. **Regulatory Environment**: Could future regulations impact the cost or feasibility of LLM use?
|
||||
|
||||
By thoroughly calculating and analyzing the ROI of LLM integration, executives can make data-driven decisions about AI investments and set realistic expectations for the value these technologies can bring to their organizations.
|
||||
|
||||
## 6. Comparative Analysis of Major LLM Providers
|
||||
|
||||
In this section, we'll compare the offerings of major LLM providers, focusing on their pricing structures, model capabilities, and unique selling points. This analysis will help executives understand the landscape and make informed decisions about which provider best suits their needs.
|
||||
|
||||
### OpenAI
|
||||
|
||||
**Models**: GPT-4o, GPT-3.5 Turbo
|
||||
|
||||
**Pricing Structure**:
|
||||
- Pay-per-token model
|
||||
- Different rates for input and output tokens
|
||||
- Bulk discounts available for high-volume users
|
||||
|
||||
**Key Features**:
|
||||
- State-of-the-art performance on a wide range of tasks
|
||||
- Regular model updates and improvements
|
||||
- Extensive documentation and community support
|
||||
|
||||
**Considerations**:
|
||||
- Higher pricing compared to some competitors
|
||||
- Potential for rapid price changes as technology evolves
|
||||
- Usage limits and approval process for higher-tier models
|
||||
|
||||
### Anthropic
|
||||
|
||||
**Models**: Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku
|
||||
|
||||
**Pricing Structure**:
|
||||
- Pay-per-token model
|
||||
- Different rates for input and output tokens
|
||||
- Tiered pricing based on model capabilities
|
||||
|
||||
**Key Features**:
|
||||
- Strong focus on AI safety and ethics
|
||||
- Long context windows (200K tokens)
|
||||
- Specialized models for different use cases (e.g., Haiku for speed, Opus for complex tasks)
|
||||
|
||||
**Considerations**:
|
||||
- Newer to the market compared to OpenAI
|
||||
- Potentially more limited third-party integrations
|
||||
- Strong emphasis on responsible AI use
|
||||
|
||||
### Google (Vertex AI)
|
||||
|
||||
**Models**: PaLM 2 for Chat, PaLM 2 for Text
|
||||
|
||||
**Pricing Structure**:
|
||||
- Pay-per-thousand characters model
|
||||
- Different rates for input and output
|
||||
- Additional charges for advanced features (e.g., semantic retrieval)
|
||||
|
||||
**Key Features**:
|
||||
- Integration with Google Cloud ecosystem
|
||||
- Multi-modal capabilities (text, image, audio)
|
||||
- Enterprise-grade security and compliance features
|
||||
|
||||
**Considerations**:
|
||||
- Pricing can be complex due to additional Google Cloud costs
|
||||
- Strong performance in specialized domains (e.g., coding, mathematical reasoning)
|
||||
- Potential for integration with other Google services
|
||||
|
||||
### Amazon (Bedrock)
|
||||
|
||||
**Models**: Claude (Anthropic), Titan
|
||||
|
||||
**Pricing Structure**:
|
||||
- Pay-per-second of compute time
|
||||
- Additional charges for data transfer and storage
|
||||
|
||||
**Key Features**:
|
||||
- Seamless integration with AWS services
|
||||
- Access to multiple model providers through a single API
|
||||
- Fine-tuning and customization options
|
||||
|
||||
**Considerations**:
|
||||
- Pricing model can be less predictable for inconsistent workloads
|
||||
- Strong appeal for existing AWS customers
|
||||
- Potential for cost optimizations through AWS ecosystem
|
||||
|
||||
### Microsoft (Azure OpenAI Service)
|
||||
|
||||
**Models**: GPT-4, GPT-3.5 Turbo
|
||||
|
||||
**Pricing Structure**:
|
||||
- Similar to OpenAI's pricing, but with Azure integration
|
||||
- Additional costs for Azure services (e.g., storage, networking)
|
||||
|
||||
**Key Features**:
|
||||
- Enterprise-grade security and compliance
|
||||
- Integration with Azure AI services
|
||||
- Access to fine-tuning and customization options
|
||||
|
||||
**Considerations**:
|
||||
- Attractive for organizations already using Azure
|
||||
- Potential for volume discounts through Microsoft Enterprise Agreements
|
||||
- Additional overhead for Azure management
|
||||
|
||||
### Comparative Analysis
|
||||
|
||||
| Provider | Pricing Model | Strengths | Considerations |
|
||||
|----------|---------------|-----------|----------------|
|
||||
| OpenAI | Pay-per-token | - Top performance<br>- Regular updates<br>- Strong community | - Higher costs<br>- Usage limits |
|
||||
| Anthropic| Pay-per-token | - Ethical focus<br>- Long context<br>- Specialized models | - Newer provider<br>- Limited integrations |
|
||||
| Google | Pay-per-character | - Google Cloud integration<br>- Multi-modal<br>- Enterprise features | - Complex pricing<br>- Google ecosystem lock-in |
|
||||
| Amazon | Pay-per-compute time | - AWS integration<br>- Multiple providers<br>- Customization options | - Less predictable costs<br>- AWS ecosystem focus |
|
||||
| Microsoft| Pay-per-token (Azure-based) | - Enterprise security<br>- Azure integration<br>- Fine-tuning options | - Azure overhead<br>- Potential lock-in |
|
||||
|
||||
### Factors to Consider in Provider Selection
|
||||
|
||||
1. **Performance Requirements**: Assess whether you need state-of-the-art performance or if a less advanced (and potentially cheaper) model suffices.
|
||||
|
||||
2. **Pricing Predictability**: Consider whether your usage patterns align better with token-based or compute-time-based pricing.
|
||||
|
||||
3. **Integration Needs**: Evaluate how well each provider integrates with your existing technology stack.
|
||||
|
||||
4. **Scalability**: Assess each provider's ability to handle your expected growth in usage.
|
||||
|
||||
5. **Customization Options**: Determine if you need fine-tuning or specialized model development capabilities.
|
||||
|
||||
6. **Compliance and Security**: Consider your industry-specific regulatory requirements and each provider's security offerings.
|
||||
|
||||
7. **Support and Documentation**: Evaluate the quality of documentation, community support, and enterprise-level assistance.
|
||||
|
||||
8. **Ethical Considerations**: Assess each provider's stance on AI ethics and responsible use.
|
||||
|
||||
9. **Lock-In Concerns**: Consider the long-term implications of committing to a specific provider or cloud ecosystem.
|
||||
|
||||
10. **Multi-Provider Strategy**: Evaluate the feasibility and benefits of using multiple providers for different use cases.
|
||||
|
||||
By carefully comparing these providers and considering the factors most relevant to your organization, you can make an informed decision that balances cost, performance, and strategic fit. Remember that the LLM landscape is rapidly evolving, so it's important to regularly reassess your choices and stay informed about new developments and pricing changes.
|
||||
|
||||
## 7. Hidden Costs and Considerations
|
||||
|
||||
When evaluating LLM providers and calculating the total cost of ownership, it's crucial to look beyond the advertised pricing and consider the hidden costs and additional factors that can significantly impact your budget and overall implementation success. This section explores these often-overlooked aspects to help executives make more comprehensive and accurate assessments.
|
||||
|
||||
### 1. Data Preparation and Cleaning
|
||||
|
||||
**Considerations**:
|
||||
- Cost of data collection and aggregation
|
||||
- Expenses related to data cleaning and normalization
|
||||
- Ongoing data maintenance and updates
|
||||
|
||||
**Impact**:
|
||||
- Can be time-consuming and labor-intensive
|
||||
- May require specialized tools or personnel
|
||||
- Critical for model performance and accuracy
|
||||
|
||||
### 2. Fine-Tuning and Customization
|
||||
|
||||
**Considerations**:
|
||||
- Costs associated with creating custom datasets
|
||||
- Compute resources required for fine-tuning
|
||||
- Potential need for specialized ML expertise
|
||||
|
||||
**Impact**:
|
||||
- Can significantly improve model performance for specific tasks
|
||||
- May lead to better ROI in the long run
|
||||
- Increases initial implementation costs
|
||||
|
||||
### 3. Integration and Development
|
||||
|
||||
**Considerations**:
|
||||
- Engineering time for API integration
|
||||
- Development of custom interfaces or applications
|
||||
- Ongoing maintenance and updates
|
||||
|
||||
**Impact**:
|
||||
- Can be substantial, especially for complex integrations
|
||||
- May require hiring additional developers or consultants
|
||||
- Critical for seamless user experience and workflow integration
|
||||
|
||||
### 4. Monitoring and Optimization
|
||||
|
||||
**Considerations**:
|
||||
- Tools and systems for performance monitoring
|
||||
- Regular audits and optimizations
|
||||
- Costs associated with debugging and troubleshooting
|
||||
|
||||
**Impact**:
|
||||
- Ongoing expense that increases with scale
|
||||
- Essential for maintaining efficiency and cost-effectiveness
|
||||
- Can lead to significant savings through optimized usage
|
||||
|
||||
### 5. Compliance and Security
|
||||
|
||||
**Considerations**:
|
||||
- Legal counsel for data privacy and AI regulations
|
||||
- Implementation of security measures (e.g., encryption, access controls)
|
||||
- Regular audits and certifications
|
||||
|
||||
**Impact**:
|
||||
- Can be substantial, especially in heavily regulated industries
|
||||
- Critical for risk management and maintaining customer trust
|
||||
- May limit certain use cases or require additional safeguards
|
||||
|
||||
### 6. Training and Change Management
|
||||
|
||||
- Employee training programs
|
||||
- Development of user guides and documentation
|
||||
- Change management initiatives
|
||||
|
||||
**Impact**:
|
||||
- Often underestimated but crucial for adoption
|
||||
- Can affect productivity during the transition period
|
||||
- Important for realizing the full potential of LLM integration
|
||||
|
||||
### 7. Scaling Costs
|
||||
|
||||
**Considerations**:
|
||||
- Potential price increases as usage grows
|
||||
- Need for additional infrastructure or resources
|
||||
- Costs associated with managing increased complexity
|
||||
|
||||
**Impact**:
|
||||
- Can lead to unexpected expenses if not properly forecasted
|
||||
- May require renegotiation of contracts or switching providers
|
||||
- Important to consider in long-term planning
|
||||
|
||||
### 8. Opportunity Costs
|
||||
|
||||
**Considerations**:
|
||||
- Time and resources diverted from other projects
|
||||
- Potential missed opportunities due to focus on LLM implementation
|
||||
- Learning curve and productivity dips during adoption
|
||||
|
||||
**Impact**:
|
||||
- Difficult to quantify but important to consider
|
||||
- Can affect overall business strategy and priorities
|
||||
- May influence timing and scope of LLM integration
|
||||
|
||||
### 9. Vendor Lock-in
|
||||
|
||||
**Considerations**:
|
||||
- Costs associated with switching providers
|
||||
- Dependency on provider-specific features or integrations
|
||||
- Potential for price increases once deeply integrated
|
||||
|
||||
**Impact**:
|
||||
- Can limit flexibility and negotiating power
|
||||
- May affect long-term costs and strategic decisions
|
||||
- Important to consider multi-provider or portable implementation strategies
|
||||
|
||||
### 10. Ethical and Reputational Considerations
|
||||
|
||||
**Considerations**:
|
||||
- Potential backlash from AI-related controversies
|
||||
- Costs of ensuring ethical AI use and transparency
|
||||
- Investments in responsible AI practices
|
||||
|
||||
**Impact**:
|
||||
- Can affect brand reputation and customer trust
|
||||
- May require ongoing public relations efforts
|
||||
- Important for long-term sustainability and social responsibility
|
||||
|
||||
By carefully considering these hidden costs and factors, executives can develop a more comprehensive understanding of the total investment required for successful LLM integration. This holistic approach allows for better budgeting, risk management, and strategic planning.
|
||||
|
||||
## Conclusion: Navigating the LLM Pricing Landscape
|
||||
|
||||
As we've explored throughout this guide, the landscape of LLM provider pricing is complex and multifaceted. From understanding the basic pricing models to calculating ROI and considering hidden costs, there are numerous factors that executives must weigh when making decisions about AI integration.
|
||||
|
||||
Key takeaways include:
|
||||
|
||||
1. The importance of aligning LLM selection with specific business needs and use cases.
|
||||
2. The need for thorough ROI analysis that goes beyond simple cost calculations.
|
||||
3. The value of considering both short-term implementation costs and long-term scalability.
|
||||
4. The critical role of hidden costs in determining the true total cost of ownership.
|
||||
5. The potential for significant business value when LLMs are strategically implemented and optimized.
|
||||
|
||||
As the AI landscape continues to evolve rapidly, staying informed and adaptable is crucial. What may be the best choice today could change as new models are released, pricing structures shift, and your organization's needs evolve.
|
||||
|
||||
To help you navigate these complexities and make the most informed decisions for your enterprise, we invite you to take the next steps in your AI journey:
|
||||
|
||||
1. **Book a Consultation**: Speak with our enterprise-grade LLM specialists who can provide personalized insights and recommendations tailored to your specific needs. Schedule a 15-minute call at [https://cal.com/swarms/15min](https://cal.com/swarms/15min).
|
||||
|
||||
2. **Join Our Community**: Connect with fellow AI executives, share experiences, and stay updated on the latest developments in the LLM space. Join our Discord community at [https://discord.gg/yxU9t9da](https://discord.gg/yxU9t9da).
|
||||
|
||||
By leveraging expert guidance and peer insights, you can position your organization to make the most of LLM technologies while optimizing costs and maximizing value. The future of AI in enterprise is bright, and with the right approach, your organization can be at the forefront of this transformative technology.
|
@ -0,0 +1,22 @@
|
||||
# Welcome to Swarms Docs Home
|
||||
|
||||
**Get Started Building Production-Grade Multi-Agent Applications**
|
||||
|
||||
## Getting Started
|
||||
|
||||
Here you'll find references about the Swarms framework, marketplace, community, and more to enable you to build your multi-agent applications.
|
||||
|
||||
| Section | Links |
|
||||
|----------------------|--------------------------------------------------------------------------------------------|
|
||||
| API Reference | [API Reference](/api-reference) |
|
||||
| Community | [Discord](https://discord.com/servers/agora-999382051935506503) |
|
||||
| Blog | [Blog](https://medium.com/@kyeg) |
|
||||
| Social Media | [Twitter](https://x.com/swarms_corp) |
|
||||
| Swarms Framework | [Swarms Framework](https://github.com/kyegomez/swarms) |
|
||||
| Swarms Platform | [Swarms Platform GitHub](https://github.com/kyegomez/swarms-platform) |
|
||||
| Swarms Marketplace | [Swarms Marketplace](https://swarms.world) |
|
||||
| Swarms Pricing | [Swarms Pricing](https://swarms.world/pricing) |
|
||||
|
||||
## Get Support
|
||||
|
||||
Want to get in touch with the Swarms team? Open an issue on [GitHub](https://github.com/kyegomez/swarms/issues/new) or reach out to us via [email](mailto:kye@swarms.world). We're here to help!
|
@ -0,0 +1,358 @@
|
||||
# Architecture
|
||||
|
||||
## **1. Introduction**
|
||||
|
||||
In today's rapidly evolving digital world, harnessing the collaborative power of multiple computational agents is more crucial than ever. 'Swarms' represents a bold stride in this direction—a scalable and dynamic framework designed to enable swarms of agents to function in harmony and tackle complex tasks. This document serves as a comprehensive guide, elucidating the underlying architecture and strategies pivotal to realizing the Swarms vision.
|
||||
|
||||
---
|
||||
|
||||
## **2. The Vision**
|
||||
|
||||
At its heart, the Swarms framework seeks to emulate the collaborative efficiency witnessed in natural systems, like ant colonies or bird flocks. These entities, though individually simple, achieve remarkable outcomes through collaboration. Similarly, Swarms will unleash the collective potential of numerous agents, operating cohesively.
|
||||
|
||||
---
|
||||
|
||||
## **3. Architecture Overview**
|
||||
|
||||
### **3.1 Agent Level**
|
||||
The base level that serves as the building block for all further complexity.
|
||||
|
||||
#### Mechanics:
|
||||
* **Model**: At its core, each agent harnesses a powerful model like OpenAI's GPT.
|
||||
* **Vectorstore**: A memory structure allowing agents to store and retrieve information.
|
||||
* **Tools**: Utilities and functionalities that aid in the agent's task execution.
|
||||
|
||||
#### Interaction:
|
||||
Agents interact with the external world through their model and tools. The Vectorstore aids in retaining knowledge and facilitating inter-agent communication.
|
||||
|
||||
### **3.2 Worker Infrastructure Level**
|
||||
Building on the agent foundation, enhancing capability and readiness for swarm integration.
|
||||
|
||||
#### Mechanics:
|
||||
* **Human Input Integration**: Enables agents to accept and understand human-provided instructions.
|
||||
* **Unique Identifiers**: Assigns each agent a unique ID to facilitate tracking and communication.
|
||||
* **Asynchronous Tools**: Bolsters agents' capability to multitask and interact in real-time.
|
||||
|
||||
#### Interaction:
|
||||
Each worker is an enhanced agent, capable of operating independently or in sync with its peers, allowing for dynamic, scalable operations.
|
||||
|
||||
### **3.3 Swarm Level**
|
||||
Multiple Worker Nodes orchestrated into a synchronized, collaborative entity.
|
||||
|
||||
#### Mechanics:
|
||||
* **Orchestrator**: The maestro, responsible for directing the swarm, task allocation, and communication.
|
||||
* **Scalable Communication Layer**: Facilitates interactions among nodes and between nodes and the orchestrator.
|
||||
* **Task Assignment & Completion Protocols**: Structured procedures ensuring tasks are efficiently distributed and concluded.
|
||||
|
||||
#### Interaction:
|
||||
Nodes collaborate under the orchestrator's guidance, ensuring tasks are partitioned appropriately, executed, and results consolidated.
|
||||
|
||||
### **3.4 Hivemind Level**
|
||||
Envisioned as a 'Swarm of Swarms'. An upper echelon of collaboration.
|
||||
|
||||
#### Mechanics:
|
||||
* **Hivemind Orchestrator**: Oversees multiple swarm orchestrators, ensuring harmony on a grand scale.
|
||||
* **Inter-Swarm Communication Protocols**: Dictates how swarms interact, exchange information, and co-execute tasks.
|
||||
|
||||
#### Interaction:
|
||||
Multiple swarms, each a formidable force, combine their prowess under the Hivemind. This level tackles monumental tasks by dividing them among swarms.
|
||||
|
||||
---
|
||||
|
||||
## **4. Building the Framework: A Task Checklist**
|
||||
|
||||
### **4.1 Foundations: Agent Level**
|
||||
* Define and standardize agent properties.
|
||||
* Integrate desired model (e.g., OpenAI's GPT) with agent.
|
||||
* Implement Vectorstore mechanisms: storage, retrieval, and communication protocols.
|
||||
* Incorporate essential tools and utilities.
|
||||
* Conduct preliminary testing: Ensure agents can execute basic tasks and utilize the Vectorstore.
|
||||
|
||||
### **4.2 Enhancements: Worker Infrastructure Level**
|
||||
* Interface agents with human input mechanisms.
|
||||
* Assign and manage unique identifiers for each worker.
|
||||
* Integrate asynchronous capabilities: Ensure real-time response and multitasking.
|
||||
* Test worker nodes for both solitary and collaborative tasks.
|
||||
|
||||
### **4.3 Cohesion: Swarm Level**
|
||||
* Design and develop the orchestrator: Ensure it can manage multiple worker nodes.
|
||||
* Establish a scalable and efficient communication layer.
|
||||
* Implement task distribution and retrieval protocols.
|
||||
* Test swarms for efficiency, scalability, and robustness.
|
||||
|
||||
### **4.4 Apex Collaboration: Hivemind Level**
|
||||
* Build the Hivemind Orchestrator: Ensure it can oversee multiple swarms.
|
||||
* Define inter-swarm communication, prioritization, and task-sharing protocols.
|
||||
* Develop mechanisms to balance loads and optimize resource utilization across swarms.
|
||||
* Thoroughly test the Hivemind level for macro-task execution.
|
||||
|
||||
---
|
||||
|
||||
## **5. Integration and Communication Mechanisms**
|
||||
|
||||
### **5.1 Vectorstore as the Universal Communication Layer**
|
||||
Serving as the memory and communication backbone, the Vectorstore must:
|
||||
* Facilitate rapid storage and retrieval of high-dimensional vectors.
|
||||
* Enable similarity-based lookups: Crucial for recognizing patterns or finding similar outputs.
|
||||
* Scale seamlessly as agent count grows.
|
||||
|
||||
### **5.2 Orchestrator-Driven Communication**
|
||||
* Orchestrators, both at the swarm and hivemind level, should employ adaptive algorithms to optimally distribute tasks.
|
||||
* Ensure real-time monitoring of task execution and worker node health.
|
||||
* Integrate feedback loops: Allow for dynamic task reassignment in case of node failures or inefficiencies.
|
||||
|
||||
---
|
||||
|
||||
## **6. Conclusion & Forward Path**
|
||||
|
||||
The Swarms framework, once realized, will usher in a new era of computational efficiency and collaboration. While the roadmap ahead is intricate, with diligent planning, development, and testing, Swarms will redefine the boundaries of collaborative computing.
|
||||
|
||||
--------
|
||||
|
||||
|
||||
# Overview
|
||||
|
||||
### 1. Model
|
||||
|
||||
**Overview:**
|
||||
The foundational level where a trained model (e.g., OpenAI GPT model) is initialized. It's the base on which further abstraction levels build upon. It provides the core capabilities to perform tasks, answer queries, etc.
|
||||
|
||||
**Diagram:**
|
||||
```
|
||||
[ Model (openai) ]
|
||||
```
|
||||
|
||||
### 2. Agent Level
|
||||
|
||||
**Overview:**
|
||||
At the agent level, the raw model is coupled with tools and a vector store, allowing it to be more than just a model. The agent can now remember, use tools, and become a more versatile entity ready for integration into larger systems.
|
||||
|
||||
**Diagram:**
|
||||
```
|
||||
+-----------+
|
||||
| Agent |
|
||||
| +-------+ |
|
||||
| | Model | |
|
||||
| +-------+ |
|
||||
| +-----------+ |
|
||||
| | VectorStore | |
|
||||
| +-----------+ |
|
||||
| +-------+ |
|
||||
| | Tools | |
|
||||
| +-------+ |
|
||||
+-----------+
|
||||
```
|
||||
|
||||
### 3. Worker Infrastructure Level
|
||||
|
||||
**Overview:**
|
||||
The worker infrastructure is a step above individual agents. Here, an agent is paired with additional utilities like human input and other tools, making it a more advanced, responsive unit capable of complex tasks.
|
||||
|
||||
**Diagram:**
|
||||
```
|
||||
+----------------+
|
||||
| WorkerNode |
|
||||
| +-----------+ |
|
||||
| | Agent | |
|
||||
| | +-------+ | |
|
||||
| | | Model | | |
|
||||
| | +-------+ | |
|
||||
| | +-------+ | |
|
||||
| | | Tools | | |
|
||||
| | +-------+ | |
|
||||
| +-----------+ |
|
||||
| |
|
||||
| +-----------+ |
|
||||
| |Human Input| |
|
||||
| +-----------+ |
|
||||
| |
|
||||
| +-------+ |
|
||||
| | Tools | |
|
||||
| +-------+ |
|
||||
+----------------+
|
||||
```
|
||||
|
||||
### 4. Swarm Level
|
||||
|
||||
**Overview:**
|
||||
At the swarm level, the orchestrator is central. It's responsible for assigning tasks to worker nodes, monitoring their completion, and handling the communication layer (for example, through a vector store or another universal communication mechanism) between worker nodes.
|
||||
|
||||
**Diagram:**
|
||||
```
|
||||
+------------+
|
||||
|Orchestrator|
|
||||
+------------+
|
||||
|
|
||||
+---------------------------+
|
||||
| |
|
||||
| Swarm-level Communication|
|
||||
| Layer (e.g. |
|
||||
| Vector Store) |
|
||||
+---------------------------+
|
||||
/ | \
|
||||
+---------------+ +---------------+ +---------------+
|
||||
|WorkerNode 1 | |WorkerNode 2 | |WorkerNode n |
|
||||
| | | | | |
|
||||
+---------------+ +---------------+ +---------------+
|
||||
| Task Assigned | Task Completed | Communication |
|
||||
```
|
||||
|
||||
### 5. Hivemind Level
|
||||
|
||||
**Overview:**
|
||||
At the Hivemind level, it's a multi-swarm setup, with an upper-layer orchestrator managing multiple swarm-level orchestrators. The Hivemind orchestrator is responsible for broader tasks like assigning macro-tasks to swarms, handling inter-swarm communications, and ensuring the overall system is functioning smoothly.
|
||||
|
||||
**Diagram:**
|
||||
```
|
||||
+--------+
|
||||
|Hivemind|
|
||||
+--------+
|
||||
|
|
||||
+--------------+
|
||||
|Hivemind |
|
||||
|Orchestrator |
|
||||
+--------------+
|
||||
/ | \
|
||||
+------------+ +------------+ +------------+
|
||||
|Orchestrator| |Orchestrator| |Orchestrator|
|
||||
+------------+ +------------+ +------------+
|
||||
| | |
|
||||
+--------------+ +--------------+ +--------------+
|
||||
| Swarm-level| | Swarm-level| | Swarm-level|
|
||||
|Communication| |Communication| |Communication|
|
||||
| Layer | | Layer | | Layer |
|
||||
+--------------+ +--------------+ +--------------+
|
||||
/ \ / \ / \
|
||||
+-------+ +-------+ +-------+ +-------+ +-------+
|
||||
|Worker | |Worker | |Worker | |Worker | |Worker |
|
||||
| Node | | Node | | Node | | Node | | Node |
|
||||
+-------+ +-------+ +-------+ +-------+ +-------+
|
||||
```
|
||||
|
||||
This setup allows the Hivemind level to operate at a grander scale, with the capability to manage hundreds or even thousands of worker nodes across multiple swarms efficiently.
|
||||
|
||||
|
||||
|
||||
-------
|
||||
# **Swarms Framework Development Strategy Checklist**
|
||||
|
||||
## **Introduction**
|
||||
|
||||
The development of the Swarms framework requires a systematic and granular approach to ensure that each component is robust and that the overall framework is efficient and scalable. This checklist will serve as a guide to building Swarms from the ground up, breaking down tasks into small, manageable pieces.
|
||||
|
||||
---
|
||||
|
||||
## **1. Agent Level Development**
|
||||
|
||||
### **1.1 Model Integration**
|
||||
- [ ] Research the most suitable models (e.g., OpenAI's GPT).
|
||||
- [ ] Design an API for the agent to call the model.
|
||||
- [ ] Implement error handling when model calls fail.
|
||||
- [ ] Test the model with sample data for accuracy and speed.
|
||||
|
||||
### **1.2 Vectorstore Implementation**
|
||||
- [ ] Design the schema for the vector storage system.
|
||||
- [ ] Implement storage methods to add, delete, and update vectors.
|
||||
- [ ] Develop retrieval methods with optimization for speed.
|
||||
- [ ] Create protocols for vector-based communication between agents.
|
||||
- [ ] Conduct stress tests to ascertain storage and retrieval speed.
|
||||
|
||||
### **1.3 Tools & Utilities Integration**
|
||||
- [ ] List out essential tools required for agent functionality.
|
||||
- [ ] Develop or integrate APIs for each tool.
|
||||
- [ ] Implement error handling and logging for tool interactions.
|
||||
- [ ] Validate tools integration with unit tests.
|
||||
|
||||
---
|
||||
|
||||
## **2. Worker Infrastructure Level Development**
|
||||
|
||||
### **2.1 Human Input Integration**
|
||||
- [ ] Design a UI/UX for human interaction with worker nodes.
|
||||
- [ ] Create APIs for input collection.
|
||||
- [ ] Implement input validation and error handling.
|
||||
- [ ] Test human input methods for clarity and ease of use.
|
||||
|
||||
### **2.2 Unique Identifier System**
|
||||
- [ ] Research optimal formats for unique ID generation.
|
||||
- [ ] Develop methods for generating and assigning IDs to agents.
|
||||
- [ ] Implement a tracking system to manage and monitor agents via IDs.
|
||||
- [ ] Validate the uniqueness and reliability of the ID system.
|
||||
|
||||
### **2.3 Asynchronous Operation Tools**
|
||||
- [ ] Incorporate libraries/frameworks to enable asynchrony.
|
||||
- [ ] Ensure tasks within an agent can run in parallel without conflict.
|
||||
- [ ] Test asynchronous operations for efficiency improvements.
|
||||
|
||||
---
|
||||
|
||||
## **3. Swarm Level Development**
|
||||
|
||||
### **3.1 Orchestrator Design & Development**
|
||||
- [ ] Draft a blueprint of orchestrator functionalities.
|
||||
- [ ] Implement methods for task distribution among worker nodes.
|
||||
- [ ] Develop communication protocols for the orchestrator to monitor workers.
|
||||
- [ ] Create feedback systems to detect and address worker node failures.
|
||||
- [ ] Test orchestrator with a mock swarm to ensure efficient task allocation.
|
||||
|
||||
### **3.2 Communication Layer Development**
|
||||
- [ ] Select a suitable communication protocol/framework (e.g., gRPC, WebSockets).
|
||||
- [ ] Design the architecture for scalable, low-latency communication.
|
||||
- [ ] Implement methods for sending, receiving, and broadcasting messages.
|
||||
- [ ] Test communication layer for reliability, speed, and error handling.
|
||||
|
||||
### **3.3 Task Management Protocols**
|
||||
- [ ] Develop a system to queue, prioritize, and allocate tasks.
|
||||
- [ ] Implement methods for real-time task status tracking.
|
||||
- [ ] Create a feedback loop for completed tasks.
|
||||
- [ ] Test task distribution, execution, and feedback systems for efficiency.
|
||||
|
||||
---
|
||||
|
||||
## **4. Hivemind Level Development**
|
||||
|
||||
### **4.1 Hivemind Orchestrator Development**
|
||||
- [ ] Extend swarm orchestrator functionalities to manage multiple swarms.
|
||||
- [ ] Create inter-swarm communication protocols.
|
||||
- [ ] Implement load balancing mechanisms to distribute tasks across swarms.
|
||||
- [ ] Validate hivemind orchestrator functionalities with multi-swarm setups.
|
||||
|
||||
### **4.2 Inter-Swarm Communication Protocols**
|
||||
- [ ] Design methods for swarms to exchange data.
|
||||
- [ ] Implement data reconciliation methods for swarms working on shared tasks.
|
||||
- [ ] Test inter-swarm communication for efficiency and data integrity.
|
||||
|
||||
---
|
||||
|
||||
## **5. Scalability & Performance Testing**
|
||||
|
||||
- [ ] Simulate heavy loads to test the limits of the framework.
|
||||
- [ ] Identify and address bottlenecks in both communication and computation.
|
||||
- [ ] Conduct speed tests under different conditions.
|
||||
- [ ] Test the system's responsiveness under various levels of stress.
|
||||
|
||||
---
|
||||
|
||||
## **6. Documentation & User Guide**
|
||||
|
||||
- [ ] Develop detailed documentation covering architecture, setup, and usage.
|
||||
- [ ] Create user guides with step-by-step instructions.
|
||||
- [ ] Incorporate visual aids, diagrams, and flowcharts for clarity.
|
||||
- [ ] Update documentation regularly with new features and improvements.
|
||||
|
||||
---
|
||||
|
||||
## **7. Continuous Integration & Deployment**
|
||||
|
||||
- [ ] Setup CI/CD pipelines for automated testing and deployment.
|
||||
- [ ] Ensure automatic rollback in case of deployment failures.
|
||||
- [ ] Integrate code quality and security checks in the pipeline.
|
||||
- [ ] Document deployment strategies and best practices.
|
||||
|
||||
---
|
||||
|
||||
## **Conclusion**
|
||||
|
||||
The Swarms framework represents a monumental leap in agent-based computation. This checklist provides a thorough roadmap for the framework's development, ensuring that every facet is addressed in depth. Through diligent adherence to this guide, the Swarms vision can be realized as a powerful, scalable, and robust system ready to tackle the challenges of tomorrow.
|
||||
|
||||
(Note: This document, given the word limit, provides a high-level overview. A full 5000-word document would delve into even more intricate details, nuances, potential pitfalls, and include considerations for security, user experience, compatibility, etc.)
|
@ -0,0 +1,86 @@
|
||||
# Bounty Program
|
||||
|
||||
Our bounty program is an exciting opportunity for contributors to help us build the future of Swarms. By participating, you can earn rewards while contributing to a project that aims to revolutionize digital activity.
|
||||
|
||||
Here's how it works:
|
||||
|
||||
1. **Check out our Roadmap**: We've shared our roadmap detailing our short and long-term goals. These are the areas where we're seeking contributions.
|
||||
|
||||
2. **Pick a Task**: Choose a task from the roadmap that aligns with your skills and interests. If you're unsure, you can reach out to our team for guidance.
|
||||
|
||||
3. **Get to Work**: Once you've chosen a task, start working on it. Remember, quality is key. We're looking for contributions that truly make a difference.
|
||||
|
||||
4. **Submit your Contribution**: Once your work is complete, submit it for review. We'll evaluate your contribution based on its quality, relevance, and the value it brings to Swarms.
|
||||
|
||||
5. **Earn Rewards**: If your contribution is approved, you'll earn a bounty. The amount of the bounty depends on the complexity of the task, the quality of your work, and the value it brings to Swarms.
|
||||
|
||||
## The Three Phases of Our Bounty Program
|
||||
|
||||
### Phase 1: Building the Foundation
|
||||
In the first phase, our focus is on building the basic infrastructure of Swarms. This includes developing key components like the Swarms class, integrating essential tools, and establishing task completion and evaluation logic. We'll also start developing our testing and evaluation framework during this phase. If you're interested in foundational work and have a knack for building robust, scalable systems, this phase is for you.
|
||||
|
||||
### Phase 2: Enhancing the System
|
||||
In the second phase, we'll focus on enhancing Swarms by integrating more advanced features, improving the system's efficiency, and refining our testing and evaluation framework. This phase involves more complex tasks, so if you enjoy tackling challenging problems and contributing to the development of innovative features, this is the phase for you.
|
||||
|
||||
### Phase 3: Towards Super-Intelligence
|
||||
The third phase of our bounty program is the most exciting - this is where we aim to achieve super-intelligence. In this phase, we'll be working on improving the swarm's capabilities, expanding its skills, and fine-tuning the system based on real-world testing and feedback. If you're excited about the future of AI and want to contribute to a project that could potentially transform the digital world, this is the phase for you.
|
||||
|
||||
Remember, our roadmap is a guide, and we encourage you to bring your own ideas and creativity to the table. We believe that every contribution, no matter how small, can make a difference. So join us on this exciting journey and help us create the future of Swarms.
|
||||
|
||||
**To participate in our bounty program, visit the [Swarms Bounty Program Page](https://swarms.ai/bounty).** Let's build the future together!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Bounties for Roadmap Items
|
||||
|
||||
To accelerate the development of Swarms and to encourage more contributors to join our journey towards automating every digital activity in existence, we are announcing a Bounty Program for specific roadmap items. Each bounty will be rewarded based on the complexity and importance of the task. Below are the items available for bounty:
|
||||
|
||||
1. **Multi-Agent Debate Integration**: $2000
|
||||
2. **Meta Prompting Integration**: $1500
|
||||
3. **Swarms Class**: $1500
|
||||
4. **Integration of Additional Tools**: $1000
|
||||
5. **Task Completion and Evaluation Logic**: $2000
|
||||
6. **Ocean Integration**: $2500
|
||||
7. **Improved Communication**: $2000
|
||||
8. **Testing and Evaluation**: $1500
|
||||
9. **Worker Swarm Class**: $2000
|
||||
10. **Documentation**: $500
|
||||
|
||||
For each bounty task, there will be a strict evaluation process to ensure the quality of the contribution. This process includes a thorough review of the code and extensive testing to ensure it meets our standards.
|
||||
|
||||
# 3-Phase Testing Framework
|
||||
|
||||
To ensure the quality and efficiency of the Swarm, we will introduce a 3-phase testing framework which will also serve as our evaluation criteria for each of the bounty tasks.
|
||||
|
||||
## Phase 1: Unit Testing
|
||||
In this phase, individual modules will be tested to ensure that they work correctly in isolation. Unit tests will be designed for all functions and methods, with an emphasis on edge cases.
|
||||
|
||||
## Phase 2: Integration Testing
|
||||
After passing unit tests, we will test the integration of different modules to ensure they work correctly together. This phase will also test the interoperability of the Swarm with external systems and libraries.
|
||||
|
||||
## Phase 3: Benchmarking & Stress Testing
|
||||
In the final phase, we will perform benchmarking and stress tests. We'll push the limits of the Swarm under extreme conditions to ensure it performs well in real-world scenarios. This phase will measure the performance, speed, and scalability of the Swarm under high load conditions.
|
||||
|
||||
By following this 3-phase testing framework, we aim to develop a reliable, high-performing, and scalable Swarm that can automate all digital activities.
|
||||
|
||||
# Reverse Engineering to Reach Phase 3
|
||||
|
||||
To reach the Phase 3 level, we need to reverse engineer the tasks we need to complete. Here's an example of what this might look like:
|
||||
|
||||
1. **Set Clear Expectations**: Define what success looks like for each task. Be clear about the outputs and outcomes we expect. This will guide our testing and development efforts.
|
||||
|
||||
2. **Develop Testing Scenarios**: Create a comprehensive list of testing scenarios that cover both common and edge cases. This will help us ensure that our Swarm can handle a wide range of situations.
|
||||
|
||||
3. **Write Test Cases**: For each scenario, write detailed test cases that outline the exact steps to be followed, the inputs to be used, and the expected outputs.
|
||||
|
||||
4. **Execute the Tests**: Run the test cases on our Swarm, making note of any issues or bugs that arise.
|
||||
|
||||
5. **Iterate and Improve**: Based on the results of our tests, iterate and improve our Swarm. This may involve fixing bugs, optimizing code, or redesigning parts of our system.
|
||||
|
||||
6. **Repeat**: Repeat this process until our Swarm meets our expectations and passes all test cases.
|
||||
|
||||
By following these steps, we will systematically build, test, and improve our Swarm until it reaches the Phase 3 level. This methodical approach will help us ensure that we create a reliable, high-performing, and scalable Swarm that can truly automate all digital activities.
|
||||
|
||||
Let's shape the future of digital automation together!
|
@ -0,0 +1,122 @@
|
||||
# **Swarms Framework Development Strategy Checklist**
|
||||
|
||||
## **Introduction**
|
||||
|
||||
The development of the Swarms framework requires a systematic and granular approach to ensure that each component is robust and that the overall framework is efficient and scalable. This checklist will serve as a guide to building Swarms from the ground up, breaking down tasks into small, manageable pieces.
|
||||
|
||||
---
|
||||
|
||||
## **1. Agent Level Development**
|
||||
|
||||
### **1.1 Model Integration**
|
||||
- [ ] Research the most suitable models (e.g., OpenAI's GPT).
|
||||
- [ ] Design an API for the agent to call the model.
|
||||
- [ ] Implement error handling when model calls fail.
|
||||
- [ ] Test the model with sample data for accuracy and speed.
|
||||
|
||||
### **1.2 Vectorstore Implementation**
|
||||
- [ ] Design the schema for the vector storage system.
|
||||
- [ ] Implement storage methods to add, delete, and update vectors.
|
||||
- [ ] Develop retrieval methods with optimization for speed.
|
||||
- [ ] Create protocols for vector-based communication between agents.
|
||||
- [ ] Conduct stress tests to ascertain storage and retrieval speed.
|
||||
|
||||
### **1.3 Tools & Utilities Integration**
|
||||
- [ ] List out essential tools required for agent functionality.
|
||||
- [ ] Develop or integrate APIs for each tool.
|
||||
- [ ] Implement error handling and logging for tool interactions.
|
||||
- [ ] Validate tools integration with unit tests.
|
||||
|
||||
---
|
||||
|
||||
## **2. Worker Infrastructure Level Development**
|
||||
|
||||
### **2.1 Human Input Integration**
|
||||
- [ ] Design a UI/UX for human interaction with worker nodes.
|
||||
- [ ] Create APIs for input collection.
|
||||
- [ ] Implement input validation and error handling.
|
||||
- [ ] Test human input methods for clarity and ease of use.
|
||||
|
||||
### **2.2 Unique Identifier System**
|
||||
- [ ] Research optimal formats for unique ID generation.
|
||||
- [ ] Develop methods for generating and assigning IDs to agents.
|
||||
- [ ] Implement a tracking system to manage and monitor agents via IDs.
|
||||
- [ ] Validate the uniqueness and reliability of the ID system.
|
||||
|
||||
### **2.3 Asynchronous Operation Tools**
|
||||
- [ ] Incorporate libraries/frameworks to enable asynchrony.
|
||||
- [ ] Ensure tasks within an agent can run in parallel without conflict.
|
||||
- [ ] Test asynchronous operations for efficiency improvements.
|
||||
|
||||
---
|
||||
|
||||
## **3. Swarm Level Development**
|
||||
|
||||
### **3.1 Orchestrator Design & Development**
|
||||
- [ ] Draft a blueprint of orchestrator functionalities.
|
||||
- [ ] Implement methods for task distribution among worker nodes.
|
||||
- [ ] Develop communication protocols for the orchestrator to monitor workers.
|
||||
- [ ] Create feedback systems to detect and address worker node failures.
|
||||
- [ ] Test orchestrator with a mock swarm to ensure efficient task allocation.
|
||||
|
||||
### **3.2 Communication Layer Development**
|
||||
- [ ] Select a suitable communication protocol/framework (e.g., gRPC, WebSockets).
|
||||
- [ ] Design the architecture for scalable, low-latency communication.
|
||||
- [ ] Implement methods for sending, receiving, and broadcasting messages.
|
||||
- [ ] Test communication layer for reliability, speed, and error handling.
|
||||
|
||||
### **3.3 Task Management Protocols**
|
||||
- [ ] Develop a system to queue, prioritize, and allocate tasks.
|
||||
- [ ] Implement methods for real-time task status tracking.
|
||||
- [ ] Create a feedback loop for completed tasks.
|
||||
- [ ] Test task distribution, execution, and feedback systems for efficiency.
|
||||
|
||||
---
|
||||
|
||||
## **4. Hivemind Level Development**
|
||||
|
||||
### **4.1 Hivemind Orchestrator Development**
|
||||
- [ ] Extend swarm orchestrator functionalities to manage multiple swarms.
|
||||
- [ ] Create inter-swarm communication protocols.
|
||||
- [ ] Implement load balancing mechanisms to distribute tasks across swarms.
|
||||
- [ ] Validate hivemind orchestrator functionalities with multi-swarm setups.
|
||||
|
||||
### **4.2 Inter-Swarm Communication Protocols**
|
||||
- [ ] Design methods for swarms to exchange data.
|
||||
- [ ] Implement data reconciliation methods for swarms working on shared tasks.
|
||||
- [ ] Test inter-swarm communication for efficiency and data integrity.
|
||||
|
||||
---
|
||||
|
||||
## **5. Scalability & Performance Testing**
|
||||
|
||||
- [ ] Simulate heavy loads to test the limits of the framework.
|
||||
- [ ] Identify and address bottlenecks in both communication and computation.
|
||||
- [ ] Conduct speed tests under different conditions.
|
||||
- [ ] Test the system's responsiveness under various levels of stress.
|
||||
|
||||
---
|
||||
|
||||
## **6. Documentation & User Guide**
|
||||
|
||||
- [ ] Develop detailed documentation covering architecture, setup, and usage.
|
||||
- [ ] Create user guides with step-by-step instructions.
|
||||
- [ ] Incorporate visual aids, diagrams, and flowcharts for clarity.
|
||||
- [ ] Update documentation regularly with new features and improvements.
|
||||
|
||||
---
|
||||
|
||||
## **7. Continuous Integration & Deployment**
|
||||
|
||||
- [ ] Setup CI/CD pipelines for automated testing and deployment.
|
||||
- [ ] Ensure automatic rollback in case of deployment failures.
|
||||
- [ ] Integrate code quality and security checks in the pipeline.
|
||||
- [ ] Document deployment strategies and best practices.
|
||||
|
||||
---
|
||||
|
||||
## **Conclusion**
|
||||
|
||||
The Swarms framework represents a monumental leap in agent-based computation. This checklist provides a thorough roadmap for the framework's development, ensuring that every facet is addressed in depth. Through diligent adherence to this guide, the Swarms vision can be realized as a powerful, scalable, and robust system ready to tackle the challenges of tomorrow.
|
||||
|
||||
(Note: This document, given the word limit, provides a high-level overview. A full 5000-word document would delve into even more intricate details, nuances, potential pitfalls, and include considerations for security, user experience, compatibility, etc.)
|
@ -0,0 +1,100 @@
|
||||
# Costs Structure of Deploying Autonomous Agents
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. Introduction
|
||||
2. Our Time: Generating System Prompts and Custom Tools
|
||||
3. Consultancy Fees
|
||||
4. Model Inference Infrastructure
|
||||
5. Deployment and Continual Maintenance
|
||||
6. Output Metrics: Blogs Generation Rates
|
||||
|
||||
---
|
||||
|
||||
## 1. Introduction
|
||||
|
||||
Autonomous agents are revolutionizing various industries, from self-driving cars to chatbots and customer service solutions. The prospect of automation and improved efficiency makes these agents attractive investments. However, like any other technological solution, deploying autonomous agents involves several cost elements that organizations need to consider carefully. This comprehensive guide aims to provide an exhaustive outline of the costs associated with deploying autonomous agents.
|
||||
|
||||
---
|
||||
|
||||
## 2. Our Time: Generating System Prompts and Custom Tools
|
||||
|
||||
### Description
|
||||
|
||||
The deployment of autonomous agents often requires a substantial investment of time to develop system prompts and custom tools tailored to specific operational needs.
|
||||
|
||||
### Costs
|
||||
|
||||
| Task | Time Required (Hours) | Cost per Hour ($) | Total Cost ($) |
|
||||
| ------------------------ | --------------------- | ----------------- | -------------- |
|
||||
| System Prompts Design | 50 | 100 | 5,000 |
|
||||
| Custom Tools Development | 100 | 100 | 10,000 |
|
||||
| **Total** | **150** | | **15,000** |
|
||||
|
||||
---
|
||||
|
||||
## 3. Consultancy Fees
|
||||
|
||||
### Description
|
||||
|
||||
Consultation is often necessary for navigating the complexities of autonomous agents. This includes system assessment, customization, and other essential services.
|
||||
|
||||
### Costs
|
||||
|
||||
| Service | Fees ($) |
|
||||
| -------------------- | --------- |
|
||||
| Initial Assessment | 5,000 |
|
||||
| System Customization | 7,000 |
|
||||
| Training | 3,000 |
|
||||
| **Total** | **15,000**|
|
||||
|
||||
---
|
||||
|
||||
## 4. Model Inference Infrastructure
|
||||
|
||||
### Description
|
||||
|
||||
The hardware and software needed for the agent's functionality, known as the model inference infrastructure, form a significant part of the costs.
|
||||
|
||||
### Costs
|
||||
|
||||
| Component | Cost ($) |
|
||||
| -------------------- | --------- |
|
||||
| Hardware | 10,000 |
|
||||
| Software Licenses | 2,000 |
|
||||
| Cloud Services | 3,000 |
|
||||
| **Total** | **15,000**|
|
||||
|
||||
---
|
||||
|
||||
## 5. Deployment and Continual Maintenance
|
||||
|
||||
### Description
|
||||
|
||||
Once everything is in place, deploying the autonomous agents and their ongoing maintenance are the next major cost factors.
|
||||
|
||||
### Costs
|
||||
|
||||
| Task | Monthly Cost ($) | Annual Cost ($) |
|
||||
| ------------------- | ---------------- | --------------- |
|
||||
| Deployment | 5,000 | 60,000 |
|
||||
| Ongoing Maintenance | 1,000 | 12,000 |
|
||||
| **Total** | **6,000** | **72,000** |
|
||||
|
||||
---
|
||||
|
||||
## 6. Output Metrics: Blogs Generation Rates
|
||||
|
||||
### Description
|
||||
|
||||
To provide a sense of what an investment in autonomous agents can yield, we offer the following data regarding blogs that can be generated as an example of output.
|
||||
|
||||
### Blogs Generation Rates
|
||||
|
||||
| Timeframe | Number of Blogs |
|
||||
|-----------|-----------------|
|
||||
| Per Day | 20 |
|
||||
| Per Week | 140 |
|
||||
| Per Month | 600 |
|
||||
|
||||
|
@ -0,0 +1,112 @@
|
||||
# Swarms Data Room
|
||||
|
||||
## Table of Contents
|
||||
|
||||
**Introduction**
|
||||
|
||||
- Overview of the Company
|
||||
|
||||
- Vision and Mission Statement
|
||||
|
||||
- Executive Summary
|
||||
|
||||
**Corporate Documents**
|
||||
|
||||
- Articles of Incorporation
|
||||
|
||||
- Bylaws
|
||||
|
||||
- Shareholder Agreements
|
||||
|
||||
- Board Meeting Minutes
|
||||
|
||||
- Company Structure and Org Chart
|
||||
|
||||
**Financial Information**
|
||||
|
||||
- Historical Financial Statements
|
||||
|
||||
- Income Statements
|
||||
|
||||
- Balance Sheets
|
||||
|
||||
- Cash Flow Statements
|
||||
|
||||
- Financial Projections and Forecasts
|
||||
|
||||
- Cap Table
|
||||
|
||||
- Funding History and Use of Funds
|
||||
|
||||
**Products and Services**
|
||||
|
||||
- Detailed Descriptions of Products/Services
|
||||
|
||||
- Product Development Roadmap
|
||||
|
||||
- User Manuals and Technical Specifications
|
||||
|
||||
- Case Studies and Use Cases
|
||||
|
||||
|
||||
## **Introdution**
|
||||
Swarms provides automation-as-a-service through swarms of autonomous agents that work together as a team. We enable our customers to build, deploy, and scale production-grade multi-agent applications to automate real-world tasks.
|
||||
|
||||
### **Vision**
|
||||
Our vision for 2024 is to provide the most reliable infrastructure for deploying autonomous agents into the real world through the Swarm Cloud, our premier cloud platform for the scalable deployment of Multi-Modal Autonomous Agents. The platform focuses on delivering maximum value to users by only taking a small fee when utilizing the agents for the hosted compute power needed to host the agents.
|
||||
|
||||
### **Executive Summary**
|
||||
The Swarm Corporation aims to enable AI models to automate complex workflows and operations, not just singular low-value tasks. We believe collaboration between multiple agents can overcome limitations of individual agents for reasoning, planning, etc. This will allow automation of processes in mission-critical industries like security, logistics, and manufacturing where AI adoption is currently low.
|
||||
|
||||
We provide an open source framework to deploy production-grade multi-modal agents in just a few lines of code. This builds our user base, recruits talent, gets customer feedback to improve products, gains awareness and trust.
|
||||
|
||||
Our business model focuses on customer satisfaction, openness, integration with other tools/platforms, and production-grade reliability.
|
||||
|
||||
Go-to-market strategy is to get the framework to product-market fit with over 50K weekly recurring users, then secure high-value contracts in target industries. Long-term monetization via microtransactions, usage-based pricing, subscriptions.
|
||||
|
||||
The team has thousands of hours building and optimizing autonomous agents. Leadership includes AI engineers, product experts, open source contributors and community builders.
|
||||
|
||||
Key milestones: get 80K framework users in January 2024, start contracts in target verticals, introduce commercial products in 2025 with various pricing models.
|
||||
|
||||
### **Resources**
|
||||
- [Swarm Pre-Seed Deck](https://drive.google.com/file/d/1n8o2mjORbG96uDfx4TabjnyieludYaZz/view?usp=sharing)
|
||||
- [Swarm Memo](https://docs.google.com/document/d/1hS_nv_lFjCqLfnJBoF6ULY9roTbSgSuCkvXvSUSc7Lo/edit?usp=sharing)
|
||||
|
||||
|
||||
|
||||
|
||||
## **Financial Documents**
|
||||
This section is dedicated entirely for corporate documents.
|
||||
|
||||
- [Cap Table](https://docs.google.com/spreadsheets/d/1wuTWbfhYaY5Xp6nSQ9R0wDtSpwSS9coHxsjKd0UbIDc/edit?usp=sharing)
|
||||
|
||||
- [Cashflow Prediction Sheet](https://docs.google.com/spreadsheets/d/1HQEHCIXXMHajXMl5sj8MEfcQtWfOnD7GjHtNiocpD60/edit?usp=sharing)
|
||||
|
||||
|
||||
------
|
||||
|
||||
## **Product**
|
||||
Swarms is an open source framework for developers in python to enable seamless, reliable, and scalable multi-agent orchestration through modularity, customization, and precision.
|
||||
|
||||
- [Swarms Github Page:](https://github.com/kyegomez/swarms)
|
||||
- [Swarms Memo](https://docs.google.com/document/d/1hS_nv_lFjCqLfnJBoF6ULY9roTbSgSuCkvXvSUSc7Lo/edit)
|
||||
- [Swarms Project Board](https://github.com/users/kyegomez/projects/1)
|
||||
- [Swarms Website](https://www.swarms.world/g)
|
||||
- [Swarm Ecosystem](https://github.com/kyegomez/swarm-ecosystem)
|
||||
- [Swarm Core](https://github.com/kyegomez/swarms-core)
|
||||
|
||||
### Product Growth Metrics
|
||||
| Name | Description | Link |
|
||||
|----------------------------------|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
|
||||
| Total Downloads of all time | Total number of downloads for the product over its entire lifespan. | [![Downloads](https://static.pepy.tech/badge/swarms)](https://pepy.tech/project/swarms) |
|
||||
| Downloads this month | Number of downloads for the product in the current month. | [![Downloads](https://static.pepy.tech/badge/swarms/month)](https://pepy.tech/project/swarms) |
|
||||
| Total Downloads this week | Total number of downloads for the product in the current week. | [![Downloads](https://static.pepy.tech/badge/swarms/week)](https://pepy.tech/project/swarms) |
|
||||
| Github Forks | Number of times the product's codebase has been copied for optimization, contribution, or usage. | [![GitHub forks](https://img.shields.io/github/forks/kyegomez/swarms)](https://github.com/kyegomez/swarms/network) |
|
||||
| Github Stars | Number of users who have 'liked' the project. | [![GitHub stars](https://img.shields.io/github/stars/kyegomez/swarms)](https://github.com/kyegomez/swarms/stargazers) |
|
||||
| Pip Module Metrics | Various project statistics such as watchers, number of contributors, date repository was created, and more. | [CLICK HERE](https://libraries.io/github/kyegomez/swarms) |
|
||||
| Contribution Based Statistics | Statistics like number of contributors, lines of code changed, etc. | [HERE](https://github.com/kyegomez/swarms/graphs/contributors) |
|
||||
| Github Community insights | Insights into the Github community around the product. | [Github Community insights](https://github.com/kyegomez/swarms/graphs/community) |
|
||||
| Github Traffic Metrics | Metrics related to traffic, such as views and clones on Github. | [Github Traffic Metrics](https://github.com/kyegomez/swarms/graphs/traffic) |
|
||||
| Issues with the framework | Current open issues for the product on Github. | [![GitHub issues](https://img.shields.io/github/issues/kyegomez/swarms)](https://github.com/kyegomez/swarms/issues) |
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Demo Ideas
|
||||
|
||||
* We could also try to create an AI influencer run by a swarm, let it create a whole identity and generate images, memes, and other content for Twitter, Reddit, etc.
|
||||
|
||||
* had a thought that we should have either a more general one of these or a swarm or both -- need something connecting all the calendars, events, and initiatives of all the AI communities, langchain, laion, eluther, lesswrong, gato, rob miles, chatgpt hackers, etc etc
|
||||
|
||||
* Swarm of AI influencers to spread marketing
|
||||
|
||||
* Delegation System to better organize teams: Start with a team of passionate humans and let them self-report their skills/strengths so the agent has a concept of who to delegate to, then feed the agent a huge task list (like the bullet list a few messages above) that it breaks down into actionable steps and "prompts" specific team members to complete tasks. Could even suggest breakout teams of a few people with complementary skills to tackle more complex tasks. There can also be a live board that updates each time a team member completes something, to encourage momentum and keep track of progress
|
@ -0,0 +1,152 @@
|
||||
# Design Philosophy Document for Swarms
|
||||
|
||||
## Usable
|
||||
|
||||
### Objective
|
||||
|
||||
Our goal is to ensure that Swarms is intuitive and easy to use for all users, regardless of their level of technical expertise. This includes the developers who implement Swarms in their applications, as well as end users who interact with the implemented systems.
|
||||
|
||||
### Tactics
|
||||
|
||||
- Clear and Comprehensive Documentation: We will provide well-written and easily accessible documentation that guides users through using and understanding Swarms.
|
||||
- User-Friendly APIs: We'll design clean and self-explanatory APIs that help developers to understand their purpose quickly.
|
||||
- Prompt and Effective Support: We will ensure that support is readily available to assist users when they encounter problems or need help with Swarms.
|
||||
|
||||
## Reliable
|
||||
|
||||
### Objective
|
||||
|
||||
Swarms should be dependable and trustworthy. Users should be able to count on Swarms to perform consistently and without error or failure.
|
||||
|
||||
### Tactics
|
||||
|
||||
- Robust Error Handling: We will focus on error prevention, detection, and recovery to minimize failures in Swarms.
|
||||
- Comprehensive Testing: We will apply various testing methodologies such as unit testing, integration testing, and stress testing to validate the reliability of our software.
|
||||
- Continuous Integration/Continuous Delivery (CI/CD): We will use CI/CD pipelines to ensure that all changes are tested and validated before they're merged into the main branch.
|
||||
|
||||
## Fast
|
||||
|
||||
### Objective
|
||||
|
||||
Swarms should offer high performance and rapid response times. The system should be able to handle requests and tasks swiftly.
|
||||
|
||||
### Tactics
|
||||
|
||||
- Efficient Algorithms: We will focus on optimizing our algorithms and data structures to ensure they run as quickly as possible.
|
||||
- Caching: Where appropriate, we will use caching techniques to speed up response times.
|
||||
- Profiling and Performance Monitoring: We will regularly analyze the performance of Swarms to identify bottlenecks and opportunities for improvement.
|
||||
|
||||
## Scalable
|
||||
|
||||
### Objective
|
||||
|
||||
Swarms should be able to grow in capacity and complexity without compromising performance or reliability. It should be able to handle increased workloads gracefully.
|
||||
|
||||
### Tactics
|
||||
|
||||
- Modular Architecture: We will design Swarms using a modular architecture that allows for easy scaling and modification.
|
||||
- Load Balancing: We will distribute tasks evenly across available resources to prevent overload and maximize throughput.
|
||||
- Horizontal and Vertical Scaling: We will design Swarms to be capable of both horizontal (adding more machines) and vertical (adding more power to an existing machine) scaling.
|
||||
|
||||
### Philosophy
|
||||
|
||||
Swarms is designed with a philosophy of simplicity and reliability. We believe that software should be a tool that empowers users, not a hurdle that they need to overcome. Therefore, our focus is on usability, reliability, speed, and scalability. We want our users to find Swarms intuitive and dependable, fast and adaptable to their needs. This philosophy guides all of our design and development decisions.
|
||||
|
||||
# Swarm Architecture Design Document
|
||||
|
||||
## Overview
|
||||
|
||||
The goal of the Swarm Architecture is to provide a flexible and scalable system to build swarm intelligence models that can solve complex problems. This document details the proposed design to create a plug-and-play system, which makes it easy to create custom swarms, and provides pre-configured swarms with multi-modal agents.
|
||||
|
||||
## Design Principles
|
||||
|
||||
- **Modularity**: The system will be built in a modular fashion, allowing various components to be easily swapped or upgraded.
|
||||
- **Interoperability**: Different swarm classes and components should be able to work together seamlessly.
|
||||
- **Scalability**: The design should support the growth of the system by adding more components or swarms.
|
||||
- **Ease of Use**: Users should be able to easily create their own swarms or use pre-configured ones with minimal configuration.
|
||||
|
||||
## Design Components
|
||||
|
||||
### BaseSwarm
|
||||
|
||||
The BaseSwarm is an abstract base class which defines the basic structure of a swarm and the methods that need to be implemented. Any new swarm should inherit from this class and implement the required methods.
|
||||
|
||||
### Swarm Classes
|
||||
|
||||
Various Swarm classes can be implemented inheriting from the BaseSwarm class. Each swarm class should implement the required methods for initializing the components, worker nodes, and boss node, and running the swarm.
|
||||
|
||||
Pre-configured swarm classes with multi-modal agents can be provided for ease of use. These classes come with a default configuration of tools and agents, which can be used out of the box.
|
||||
|
||||
### Tools and Agents
|
||||
|
||||
Tools and agents are the components that provide the actual functionality to the swarms. They can be language models, AI assistants, vector stores, or any other components that can help in problem solving.
|
||||
|
||||
To make the system plug-and-play, a standard interface should be defined for these components. Any new tool or agent should implement this interface, so that it can be easily plugged into the system.
|
||||
|
||||
## Usage
|
||||
|
||||
Users can either use pre-configured swarms or create their own custom swarms.
|
||||
|
||||
To use a pre-configured swarm, they can simply instantiate the corresponding swarm class and call the run method with the required objective.
|
||||
|
||||
To create a custom swarm, they need to:
|
||||
|
||||
1. Define a new swarm class inheriting from BaseSwarm.
|
||||
2. Implement the required methods for the new swarm class.
|
||||
3. Instantiate the swarm class and call the run method.
|
||||
|
||||
### Example
|
||||
|
||||
```python
|
||||
# Using pre-configured swarm
|
||||
swarm = PreConfiguredSwarm(openai_api_key)
|
||||
swarm.run_swarms(objective)
|
||||
|
||||
# Creating custom swarm
|
||||
class CustomSwarm(BaseSwarm):
|
||||
# Implement required methods
|
||||
|
||||
swarm = CustomSwarm(openai_api_key)
|
||||
swarm.run_swarms(objective)
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
This Swarm Architecture design provides a scalable and flexible system for building swarm intelligence models. The plug-and-play design allows users to easily use pre-configured swarms or create their own custom swarms.
|
||||
|
||||
|
||||
# Swarming Architectures
|
||||
Sure, below are five different swarm architectures with their base requirements and an abstract class that processes these components:
|
||||
|
||||
1. **Hierarchical Swarm**: This architecture is characterized by a boss/worker relationship. The boss node takes high-level decisions and delegates tasks to the worker nodes. The worker nodes perform tasks and report back to the boss node.
|
||||
- Requirements: Boss node (can be a large language model), worker nodes (can be smaller language models), and a task queue for task management.
|
||||
|
||||
2. **Homogeneous Swarm**: In this architecture, all nodes in the swarm are identical and contribute equally to problem-solving. Each node has the same capabilities.
|
||||
- Requirements: Homogeneous nodes (can be language models of the same size), communication protocol for nodes to share information.
|
||||
|
||||
3. **Heterogeneous Swarm**: This architecture contains different types of nodes, each with its specific capabilities. This diversity can lead to more robust problem-solving.
|
||||
- Requirements: Different types of nodes (can be different types and sizes of language models), a communication protocol, and a mechanism to delegate tasks based on node capabilities.
|
||||
|
||||
4. **Competitive Swarm**: In this architecture, nodes compete with each other to find the best solution. The system may use a selection process to choose the best solutions.
|
||||
- Requirements: Nodes (can be language models), a scoring mechanism to evaluate node performance, a selection mechanism.
|
||||
|
||||
5. **Cooperative Swarm**: In this architecture, nodes work together and share information to find solutions. The focus is on cooperation rather than competition.
|
||||
- Requirements: Nodes (can be language models), a communication protocol, a consensus mechanism to agree on solutions.
|
||||
|
||||
|
||||
6. **Grid-based Swarm**: This architecture positions agents on a grid, where they can only interact with their neighbors. This is useful for simulations, especially in fields like ecology or epidemiology.
|
||||
- Requirements: Agents (can be language models), a grid structure, and a neighborhood definition (i.e., how to identify neighboring agents).
|
||||
|
||||
7. **Particle Swarm Optimization (PSO) Swarm**: In this architecture, each agent represents a potential solution to an optimization problem. Agents move in the solution space based on their own and their neighbors' past performance. PSO is especially useful for continuous numerical optimization problems.
|
||||
- Requirements: Agents (each representing a solution), a definition of the solution space, an evaluation function to rate the solutions, a mechanism to adjust agent positions based on performance.
|
||||
|
||||
8. **Ant Colony Optimization (ACO) Swarm**: Inspired by ant behavior, this architecture has agents leave a pheromone trail that other agents follow, reinforcing the best paths. It's useful for problems like the traveling salesperson problem.
|
||||
- Requirements: Agents (can be language models), a representation of the problem space, a pheromone updating mechanism.
|
||||
|
||||
9. **Genetic Algorithm (GA) Swarm**: In this architecture, agents represent potential solutions to a problem. They can 'breed' to create new solutions and can undergo 'mutations'. GA swarms are good for search and optimization problems.
|
||||
- Requirements: Agents (each representing a potential solution), a fitness function to evaluate solutions, a crossover mechanism to breed solutions, and a mutation mechanism.
|
||||
|
||||
10. **Stigmergy-based Swarm**: In this architecture, agents communicate indirectly by modifying the environment, and other agents react to such modifications. It's a decentralized method of coordinating tasks.
|
||||
- Requirements: Agents (can be language models), an environment that agents can modify, a mechanism for agents to perceive environment changes.
|
||||
|
||||
These architectures all have unique features and requirements, but they share the need for agents (often implemented as language models) and a mechanism for agents to communicate or interact, whether it's directly through messages, indirectly through the environment, or implicitly through a shared solution space. Some also require specific data structures, like a grid or problem space, and specific algorithms, like for evaluating solutions or updating agent positions.
|
@ -0,0 +1,469 @@
|
||||
|
||||
|
||||
# Swarms Monetization Strategy
|
||||
|
||||
This strategy includes a variety of business models, potential revenue streams, cashflow structures, and customer identification methods. Let's explore these further.
|
||||
|
||||
## Business Models
|
||||
|
||||
1. **Platform as a Service (PaaS):** Provide the Swarms AI platform on a subscription basis, charged monthly or annually. This could be tiered based on usage and access to premium features.
|
||||
|
||||
2. **API Usage-based Pricing:** Charge customers based on their usage of the Swarms API. The more requests made, the higher the fee.
|
||||
|
||||
3. **Managed Services:** Offer complete end-to-end solutions where you manage the entire AI infrastructure for the clients. This could be on a contract basis with a recurring fee.
|
||||
|
||||
4. **Training and Certification:** Provide Swarms AI training and certification programs for interested developers and businesses. These could be monetized as separate courses or subscription-based access.
|
||||
|
||||
5. **Partnerships:** Collaborate with large enterprises and offer them dedicated Swarm AI services. These could be performance-based contracts, ensuring a mutually beneficial relationship.
|
||||
|
||||
6. **Data as a Service (DaaS):** Leverage the data generated by Swarms for insights and analytics, providing valuable business intelligence to clients.
|
||||
|
||||
## Potential Revenue Streams
|
||||
|
||||
1. **Subscription Fees:** This would be the main revenue stream from providing the Swarms platform as a service.
|
||||
|
||||
2. **Usage Fees:** Additional revenue can come from usage fees for businesses that have high demand for Swarms API.
|
||||
|
||||
3. **Contract Fees:** From offering managed services and bespoke solutions to businesses.
|
||||
|
||||
4. **Training Fees:** Revenue from providing training and certification programs to developers and businesses.
|
||||
|
||||
5. **Partnership Contracts:** Large-scale projects with enterprises, involving dedicated Swarm AI services, could provide substantial income.
|
||||
|
||||
6. **Data Insights:** Revenue from selling valuable business intelligence derived from Swarm's aggregated and anonymized data.
|
||||
|
||||
## Potential Customers
|
||||
|
||||
1. **Businesses Across Sectors:** Any business seeking to leverage AI for automation, efficiency, and data insights could be a potential customer. This includes sectors like finance, eCommerce, logistics, healthcare, and more.
|
||||
|
||||
2. **Developers:** Both freelance and those working in organizations could use Swarms to enhance their projects and services.
|
||||
|
||||
3. **Enterprises:** Large enterprises looking to automate and optimize their operations could greatly benefit from Swarms.
|
||||
|
||||
4. **Educational Institutions:** Universities and research institutions could leverage Swarms for research and teaching purposes.
|
||||
|
||||
## Roadmap
|
||||
|
||||
1. **Landing Page Creation:** Develop a dedicated product page on apac.ai for Swarms.
|
||||
|
||||
2. **Hosted Swarms API:** Launch a cloud-based Swarms API service. It should be highly reliable, with robust documentation to attract daily users.
|
||||
|
||||
3. **Consumer and Enterprise Subscription Service:** Launch a comprehensive subscription service on The Domain. This would provide users with access to a wide array of APIs and data streams.
|
||||
|
||||
4. **Dedicated Capacity Deals:** Partner with large enterprises to offer them dedicated Swarm AI solutions for automating their operations.
|
||||
|
||||
5. **Enterprise Partnerships:** Develop partnerships with large enterprises for extensive contract-based projects.
|
||||
|
||||
6. **Integration with Collaboration Platforms:** Develop Swarms bots for platforms like Discord and Slack, charging users a subscription fee for access.
|
||||
|
||||
7. **Personal Data Instances:** Offer users dedicated instances of all their data that the Swarm can query as needed.
|
||||
|
||||
8. **Browser Extension:** Develop a browser extension that integrates with the Swarms platform, offering users a more seamless experience.
|
||||
|
||||
Remember, customer satisfaction and a value-centric approach are at the core of any successful monetization strategy. It's essential to continuously iterate and improve the product based on customer feedback and evolving market needs.
|
||||
|
||||
----
|
||||
|
||||
# Other ideas
|
||||
|
||||
1. **Platform as a Service (PaaS):** Create a cloud-based platform that allows users to build, run, and manage applications without the complexity of maintaining the infrastructure. You could charge users a subscription fee for access to the platform and provide different pricing tiers based on usage levels. This could be an attractive solution for businesses that do not have the capacity to build or maintain their own swarm intelligence solutions.
|
||||
|
||||
2. **Professional Services:** Offer consultancy and implementation services to businesses looking to utilize the Swarm technology. This could include assisting with integration into existing systems, offering custom development services, or helping customers to build specific solutions using the framework.
|
||||
|
||||
3. **Education and Training:** Create a certification program for developers or companies looking to become proficient with the Swarms framework. This could be sold as standalone courses, or bundled with other services.
|
||||
|
||||
4. **Managed Services:** Some companies may prefer to outsource the management of their Swarm-based systems. A managed services solution could take care of all the technical aspects, from hosting the solution to ensuring it runs smoothly, allowing the customer to focus on their core business.
|
||||
|
||||
5. **Data Analysis and Insights:** Swarm intelligence can generate valuable data and insights. By anonymizing and aggregating this data, you could provide industry reports, trend analysis, and other valuable insights to businesses.
|
||||
|
||||
As for the type of platform, Swarms can be offered as a cloud-based solution given its scalability and flexibility. This would also allow you to apply a SaaS/PaaS type monetization model, which provides recurring revenue.
|
||||
|
||||
Potential customers could range from small to large enterprises in various sectors such as logistics, eCommerce, finance, and technology, who are interested in leveraging artificial intelligence and machine learning for complex problem solving, optimization, and decision-making.
|
||||
|
||||
**Product Brief Monetization Strategy:**
|
||||
|
||||
Product Name: Swarms.AI Platform
|
||||
|
||||
Product Description: A cloud-based AI and ML platform harnessing the power of swarm intelligence.
|
||||
|
||||
1. **Platform as a Service (PaaS):** Offer tiered subscription plans (Basic, Premium, Enterprise) to accommodate different usage levels and business sizes.
|
||||
|
||||
2. **Professional Services:** Offer consultancy and custom development services to tailor the Swarms solution to the specific needs of the business.
|
||||
|
||||
3. **Education and Training:** Launch an online Swarms.AI Academy with courses and certifications for developers and businesses.
|
||||
|
||||
4. **Managed Services:** Provide a premium, fully-managed service offering that includes hosting, maintenance, and 24/7 support.
|
||||
|
||||
5. **Data Analysis and Insights:** Offer industry reports and customized insights generated from aggregated and anonymized Swarm data.
|
||||
|
||||
Potential Customers: Enterprises in sectors such as logistics, eCommerce, finance, and technology. This can be sold globally, provided there's an internet connection.
|
||||
|
||||
Marketing Channels: Online marketing (SEO, Content Marketing, Social Media), Partnerships with tech companies, Direct Sales to Enterprises.
|
||||
|
||||
This strategy is designed to provide multiple revenue streams, while ensuring the Swarms.AI platform is accessible and useful to a range of potential customers.
|
||||
|
||||
1. **AI Solution as a Service:** By offering the Swarms framework as a service, businesses can access and utilize the power of multiple LLM agents without the need to maintain the infrastructure themselves. Subscription can be tiered based on usage and additional features.
|
||||
|
||||
2. **Integration and Custom Development:** Offer integration services to businesses wanting to incorporate the Swarms framework into their existing systems. Also, you could provide custom development for businesses with specific needs not met by the standard framework.
|
||||
|
||||
3. **Training and Certification:** Develop an educational platform offering courses, webinars, and certifications on using the Swarms framework. This can serve both developers seeking to broaden their skills and businesses aiming to train their in-house teams.
|
||||
|
||||
4. **Managed Swarms Solutions:** For businesses that prefer to outsource their AI needs, provide a complete solution which includes the development, maintenance, and continuous improvement of swarms-based applications.
|
||||
|
||||
5. **Data Analytics Services:** Leveraging the aggregated insights from the AI swarms, you could offer data analytics services. Businesses can use these insights to make informed decisions and predictions.
|
||||
|
||||
**Type of Platform:**
|
||||
|
||||
Cloud-based platform or Software as a Service (SaaS) will be a suitable model. It offers accessibility, scalability, and ease of updates.
|
||||
|
||||
**Target Customers:**
|
||||
|
||||
The technology can be beneficial for businesses across sectors like eCommerce, technology, logistics, finance, healthcare, and education, among others.
|
||||
|
||||
**Product Brief Monetization Strategy:**
|
||||
|
||||
Product Name: Swarms.AI
|
||||
|
||||
1. **AI Solution as a Service:** Offer different tiered subscriptions (Standard, Premium, and Enterprise) each with varying levels of usage and features.
|
||||
|
||||
2. **Integration and Custom Development:** Offer custom development and integration services, priced based on the scope and complexity of the project.
|
||||
|
||||
3. **Training and Certification:** Launch the Swarms.AI Academy with courses and certifications, available for a fee.
|
||||
|
||||
4. **Managed Swarms Solutions:** Offer fully managed solutions tailored to business needs, priced based on scope and service level agreements.
|
||||
|
||||
5. **Data Analytics Services:** Provide insightful reports and data analyses, which can be purchased on a one-off basis or through a subscription.
|
||||
|
||||
By offering a variety of services and payment models, Swarms.AI will be able to cater to a diverse range of business needs, from small start-ups to large enterprises. Marketing channels would include digital marketing, partnerships with technology companies, presence in tech events, and direct sales to targeted industries.
|
||||
|
||||
|
||||
|
||||
# Roadmap
|
||||
|
||||
* Create a landing page for swarms apac.ai/product/swarms
|
||||
|
||||
* Create Hosted Swarms API for anybody to just use without need for mega gpu infra, charge usage based pricing. Prerequisites for success => Swarms has to be extremely reliable + we need world class documentation and many daily users => how do we get many daily users? We provide a seamless and fluid experience, how do we create a seamless and fluid experience? We write good code that is modular, provides feedback to the user in times of distress, and ultimately accomplishes the user's tasks.
|
||||
|
||||
* Hosted consumer and enterprise subscription as a service on The Domain, where users can interact with 1000s of APIs and ingest 1000s of different data streams.
|
||||
|
||||
* Hosted dedicated capacity deals with mega enterprises on automating many operations with Swarms for monthly subscription 300,000+$
|
||||
|
||||
* Partnerships with enterprises, massive contracts with performance based fee
|
||||
|
||||
* Have discord bot and or slack bot with users personal data, charge subscription + browser extension
|
||||
|
||||
* each user gets a dedicated ocean instance of all their data so the swarm can query it as needed.
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
|
||||
# Swarms Monetization Strategy: A Revolutionary AI-powered Future
|
||||
|
||||
Swarms is a powerful AI platform leveraging the transformative potential of Swarm Intelligence. Our ambition is to monetize this groundbreaking technology in ways that generate significant cashflow while providing extraordinary value to our customers.
|
||||
|
||||
Here we outline our strategic monetization pathways and provide a roadmap that plots our course to future success.
|
||||
|
||||
---
|
||||
|
||||
## I. Business Models
|
||||
|
||||
1. **Platform as a Service (PaaS):** We provide the Swarms platform as a service, billed on a monthly or annual basis. Subscriptions can range from $50 for basic access, to $500+ for premium features and extensive usage.
|
||||
|
||||
2. **API Usage-based Pricing:** Customers are billed according to their use of the Swarms API. Starting at $0.01 per request, this creates a cashflow model that rewards extensive platform usage.
|
||||
|
||||
3. **Managed Services:** We offer end-to-end solutions, managing clients' entire AI infrastructure. Contract fees start from $100,000 per month, offering both a sustainable cashflow and considerable savings for our clients.
|
||||
|
||||
4. **Training and Certification:** A Swarms AI training and certification program is available for developers and businesses. Course costs can range from $200 to $2,000, depending on course complexity and duration.
|
||||
|
||||
5. **Partnerships:** We forge collaborations with large enterprises, offering dedicated Swarm AI services. These performance-based contracts start from $1,000,000, creating a potentially lucrative cashflow stream.
|
||||
|
||||
6. **Data as a Service (DaaS):** Swarms generated data are mined for insights and analytics, with business intelligence reports offered from $500 each.
|
||||
|
||||
---
|
||||
|
||||
## II. Potential Revenue Streams
|
||||
|
||||
1. **Subscription Fees:** From $50 to $500+ per month for platform access.
|
||||
|
||||
2. **Usage Fees:** From $0.01 per API request, generating income from high platform usage.
|
||||
|
||||
3. **Contract Fees:** Starting from $100,000 per month for managed services.
|
||||
|
||||
4. **Training Fees:** From $200 to $2,000 for individual courses or subscription access.
|
||||
|
||||
5. **Partnership Contracts:** Contracts starting from $100,000, offering major income potential.
|
||||
|
||||
6. **Data Insights:** Business intelligence reports starting from $500.
|
||||
|
||||
---
|
||||
|
||||
## III. Potential Customers
|
||||
|
||||
1. **Businesses Across Sectors:** Our offerings cater to businesses across finance, eCommerce, logistics, healthcare, and more.
|
||||
|
||||
2. **Developers:** Both freelancers and organization-based developers can leverage Swarms for their projects.
|
||||
|
||||
3. **Enterprises:** Swarms offers large enterprises solutions for optimizing operations.
|
||||
|
||||
4. **Educational Institutions:** Universities and research institutions can use Swarms for research and teaching.
|
||||
|
||||
---
|
||||
|
||||
## IV. Roadmap
|
||||
|
||||
1. **Landing Page Creation:** Develop a dedicated Swarms product page on apac.ai.
|
||||
|
||||
2. **Hosted Swarms API:** Launch a reliable, well-documented cloud-based Swarms API service.
|
||||
|
||||
3. **Consumer and Enterprise Subscription Service:** Launch an extensive subscription service on The Domain, providing wide-ranging access to APIs and data streams.
|
||||
|
||||
4. **Dedicated Capacity Deals:** Offer large enterprises dedicated Swarm AI solutions, starting from $300,000 monthly subscription.
|
||||
|
||||
5. **Enterprise Partnerships:** Develop performance-based contracts with large enterprises.
|
||||
|
||||
6. **Integration with Collaboration Platforms:** Develop Swarms bots for platforms like Discord and Slack, charging a subscription fee for access.
|
||||
|
||||
7. **Personal Data Instances:** Offer users dedicated data instances that the Swarm can query as needed.
|
||||
|
||||
8. **Browser Extension:** Develop a browser extension that integrates with the Swarms platform for seamless user experience.
|
||||
|
||||
---
|
||||
|
||||
Our North Star remains customer satisfaction and value provision.
|
||||
As we embark on this journey, we continuously refine our product based on customer feedback and evolving market needs, ensuring we lead in the age of AI-driven solutions.
|
||||
|
||||
## **Platform Distribution Strategy for Swarms**
|
||||
|
||||
*Note: This strategy aims to diversify the presence of 'Swarms' across various platforms and mediums while focusing on monetization and value creation for its users.
|
||||
|
||||
---
|
||||
|
||||
### **1. Framework:**
|
||||
|
||||
#### **Objective:**
|
||||
To offer Swarms as an integrated solution within popular frameworks to ensure that developers and businesses can seamlessly incorporate its functionalities.
|
||||
|
||||
#### **Strategy:**
|
||||
|
||||
* **Language/Framework Integration:**
|
||||
* Target popular frameworks like Django, Flask for Python, Express.js for Node, etc.
|
||||
* Create SDKs or plugins for easy integration.
|
||||
|
||||
* **Monetization:**
|
||||
* Freemium Model: Offer basic integration for free, and charge for additional features or advanced integrations.
|
||||
* Licensing: Allow businesses to purchase licenses for enterprise-level integrations.
|
||||
|
||||
* **Promotion:**
|
||||
* Engage in partnerships with popular online coding platforms like Udemy, Coursera, etc., offering courses and tutorials on integrating Swarms.
|
||||
* Host webinars and write technical blogs to promote the integration benefits.
|
||||
|
||||
---
|
||||
|
||||
### **2. Paid API:**
|
||||
|
||||
#### **Objective:**
|
||||
To provide a scalable solution for developers and businesses that want direct access to Swarms' functionalities without integrating the entire framework.
|
||||
|
||||
#### **Strategy:**
|
||||
|
||||
* **API Endpoints:**
|
||||
* Offer various endpoints catering to different functionalities.
|
||||
* Maintain robust documentation to ensure ease of use.
|
||||
|
||||
* **Monetization:**
|
||||
* Usage-based Pricing: Charge based on the number of API calls.
|
||||
* Subscription Tiers: Provide tiered packages based on usage limits and advanced features.
|
||||
|
||||
* **Promotion:**
|
||||
* List on API marketplaces like RapidAPI.
|
||||
* Engage in SEO to make the API documentation discoverable.
|
||||
|
||||
---
|
||||
|
||||
### **3. Domain Hosted:**
|
||||
|
||||
#### **Objective:**
|
||||
To provide a centralized web platform where users can directly access and engage with Swarms' offerings.
|
||||
|
||||
#### **Strategy:**
|
||||
|
||||
* **User-Friendly Interface:**
|
||||
* Ensure a seamless user experience with intuitive design.
|
||||
* Incorporate features like real-time chat support, tutorials, and an FAQ section.
|
||||
|
||||
* **Monetization:**
|
||||
* Subscription Model: Offer monthly/annual subscriptions for premium features.
|
||||
* Affiliate Marketing: Partner with related tech products/services and earn through referrals.
|
||||
|
||||
* **Promotion:**
|
||||
* Invest in PPC advertising on platforms like Google Ads.
|
||||
* Engage in content marketing, targeting keywords related to Swarms' offerings.
|
||||
|
||||
---
|
||||
|
||||
### **4. Build Your Own (No-Code Platform):**
|
||||
|
||||
#### **Objective:**
|
||||
To cater to the non-developer audience, allowing them to leverage Swarms' features without any coding expertise.
|
||||
|
||||
#### **Strategy:**
|
||||
|
||||
* **Drag-and-Drop Interface:**
|
||||
* Offer customizable templates.
|
||||
* Ensure integration with popular platforms and apps.
|
||||
|
||||
* **Monetization:**
|
||||
* Freemium Model: Offer basic features for free, and charge for advanced functionalities.
|
||||
* Marketplace for Plugins: Allow third-party developers to sell their plugins/extensions on the platform.
|
||||
|
||||
* **Promotion:**
|
||||
* Partner with no-code communities and influencers.
|
||||
* Offer promotions and discounts to early adopters.
|
||||
|
||||
---
|
||||
|
||||
### **5. Marketplace for the No-Code Platform:**
|
||||
|
||||
#### **Objective:**
|
||||
To create an ecosystem where third-party developers can contribute, and users can enhance their Swarms experience.
|
||||
|
||||
#### **Strategy:**
|
||||
|
||||
* **Open API for Development:**
|
||||
* Offer robust documentation and developer support.
|
||||
* Ensure a strict quality check for marketplace additions.
|
||||
|
||||
* **Monetization:**
|
||||
* Revenue Sharing: Take a percentage cut from third-party sales.
|
||||
* Featured Listings: Charge developers for premium listings.
|
||||
|
||||
* **Promotion:**
|
||||
* Host hackathons and competitions to boost developer engagement.
|
||||
* Promote top plugins/extensions through email marketing and on the main platform.
|
||||
|
||||
---
|
||||
|
||||
### **Future Outlook & Expansion:**
|
||||
|
||||
* **Hosted Dedicated Capacity:** Hosted dedicated capacity deals for enterprises starting at 399,999$
|
||||
* **Decentralized Free Peer to peer endpoint hosted on The Grid:** Hosted endpoint by the people for the people.
|
||||
* **Browser Extenision:** Athena browser extension for deep browser automation, subscription, usage,
|
||||
|
||||
|
||||
* **Mobile Application:** Develop a mobile app version for Swarms to tap into the vast mobile user base.
|
||||
* **Global Expansion:** Localize the platform for non-English speaking regions to tap into global markets.
|
||||
* **Continuous Learning:** Regularly collect user feedback and iterate on the product features.
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
### **50 Creative Distribution Platforms for Swarms**
|
||||
|
||||
1. **E-commerce Integrations:** Platforms like Shopify, WooCommerce, where Swarms can add value to sellers.
|
||||
|
||||
2. **Web Browser Extensions:** Chrome, Firefox, and Edge extensions that bring Swarms features directly to users.
|
||||
|
||||
3. **Podcasting Platforms:** Swarms-themed content on platforms like Spotify, Apple Podcasts to reach aural learners.
|
||||
|
||||
4. **Virtual Reality (VR) Platforms:** Integration with VR experiences on Oculus or Viveport.
|
||||
|
||||
5. **Gaming Platforms:** Tools or plugins for game developers on Steam, Epic Games.
|
||||
|
||||
6. **Decentralized Platforms:** Using blockchain, create decentralized apps (DApps) versions of Swarms.
|
||||
|
||||
7. **Chat Applications:** Integrate with popular messaging platforms like WhatsApp, Telegram, Slack.
|
||||
|
||||
8. **AI Assistants:** Integration with Siri, Alexa, Google Assistant to provide Swarms functionalities via voice commands.
|
||||
|
||||
9. **Freelancing Websites:** Offer tools or services for freelancers on platforms like Upwork, Fiverr.
|
||||
|
||||
10. **Online Forums:** Platforms like Reddit, Quora, where users can discuss or access Swarms.
|
||||
|
||||
11. **Educational Platforms:** Sites like Khan Academy, Udacity where Swarms can enhance learning experiences.
|
||||
|
||||
12. **Digital Art Platforms:** Integrate with platforms like DeviantArt, Behance.
|
||||
|
||||
13. **Open-source Repositories:** Hosting Swarms on GitHub, GitLab, Bitbucket with open-source plugins.
|
||||
|
||||
14. **Augmented Reality (AR) Apps:** Create AR experiences powered by Swarms.
|
||||
|
||||
15. **Smart Home Devices:** Integrate Swarms' functionalities into smart home devices.
|
||||
|
||||
16. **Newsletters:** Platforms like Substack, where Swarms insights can be shared.
|
||||
|
||||
17. **Interactive Kiosks:** In malls, airports, and other public places.
|
||||
|
||||
18. **IoT Devices:** Incorporate Swarms in devices like smart fridges, smartwatches.
|
||||
|
||||
19. **Collaboration Tools:** Platforms like Trello, Notion, offering Swarms-enhanced productivity.
|
||||
|
||||
20. **Dating Apps:** An AI-enhanced matching algorithm powered by Swarms.
|
||||
|
||||
21. **Music Platforms:** Integrate with Spotify, SoundCloud for music-related AI functionalities.
|
||||
|
||||
22. **Recipe Websites:** Platforms like AllRecipes, Tasty with AI-recommended recipes.
|
||||
|
||||
23. **Travel & Hospitality:** Integrate with platforms like Airbnb, Tripadvisor for AI-based recommendations.
|
||||
|
||||
24. **Language Learning Apps:** Duolingo, Rosetta Stone integrations.
|
||||
|
||||
25. **Virtual Events Platforms:** Websites like Hopin, Zoom where Swarms can enhance the virtual event experience.
|
||||
|
||||
26. **Social Media Management:** Tools like Buffer, Hootsuite with AI insights by Swarms.
|
||||
|
||||
27. **Fitness Apps:** Platforms like MyFitnessPal, Strava with AI fitness insights.
|
||||
|
||||
28. **Mental Health Apps:** Integration into apps like Calm, Headspace for AI-driven wellness.
|
||||
|
||||
29. **E-books Platforms:** Amazon Kindle, Audible with AI-enhanced reading experiences.
|
||||
|
||||
30. **Sports Analysis Tools:** Websites like ESPN, Sky Sports where Swarms can provide insights.
|
||||
|
||||
31. **Financial Tools:** Integration into platforms like Mint, Robinhood for AI-driven financial advice.
|
||||
|
||||
32. **Public Libraries:** Digital platforms of public libraries for enhanced reading experiences.
|
||||
|
||||
33. **3D Printing Platforms:** Websites like Thingiverse, Shapeways with AI customization.
|
||||
|
||||
34. **Meme Platforms:** Websites like Memedroid, 9GAG where Swarms can suggest memes.
|
||||
|
||||
35. **Astronomy Apps:** Platforms like Star Walk, NASA's Eyes with AI-driven space insights.
|
||||
|
||||
36. **Weather Apps:** Integration into Weather.com, AccuWeather for predictive analysis.
|
||||
|
||||
37. **Sustainability Platforms:** Websites like Ecosia, GoodGuide with AI-driven eco-tips.
|
||||
|
||||
38. **Fashion Apps:** Platforms like ASOS, Zara with AI-based style recommendations.
|
||||
|
||||
39. **Pet Care Apps:** Integration into PetSmart, Chewy for AI-driven pet care tips.
|
||||
|
||||
40. **Real Estate Platforms:** Websites like Zillow, Realtor with AI-enhanced property insights.
|
||||
|
||||
41. **DIY Platforms:** Websites like Instructables, DIY.org with AI project suggestions.
|
||||
|
||||
42. **Genealogy Platforms:** Ancestry, MyHeritage with AI-driven family tree insights.
|
||||
|
||||
43. **Car Rental & Sale Platforms:** Integration into AutoTrader, Turo for AI-driven vehicle suggestions.
|
||||
|
||||
44. **Wedding Planning Websites:** Platforms like Zola, The Knot with AI-driven planning.
|
||||
|
||||
45. **Craft Platforms:** Websites like Etsy, Craftsy with AI-driven craft suggestions.
|
||||
|
||||
46. **Gift Recommendation Platforms:** AI-driven gift suggestions for websites like Gifts.com.
|
||||
|
||||
47. **Study & Revision Platforms:** Websites like Chegg, Quizlet with AI-driven study guides.
|
||||
|
||||
48. **Local Business Directories:** Yelp, Yellow Pages with AI-enhanced reviews.
|
||||
|
||||
49. **Networking Platforms:** LinkedIn, Meetup with AI-driven connection suggestions.
|
||||
|
||||
50. **Lifestyle Magazines' Digital Platforms:** Websites like Vogue, GQ with AI-curated fashion and lifestyle insights.
|
||||
|
||||
---
|
||||
|
||||
*Endnote: Leveraging these diverse platforms ensures that Swarms becomes an integral part of multiple ecosystems, enhancing its visibility and user engagement.*
|
@ -0,0 +1,110 @@
|
||||
### FAQ on Swarm Intelligence and Multi-Agent Systems
|
||||
|
||||
#### What is an agent in the context of AI and swarm intelligence?
|
||||
|
||||
In artificial intelligence (AI), an agent refers to an LLM with some objective to accomplish.
|
||||
|
||||
In swarm intelligence, each agent interacts with other agents and possibly the environment to achieve complex collective behaviors or solve problems more efficiently than individual agents could on their own.
|
||||
|
||||
|
||||
#### What do you need Swarms at all?
|
||||
Individual agents are limited by a vast array of issues such as context window loss, single task execution, hallucination, and no collaboration.
|
||||
|
||||
|
||||
#### How does a swarm work?
|
||||
|
||||
A swarm works through the principles of decentralized control, local interactions, and simple rules followed by each agent. Unlike centralized systems, where a single entity dictates the behavior of all components, in a swarm, each agent makes its own decisions based on local information and interactions with nearby agents. These local interactions lead to the emergence of complex, organized behaviors or solutions at the collective level, enabling the swarm to tackle tasks efficiently.
|
||||
|
||||
#### Why do you need more agents in a swarm?
|
||||
|
||||
More agents in a swarm can enhance its problem-solving capabilities, resilience, and efficiency. With more agents:
|
||||
|
||||
- **Diversity and Specialization**: The swarm can leverage a wider range of skills, knowledge, and perspectives, allowing for more creative and effective solutions to complex problems.
|
||||
- **Scalability**: Adding more agents can increase the swarm's capacity to handle larger tasks or multiple tasks simultaneously.
|
||||
- **Robustness**: A larger number of agents enhances the system's redundancy and fault tolerance, as the failure of a few agents has a minimal impact on the overall performance of the swarm.
|
||||
|
||||
#### Isn't it more expensive to use more agents?
|
||||
|
||||
While deploying more agents can initially increase costs, especially in terms of computational resources, hosting, and potentially API usage, there are several factors and strategies that can mitigate these expenses:
|
||||
|
||||
- **Efficiency at Scale**: Larger swarms can often solve problems more quickly or effectively, reducing the overall computational time and resources required.
|
||||
- **Optimization and Caching**: Implementing optimizations and caching strategies can reduce redundant computations, lowering the workload on individual agents and the overall system.
|
||||
- **Dynamic Scaling**: Utilizing cloud services that offer dynamic scaling can ensure you only pay for the resources you need when you need them, optimizing cost-efficiency.
|
||||
|
||||
#### Can swarms make decisions better than individual agents?
|
||||
|
||||
Yes, swarms can make better decisions than individual agents for several reasons:
|
||||
|
||||
- **Collective Intelligence**: Swarms combine the knowledge and insights of multiple agents, leading to more informed and well-rounded decision-making processes.
|
||||
- **Error Correction**: The collaborative nature of swarms allows for error checking and correction among agents, reducing the likelihood of mistakes.
|
||||
- **Adaptability**: Swarms are highly adaptable to changing environments or requirements, as the collective can quickly reorganize or shift strategies based on new information.
|
||||
|
||||
#### How do agents in a swarm communicate?
|
||||
|
||||
Communication in a swarm can vary based on the design and purpose of the system but generally involves either direct or indirect interactions:
|
||||
|
||||
- **Direct Communication**: Agents exchange information directly through messaging, signals, or other communication protocols designed for the system.
|
||||
- **Indirect Communication**: Agents influence each other through the environment, a method known as stigmergy. Actions by one agent alter the environment, which in turn influences the behavior of other agents.
|
||||
|
||||
#### Are swarms only useful in computational tasks?
|
||||
|
||||
While swarms are often associated with computational tasks, their applications extend far beyond. Swarms can be utilized in:
|
||||
|
||||
- **Robotics**: Coordinating multiple robots for tasks like search and rescue, exploration, or surveillance.
|
||||
- **Environmental Monitoring**: Using sensor networks to monitor pollution, wildlife, or climate conditions.
|
||||
- **Social Sciences**: Modeling social behaviors or economic systems to understand complex societal dynamics.
|
||||
- **Healthcare**: Coordinating care strategies in hospital settings or managing pandemic responses through distributed data analysis.
|
||||
|
||||
#### How do you ensure the security of a swarm system?
|
||||
|
||||
Security in swarm systems involves:
|
||||
|
||||
- **Encryption**: Ensuring all communications between agents are encrypted to prevent unauthorized access or manipulation.
|
||||
- **Authentication**: Implementing strict authentication mechanisms to verify the identity of each agent in the swarm.
|
||||
- **Resilience to Attacks**: Designing the swarm to continue functioning effectively even if some agents are compromised or attacked, utilizing redundancy and fault tolerance strategies.
|
||||
|
||||
#### How do individual agents within a swarm share insights without direct learning mechanisms like reinforcement learning?
|
||||
|
||||
In the context of pre-trained Large Language Models (LLMs) that operate within a swarm, sharing insights typically involves explicit communication and data exchange protocols rather than direct learning mechanisms like reinforcement learning. Here's how it can work:
|
||||
|
||||
- **Shared Databases and Knowledge Bases**: Agents can write to and read from a shared database or knowledge base where insights, generated content, and relevant data are stored. This allows agents to benefit from the collective experience of the swarm by accessing information that other agents have contributed.
|
||||
|
||||
- **APIs for Information Exchange**: Custom APIs can facilitate the exchange of information between agents. Through these APIs, agents can request specific information or insights from others within the swarm, effectively sharing knowledge without direct learning.
|
||||
|
||||
#### How do you balance the autonomy of individual LLMs with the need for coherent collective behavior in a swarm?
|
||||
|
||||
Balancing autonomy with collective coherence in a swarm of LLMs involves:
|
||||
|
||||
- **Central Coordination Mechanism**: Implementing a lightweight central coordination mechanism that can assign tasks, distribute information, and collect outputs from individual LLMs. This ensures that while each LLM operates autonomously, their actions are aligned with the swarm's overall objectives.
|
||||
|
||||
- **Standardized Communication Protocols**: Developing standardized protocols for how LLMs communicate and share information ensures that even though each agent works autonomously, the information exchange remains coherent and aligned with the collective goals.
|
||||
|
||||
#### How do LLM swarms adapt to changing environments or tasks without machine learning techniques?
|
||||
|
||||
Adaptation in LLM swarms, without relying on machine learning techniques for dynamic learning, can be achieved through:
|
||||
|
||||
- **Dynamic Task Allocation**: A central system or distributed algorithm can dynamically allocate tasks to different LLMs based on the changing environment or requirements. This ensures that the most suitable LLMs are addressing tasks for which they are best suited as conditions change.
|
||||
|
||||
- **Pre-trained Versatility**: Utilizing a diverse set of pre-trained LLMs with different specialties or training data allows the swarm to select the most appropriate agent for a task as the requirements evolve.
|
||||
|
||||
- **In Context Learning**: In context learning is another mechanism that can be employed within LLM swarms to adapt to changing environments or tasks. This approach involves leveraging the collective knowledge and experiences of the swarm to facilitate learning and improve performance. Here's how it can work:
|
||||
|
||||
|
||||
#### Can LLM swarms operate in physical environments, or are they limited to digital spaces?
|
||||
|
||||
LLM swarms primarily operate in digital spaces, given their nature as software entities. However, they can interact with physical environments indirectly through interfaces with sensors, actuaries, or other devices connected to the Internet of Things (IoT). For example, LLMs can process data from physical sensors and control devices based on their outputs, enabling applications like smart home management or autonomous vehicle navigation.
|
||||
|
||||
#### Without direct learning from each other, how do agents in a swarm improve over time?
|
||||
|
||||
Improvement over time in a swarm of pre-trained LLMs, without direct learning from each other, can be achieved through:
|
||||
|
||||
- **Human Feedback**: Incorporating feedback from human operators or users can guide adjustments to the usage patterns or selection criteria of LLMs within the swarm, optimizing performance based on observed outcomes.
|
||||
|
||||
- **Periodic Re-training and Updating**: The individual LLMs can be periodically re-trained or updated by their developers based on collective insights and feedback from their deployment within swarms. While this does not involve direct learning from each encounter, it allows the LLMs to improve over time based on aggregated experiences.
|
||||
|
||||
These adjustments to the FAQ reflect the specific context of pre-trained LLMs operating within a swarm, focusing on communication, coordination, and adaptation mechanisms that align with their capabilities and constraints.
|
||||
|
||||
|
||||
#### Conclusion
|
||||
|
||||
Swarms represent a powerful paradigm in AI, offering innovative solutions to complex, dynamic problems through collective intelligence and decentralized control. While challenges exist, particularly regarding cost and security, strategic design and management can leverage the strengths of swarm intelligence to achieve remarkable efficiency, adaptability, and robustness in a wide range of applications.
|
@ -0,0 +1,101 @@
|
||||
# The Swarms Flywheel
|
||||
|
||||
1. **Building a Supportive Community:** Initiate by establishing an engaging and inclusive open-source community for both developers and sales freelancers around Swarms. Regular online meetups, webinars, tutorials, and sales training can make them feel welcome and encourage contributions and sales efforts.
|
||||
|
||||
2. **Increased Contributions and Sales Efforts:** The more engaged the community, the more developers will contribute to Swarms and the more effort sales freelancers will put into selling Swarms.
|
||||
|
||||
3. **Improvement in Quality and Market Reach:** More developer contributions mean better quality, reliability, and feature offerings from Swarms. Simultaneously, increased sales efforts from freelancers boost Swarms' market penetration and visibility.
|
||||
|
||||
4. **Rise in User Base:** As Swarms becomes more robust and more well-known, the user base grows, driving more revenue.
|
||||
|
||||
5. **Greater Financial Incentives:** Increased revenue can be redirected to offer more significant financial incentives to both developers and salespeople. Developers can be incentivized based on their contribution to Swarms, and salespeople can be rewarded with higher commissions.
|
||||
|
||||
6. **Attract More Developers and Salespeople:** These financial incentives, coupled with the recognition and experience from participating in a successful project, attract more developers and salespeople to the community.
|
||||
|
||||
7. **Wider Adoption of Swarms:** An ever-improving product, a growing user base, and an increasing number of passionate salespeople accelerate the adoption of Swarms.
|
||||
|
||||
8. **Return to Step 1:** As the community, user base, and sales network continue to grow, the cycle repeats, each time speeding up the flywheel.
|
||||
|
||||
|
||||
```markdown
|
||||
+---------------------+
|
||||
| Building a |
|
||||
| Supportive | <--+
|
||||
| Community | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Increased | |
|
||||
| Contributions & | |
|
||||
| Sales Efforts | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Improvement in | |
|
||||
| Quality & Market | |
|
||||
| Reach | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Rise in User | |
|
||||
| Base | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Greater Financial | |
|
||||
| Incentives | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Attract More | |
|
||||
| Developers & | |
|
||||
| Salespeople | |
|
||||
+--------+-----------+ |
|
||||
| |
|
||||
v |
|
||||
+--------+-----------+ |
|
||||
| Wider Adoption of | |
|
||||
| Swarms |----+
|
||||
+---------------------+
|
||||
```
|
||||
|
||||
|
||||
# Potential Risks and Mitigations:
|
||||
|
||||
1. **Insufficient Contributions or Quality of Work**: Open-source efforts rely on individuals being willing and able to spend time contributing. If not enough people participate, or the work they produce is of poor quality, the product development could stall.
|
||||
* **Mitigation**: Create a robust community with clear guidelines, support, and resources. Provide incentives for quality contributions, such as a reputation system, swag, or financial rewards. Conduct thorough code reviews to ensure the quality of contributions.
|
||||
|
||||
2. **Lack of Sales Results**: Commission-based salespeople will only continue to sell the product if they're successful. If they aren't making enough sales, they may lose motivation and cease their efforts.
|
||||
* **Mitigation**: Provide adequate sales training and resources. Ensure the product-market fit is strong, and adjust messaging or sales tactics as necessary. Consider implementing a minimum commission or base pay to reduce risk for salespeople.
|
||||
|
||||
3. **Poor User Experience or User Adoption**: If users don't find the product useful or easy to use, they won't adopt it, and the user base won't grow. This could also discourage salespeople and contributors.
|
||||
* **Mitigation**: Prioritize user experience in the product development process. Regularly gather and incorporate user feedback. Ensure robust user support is in place.
|
||||
|
||||
4. **Inadequate Financial Incentives**: If the financial rewards don't justify the time and effort contributors and salespeople are putting in, they will likely disengage.
|
||||
* **Mitigation**: Regularly review and adjust financial incentives as needed. Ensure that the method for calculating and distributing rewards is transparent and fair.
|
||||
|
||||
5. **Security and Compliance Risks**: As the user base grows and the software becomes more complex, the risk of security issues increases. Moreover, as contributors from various regions join, compliance with various international laws could become an issue.
|
||||
* **Mitigation**: Establish strong security practices from the start. Regularly conduct security audits. Seek legal counsel to understand and adhere to international laws and regulations.
|
||||
|
||||
## Activation Plan for the Flywheel:
|
||||
|
||||
1. **Community Building**: Begin by fostering a supportive community around Swarms. Encourage early adopters to contribute and provide feedback. Create comprehensive documentation, community guidelines, and a forum for discussion and support.
|
||||
|
||||
2. **Sales and Development Training**: Provide resources and training for salespeople and developers. Make sure they understand the product, its value, and how to effectively contribute or sell.
|
||||
|
||||
3. **Increase Contributions and Sales Efforts**: Encourage increased participation by highlighting successful contributions and sales, rewarding top contributors and salespeople, and regularly communicating about the project's progress and impact.
|
||||
|
||||
4. **Iterate and Improve**: Continually gather and implement feedback to improve Swarms and its market reach. The better the product and its alignment with the market, the more the user base will grow.
|
||||
|
||||
5. **Expand User Base**: As the product improves and sales efforts continue, the user base should grow. Ensure you have the infrastructure to support this growth and maintain a positive user experience.
|
||||
|
||||
6. **Increase Financial Incentives**: As the user base and product grow, so too should the financial incentives. Make sure rewards continue to be competitive and attractive.
|
||||
|
||||
7. **Attract More Contributors and Salespeople**: As the financial incentives and success of the product increase, this should attract more contributors and salespeople, further feeding the flywheel.
|
||||
|
||||
Throughout this process, it's important to regularly reassess and adjust your strategy as necessary. Stay flexible and responsive to changes in the market, user feedback, and the evolving needs of the community.
|
@ -0,0 +1,40 @@
|
||||
# Frontend Contributor Guide
|
||||
|
||||
## Mission
|
||||
At the heart of Swarms is the mission to democratize multi-agent technology, making it accessible to businesses of all sizes around the globe. This technology, which allows for the orchestration of multiple autonomous agents to achieve complex goals, has the potential to revolutionize industries by enhancing efficiency, scalability, and innovation. Swarms is committed to leading this charge by developing a platform that empowers businesses and individuals to harness the power of multi-agent systems without the need for specialized knowledge or resources.
|
||||
|
||||
|
||||
## Understanding Your Impact as a Frontend Engineer
|
||||
Crafting User Experiences: As a frontend engineer at Swarms, you play a crucial role in making multi-agent technology understandable and usable for businesses worldwide. Your work involves translating complex systems into intuitive interfaces, ensuring users can easily navigate, manage, and benefit from multi-agent solutions. By focusing on user-centric design and seamless integration, you help bridge the gap between advanced technology and practical business applications.
|
||||
|
||||
Skills and Attributes for Success: Successful frontend engineers at Swarms combine technical expertise with a passion for innovation and a deep understanding of user needs. Proficiency in modern frontend technologies, such as React, NextJS, and Tailwind, is just the beginning. You also need a strong grasp of usability principles, accessibility standards, and the ability to work collaboratively with cross-functional teams. Creativity, problem-solving skills, and a commitment to continuous learning are essential for developing solutions that meet diverse business needs.
|
||||
|
||||
|
||||
## Joining the Team
|
||||
As you contribute to Swarms, you become part of a collaborative effort to change the world. We value each contribution and provide constructive feedback to help you grow. Outstanding contributors who share our vision and demonstrate exceptional skill and dedication are invited to join our team, where they can have an even greater impact on our mission.
|
||||
|
||||
|
||||
### Becoming a Full-Time Swarms Engineer:
|
||||
Swarms is radically devoted to open source and transparency. To join the full time team, you must first contribute to the open source repository so we can assess your technical capability and general way of working. After a series of quality contributions, we'll offer you a full time position!
|
||||
|
||||
Joining Swarms full-time means more than just a job. It's an opportunity to be at the forefront of technological innovation, working alongside passionate professionals dedicated to making a difference. We look for individuals who are not only skilled but also driven by the desire to make multi-agent technology accessible and beneficial to businesses worldwide.
|
||||
|
||||
|
||||
## Resources
|
||||
- **Project Management Details**
|
||||
- **Linear**: Our projects and tasks at a glance. Get a sense of our workflow and priorities.
|
||||
- [View on Linear](https://linear.app/swarms/join/e7f4c6c560ffa0e1395820682f4e110a?s=1)
|
||||
|
||||
- **Design System and UI/UX Guidelines**
|
||||
- **Figma**: Dive into our design system to grasp the aesthetics and user experience objectives of Swarms.
|
||||
- [View on Figma](https://www.figma.com/file/KL4VIXfZKwwLgAes2WbGNa/Swarms-Cloud-Platform?type=design&node-id=0%3A1&mode=design&t=MkrM0mBQa6qsTDtJ-1)
|
||||
|
||||
- **Swarms Platform Repository**
|
||||
- **GitHub**: The hub of our development activities. Familiarize yourself with our codebase and current projects.
|
||||
- [Visit GitHub Repository](https://github.com/kyegomez/swarms-platform)
|
||||
|
||||
- **[Swarms Community](https://discord.gg/pSTSxqDk)**
|
||||
|
||||
|
||||
### Design Style & User Experience
|
||||
- [How to build great products with game design, not gamification](https://blog.superhuman.com/game-design-not-gamification/)
|
@ -0,0 +1,66 @@
|
||||
def calculate_monthly_charge(
|
||||
development_time_hours: float,
|
||||
hourly_rate: float,
|
||||
amortization_months: int,
|
||||
api_calls_per_month: int,
|
||||
cost_per_api_call: float,
|
||||
monthly_maintenance: float,
|
||||
additional_monthly_costs: float,
|
||||
profit_margin_percentage: float,
|
||||
) -> float:
|
||||
"""
|
||||
Calculate the monthly charge for a service based on various cost factors.
|
||||
|
||||
Parameters:
|
||||
- development_time_hours (float): The total number of hours spent on development and setup.
|
||||
- hourly_rate (float): The rate per hour for development and setup.
|
||||
- amortization_months (int): The number of months over which to amortize the development and setup costs.
|
||||
- api_calls_per_month (int): The number of API calls made per month.
|
||||
- cost_per_api_call (float): The cost per API call.
|
||||
- monthly_maintenance (float): The monthly maintenance cost.
|
||||
- additional_monthly_costs (float): Any additional monthly costs.
|
||||
- profit_margin_percentage (float): The desired profit margin as a percentage.
|
||||
|
||||
Returns:
|
||||
- monthly_charge (float): The calculated monthly charge for the service.
|
||||
"""
|
||||
|
||||
# Calculate Development and Setup Costs (amortized monthly)
|
||||
development_and_setup_costs_monthly = (
|
||||
development_time_hours * hourly_rate
|
||||
) / amortization_months
|
||||
|
||||
# Calculate Operational Costs per Month
|
||||
operational_costs_monthly = (
|
||||
(api_calls_per_month * cost_per_api_call)
|
||||
+ monthly_maintenance
|
||||
+ additional_monthly_costs
|
||||
)
|
||||
|
||||
# Calculate Total Monthly Costs
|
||||
total_monthly_costs = (
|
||||
development_and_setup_costs_monthly
|
||||
+ operational_costs_monthly
|
||||
)
|
||||
|
||||
# Calculate Pricing with Profit Margin
|
||||
monthly_charge = total_monthly_costs * (
|
||||
1 + profit_margin_percentage / 100
|
||||
)
|
||||
|
||||
return monthly_charge
|
||||
|
||||
|
||||
# Example usage:
|
||||
monthly_charge = calculate_monthly_charge(
|
||||
development_time_hours=100,
|
||||
hourly_rate=500,
|
||||
amortization_months=12,
|
||||
api_calls_per_month=500000,
|
||||
cost_per_api_call=0.002,
|
||||
monthly_maintenance=1000,
|
||||
additional_monthly_costs=300,
|
||||
profit_margin_percentage=10000,
|
||||
)
|
||||
|
||||
print(f"Monthly Charge: ${monthly_charge:.2f}")
|
@ -0,0 +1,14 @@
|
||||
|
||||
## Purpose
|
||||
Artificial Intelligence has grown at an exponential rate over the past decade. Yet, we are far from fully harnessing its potential. Today's AI operates in isolation, each working separately in their corner. But life doesn't work like that. The world doesn't work like that. Success isn't built in silos; it's built in teams.
|
||||
|
||||
Imagine a world where AI models work in unison. Where they can collaborate, interact, and pool their collective intelligence to achieve more than any single model could. This is the future we envision. But today, we lack a framework for AI to collaborate effectively, to form a true swarm of intelligent agents.
|
||||
|
||||
|
||||
This is a difficult problem, one that has eluded solution. It requires sophisticated systems that can allow individual models to not just communicate but also understand each other, pool knowledge and resources, and create collective intelligence. This is the next frontier of AI.
|
||||
|
||||
But here at Swarms, we have a secret sauce. It's not just a technology or a breakthrough invention. It's a way of thinking - the philosophy of rapid iteration. With each cycle, we make massive progress. We experiment, we learn, and we grow. We have developed a pioneering framework that can enable AI models to work together as a swarm, combining their strengths to create richer, more powerful outputs.
|
||||
|
||||
We are uniquely positioned to take on this challenge with 1,500+ devoted researchers in Agora. We have assembled a team of world-class experts, experienced and driven, united by a shared vision. Our commitment to breaking barriers, pushing boundaries, and our belief in the power of collective intelligence makes us the best team to usher in this future to fundamentally advance our species, Humanity.
|
||||
|
||||
---
|
@ -0,0 +1,82 @@
|
||||
# Research Lists
|
||||
A compilation of projects, papers, blogs in autonomous agents.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Projects](#projects)
|
||||
- [Articles](#articles)
|
||||
- [Talks](#talks)
|
||||
|
||||
|
||||
## Projects
|
||||
|
||||
### Developer tools
|
||||
- [2023/8/10] [ModelScope-Agent](https://github.com/modelscope/modelscope-agent) - An Agent Framework Connecting Models in ModelScope with the World
|
||||
- [2023/05/25] [Gorilla](https://github.com/ShishirPatil/gorilla) - An API store for LLMs
|
||||
- [2023/03/31] [BMTools](https://github.com/OpenBMB/BMTools) - Tool Learning for Big Models, Open-Source Solutions of ChatGPT-Plugins
|
||||
- [2023/03/09] [LMQL](https://github.com/eth-sri/lmql) - A query language for programming (large) language models.
|
||||
- [2022/10/25] [Langchain](https://github.com/hwchase17/langchain) - ⚡ Building applications with LLMs through composability ⚡
|
||||
|
||||
### Applications
|
||||
- [2023/07/08] [ShortGPT](https://github.com/RayVentura/ShortGPT) - 🚀🎬 ShortGPT - An experimental AI framework for automated short/video content creation. Enables creators to rapidly produce, manage, and deliver content using AI and automation.
|
||||
- [2023/07/05] [gpt-researcher](https://github.com/assafelovic/gpt-researcher) - GPT based autonomous agent that does online comprehensive research on any given topic
|
||||
- [2023/07/04] [DemoGPT](https://github.com/melih-unsal/DemoGPT) - 🧩DemoGPT enables you to create quick demos by just using prompts. [[demo]](demogpt.io)
|
||||
- [2023/06/30] [MetaGPT](https://github.com/geekan/MetaGPT) - 🌟 The Multi-Agent Framework: Given one line Requirement, return PRD, Design, Tasks, Repo
|
||||
- [2023/06/11] [gpt-engineer](https://github.com/AntonOsika/gpt-engineer) - Specify what you want it to build, the AI asks for clarification, and then builds it.
|
||||
- [2023/05/16] [SuperAGI](https://github.com/TransformerOptimus/SuperAGI) - <⚡️> SuperAGI - A dev-first open source autonomous AI agent framework. Enabling developers to build, manage & run useful autonomous agents quickly and reliably.
|
||||
- [2023/05/13] [Developer](https://github.com/smol-ai/developer) - Human-centric & Coherent Whole Program Synthesis aka your own personal junior developer
|
||||
- [2023/04/07] [AgentGPT](https://github.com/reworkd/AgentGPT) - 🤖 Assemble, configure, and deploy autonomous AI Agents in your browser. [[demo]](agentgpt.reworkd.ai)
|
||||
- [2023/04/03] [BabyAGI](https://github.com/yoheinakajima/babyagi) - an example of an AI-powered task management system
|
||||
- [2023/03/30] [AutoGPT](https://github.com/Significant-Gravitas/Auto-GPT) - An experimental open-source attempt to make GPT-4 fully autonomous.
|
||||
|
||||
### Benchmarks
|
||||
- [2023/08/07] [AgentBench](https://github.com/THUDM/AgentBench) - A Comprehensive Benchmark to Evaluate LLMs as Agents. [paper](https://arxiv.org/abs/2308.03688)
|
||||
- [2023/06/18] [Auto-GPT-Benchmarks](https://github.com/Significant-Gravitas/Auto-GPT-Benchmarks) - A repo built for the purpose of benchmarking the performance of agents, regardless of how they are set up and how they work.
|
||||
- [2023/05/28] [ToolBench](https://github.com/OpenBMB/ToolBench) - An open platform for training, serving, and evaluating large language model for tool learning.
|
||||
|
||||
## Articles
|
||||
### Research Papers
|
||||
- [2023/08/11] [BOLAA: Benchmarking and Orchestrating LLM-Augmented Autonomous Agents](https://arxiv.org/pdf/2308.05960v1.pdf), Zhiwei Liu, et al.
|
||||
- [2023/07/31] [ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs](https://arxiv.org/abs/2307.16789), Yujia Qin, et al.
|
||||
- [2023/07/16] [Communicative Agents for Software Development](https://arxiv.org/abs/2307.07924), Chen Qian, et al.
|
||||
- [2023/06/09] [Mind2Web: Towards a Generalist Agent for the Web](https://arxiv.org/pdf/2306.06070.pdf), Xiang Deng, et al. [[code]](https://github.com/OSU-NLP-Group/Mind2Web) [[demo]](https://osu-nlp-group.github.io/Mind2Web/)
|
||||
- [2023/06/05] [Orca: Progressive Learning from Complex Explanation Traces of GPT-4](https://arxiv.org/pdf/2306.02707.pdf), Subhabrata Mukherjee et al.
|
||||
- [2023/05/25] [Voyager: An Open-Ended Embodied Agent with Large Language Models](https://arxiv.org/pdf/2305.16291.pdf), Guanzhi Wang, et al. [[code]](https://github.com/MineDojo/Voyager) [[website]](https://voyager.minedojo.org/)
|
||||
- [2023/05/23] [ReWOO: Decoupling Reasoning from Observations for Efficient Augmented Language Models](https://arxiv.org/pdf/2305.18323.pdf), Binfeng Xu, et al. [[code]](https://github.com/billxbf/ReWOO)
|
||||
- [2023/05/17] [Tree of Thoughts: Deliberate Problem Solving with Large Language Models](https://arxiv.org/abs/2305.10601), Shunyu Yao, et al.[[code]](https://github.com/kyegomez/tree-of-thoughts) [[code-orig]](https://github.com/ysymyth/tree-of-thought-llm)
|
||||
- [2023/05/12] [MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers](https://arxiv.org/abs/2305.07185), Lili Yu, et al.
|
||||
- [2023/05/19] [FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance](https://arxiv.org/abs/2305.05176), Lingjiao Chen, et al.
|
||||
- [2023/05/06] [Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models](https://arxiv.org/abs/2305.04091), Lei Wang, et al.
|
||||
- [2023/05/01] [Learning to Reason and Memorize with Self-Notes](https://arxiv.org/abs/2305.00833), Jack Lanchantin, et al.
|
||||
- [2023/04/24] [WizardLM: Empowering Large Language Models to Follow Complex Instructions](https://arxiv.org/abs/2304.12244), Can Xu, et al.
|
||||
- [2023/04/22] [LLM+P: Empowering Large Language Models with Optimal Planning Proficiency](https://arxiv.org/abs/2304.11477), Bo Liu, et al.
|
||||
- [2023/04/07] [Generative Agents: Interactive Simulacra of Human Behavior](https://arxiv.org/abs/2304.03442), Joon Sung Park, et al. [[code]](https://github.com/mkturkcan/generative-agents)
|
||||
- [2023/03/30] [Self-Refine: Iterative Refinement with Self-Feedback](https://arxiv.org/abs/2303.17651), Aman Madaan, et al.[[code]](https://github.com/madaan/self-refine)
|
||||
- [2023/03/30] [HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in HuggingFace](https://arxiv.org/pdf/2303.17580.pdf), Yongliang Shen, et al. [[code]](https://github.com/microsoft/JARVIS) [[demo]](https://huggingface.co/spaces/microsoft/HuggingGPT)
|
||||
- [2023/03/20] [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/pdf/2303.11366.pdf), Noah Shinn, et al. [[code]](https://github.com/noahshinn024/reflexion)
|
||||
- [2023/03/04] [Towards A Unified Agent with Foundation Models](https://openreview.net/pdf?id=JK_B1tB6p-), Norman Di Palo et al.
|
||||
- [2023/02/23] [Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection](https://arxiv.org/abs/2302.12173), Sahar Abdelnab, et al.
|
||||
- [2023/02/09] [Toolformer: Language Models Can Teach Themselves to Use Tools](https://arxiv.org/pdf/2302.04761.pdf), Timo Schick, et al. [[code]](https://github.com/lucidrains/toolformer-pytorch)
|
||||
- [2022/12/12] [LMQL: Prompting Is Programming: A Query Language for Large Language Models](https://arxiv.org/abs/2212.06094), Luca Beurer-Kellner, et al.
|
||||
- [2022/10/06] [ReAct: Synergizing Reasoning and Acting in Language Models](https://arxiv.org/pdf/2210.03629.pdf), Shunyu Yao, et al. [[code]](https://github.com/ysymyth/ReAct)
|
||||
- [2022/07/20] [Inner Monologue: Embodied Reasoning through Planning with Language Models](https://arxiv.org/pdf/2207.05608.pdf), Wenlong Huang, et al. [[demo]](https://innermonologue.github.io/)
|
||||
- [2022/04/04] [Do As I Can, Not As I Say: Grounding Language in Robotic Affordances](), Michael Ahn, e al. [[demo]](https://say-can.github.io/)
|
||||
- [2021/12/17] [WebGPT: Browser-assisted question-answering with human feedback](https://arxiv.org/pdf/2112.09332.pdf), Reiichiro Nakano, et al.
|
||||
- [2021/06/17] [LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685), Edward J. Hu, et al.
|
||||
|
||||
|
||||
### Blog Articles
|
||||
|
||||
- [2023/08/14] [A Roadmap of AI Agents(Chinese)](https://zhuanlan.zhihu.com/p/649916692) By Haojie Pan
|
||||
- [2023/06/23] [LLM Powered Autonomous Agents](https://lilianweng.github.io/posts/2023-06-23-agent/) By Lilian Weng
|
||||
- [2023/06/11] [A CRITICAL LOOK AT AI-GENERATED SOFTWARE](https://spectrum.ieee.org/ai-software) By JAIDEEP VAIDYAHAFIZ ASIF
|
||||
- [2023/04/29] [AUTO-GPT: UNLEASHING THE POWER OF AUTONOMOUS AI AGENTS](https://www.leewayhertz.com/autogpt/) By Akash Takyar
|
||||
- [2023/04/20] [Conscious Machines: Experiments, Theory, and Implementations(Chinese)](https://pattern.swarma.org/article/230) By Jiang Zhang
|
||||
- [2023/04/18] [Autonomous Agents & Agent Simulations](https://blog.langchain.dev/agents-round/) By Langchain
|
||||
- [2023/04/16] [4 Autonomous AI Agents you need to know](https://towardsdatascience.com/4-autonomous-ai-agents-you-need-to-know-d612a643fa92) By Sophia Yang
|
||||
- [2023/03/31] [ChatGPT that learns to use tools(Chinese)](https://zhuanlan.zhihu.com/p/618448188) By Haojie Pan
|
||||
|
||||
### Talks
|
||||
- [2023/06/05] [Two Paths to Intelligence](https://www.youtube.com/watch?v=rGgGOccMEiY&t=1497s) by Geoffrey Hinton
|
||||
- [2023/05/24] [State of GPT](https://www.youtube.com/watch?v=bZQun8Y4L2A) by Andrej Karpathy | OpenAI
|
@ -0,0 +1,13 @@
|
||||
## The Plan
|
||||
|
||||
### Phase 1: Building the Foundation
|
||||
In the first phase, our focus is on building the basic infrastructure of Swarms. This includes developing key components like the Swarms class, integrating essential tools, and establishing task completion and evaluation logic. We'll also start developing our testing and evaluation framework during this phase. If you're interested in foundational work and have a knack for building robust, scalable systems, this phase is for you.
|
||||
|
||||
### Phase 2: Optimizing the System
|
||||
In the second phase, we'll focus on optimizng Swarms by integrating more advanced features, improving the system's efficiency, and refining our testing and evaluation framework. This phase involves more complex tasks, so if you enjoy tackling challenging problems and contributing to the development of innovative features, this is the phase for you.
|
||||
|
||||
### Phase 3: Towards Super-Intelligence
|
||||
The third phase of our bounty program is the most exciting - this is where we aim to achieve super-intelligence. In this phase, we'll be working on improving the swarm's capabilities, expanding its skills, and fine-tuning the system based on real-world testing and feedback. If you're excited about the future of AI and want to contribute to a project that could potentially transform the digital world, this is the phase for you.
|
||||
|
||||
Remember, our roadmap is a guide, and we encourage you to bring your own ideas and creativity to the table. We believe that every contribution, no matter how small, can make a difference. So join us on this exciting journey and help us create the future of Swarms.
|
||||
|
@ -0,0 +1,21 @@
|
||||
# [Go To Market Strategy][GTM]
|
||||
|
||||
Our vision is to become the world leader in real-world production grade autonomous agent deployment through open-source product development, Deep Verticalization, and unmatched value delivery to the end user.
|
||||
|
||||
We will focus on first accelerating the open source framework to PMF where it will serve as the backend for upstream products and services such as the Swarm Cloud which will enable enterprises to deploy autonomous agents with long term memory and tools in the cloud and a no-code platform for users to build their own swarm by dragging and dropping blocks.
|
||||
|
||||
Our target user segment for the framework is AI engineers looking to deploy agents into high risk environments where reliability is crucial.
|
||||
|
||||
Once PMF has been achieved and the framework has been extensively benchmarked we aim to establish high value contracts with customers in Security, Logistics, Manufacturing, Health and various other untapped industries.
|
||||
|
||||
Our growth strategy for the OS framework can be summarized by:
|
||||
|
||||
- Educating developers on value of autonomous agent usage.
|
||||
- Tutorial Walkthrough on various applications like deploying multi-modal agents through cameras or building custom swarms for a specific business operation.
|
||||
- Demonstrate unmatched reliability by delighting users.
|
||||
- Staying up to date with trends and integrating the latest models, frameworks, and methodologies.
|
||||
- Building a loyal and devoted community for long term user retention. [Join here](https://codex.apac.ai)
|
||||
|
||||
As we continuously deliver value with the open framework we will strategically position ourselves to acquire leads for high value contracts by demonstrating the power, reliability, and performance of our framework openly.
|
||||
|
||||
Acquire Full Access to the memo here: [TSC Memo](https://docs.google.com/document/d/1hS_nv_lFjCqLfnJBoF6ULY9roTbSgSuCkvXvSUSc7Lo/edit?usp=sharing)
|
@ -0,0 +1,187 @@
|
||||
```markdown
|
||||
# Swarm Alpha: Data Cruncher
|
||||
**Overview**: Processes large datasets.
|
||||
**Strengths**: Efficient data handling.
|
||||
**Weaknesses**: Requires structured data.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
FOR each data_entry IN dataset:
|
||||
result = PROCESS(data_entry)
|
||||
STORE(result)
|
||||
END FOR
|
||||
RETURN aggregated_results
|
||||
```
|
||||
|
||||
# Swarm Beta: Artistic Ally
|
||||
**Overview**: Generates art pieces.
|
||||
**Strengths**: Creativity.
|
||||
**Weaknesses**: Somewhat unpredictable.
|
||||
|
||||
**Pseudo Code**:
|
||||
```scss
|
||||
INITIATE canvas_parameters
|
||||
SELECT art_style
|
||||
DRAW(canvas_parameters, art_style)
|
||||
RETURN finished_artwork
|
||||
```
|
||||
|
||||
# Swarm Gamma: Sound Sculptor
|
||||
**Overview**: Crafts audio sequences.
|
||||
**Strengths**: Diverse audio outputs.
|
||||
**Weaknesses**: Complexity in refining outputs.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
DEFINE sound_parameters
|
||||
SELECT audio_style
|
||||
GENERATE_AUDIO(sound_parameters, audio_style)
|
||||
RETURN audio_sequence
|
||||
```
|
||||
|
||||
# Swarm Delta: Web Weaver
|
||||
**Overview**: Constructs web designs.
|
||||
**Strengths**: Modern design sensibility.
|
||||
**Weaknesses**: Limited to web interfaces.
|
||||
|
||||
**Pseudo Code**:
|
||||
```scss
|
||||
SELECT template
|
||||
APPLY user_preferences(template)
|
||||
DESIGN_web(template, user_preferences)
|
||||
RETURN web_design
|
||||
```
|
||||
|
||||
# Swarm Epsilon: Code Compiler
|
||||
**Overview**: Writes and compiles code snippets.
|
||||
**Strengths**: Quick code generation.
|
||||
**Weaknesses**: Limited to certain programming languages.
|
||||
|
||||
**Pseudo Code**:
|
||||
```scss
|
||||
DEFINE coding_task
|
||||
WRITE_CODE(coding_task)
|
||||
COMPILE(code)
|
||||
RETURN executable
|
||||
```
|
||||
|
||||
# Swarm Zeta: Security Shield
|
||||
**Overview**: Detects system vulnerabilities.
|
||||
**Strengths**: High threat detection rate.
|
||||
**Weaknesses**: Potential false positives.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
MONITOR system_activity
|
||||
IF suspicious_activity_detected:
|
||||
ANALYZE threat_level
|
||||
INITIATE mitigation_protocol
|
||||
END IF
|
||||
RETURN system_status
|
||||
```
|
||||
|
||||
# Swarm Eta: Researcher Relay
|
||||
**Overview**: Gathers and synthesizes research data.
|
||||
**Strengths**: Access to vast databases.
|
||||
**Weaknesses**: Depth of research can vary.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
DEFINE research_topic
|
||||
SEARCH research_sources(research_topic)
|
||||
SYNTHESIZE findings
|
||||
RETURN research_summary
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Swarm Theta: Sentiment Scanner
|
||||
**Overview**: Analyzes text for sentiment and emotional tone.
|
||||
**Strengths**: Accurate sentiment detection.
|
||||
**Weaknesses**: Contextual nuances might be missed.
|
||||
|
||||
**Pseudo Code**:
|
||||
```arduino
|
||||
INPUT text_data
|
||||
ANALYZE text_data FOR emotional_tone
|
||||
DETERMINE sentiment_value
|
||||
RETURN sentiment_value
|
||||
```
|
||||
|
||||
# Swarm Iota: Image Interpreter
|
||||
**Overview**: Processes and categorizes images.
|
||||
**Strengths**: High image recognition accuracy.
|
||||
**Weaknesses**: Can struggle with abstract visuals.
|
||||
|
||||
**Pseudo Code**:
|
||||
```objective-c
|
||||
LOAD image_data
|
||||
PROCESS image_data FOR features
|
||||
CATEGORIZE image_based_on_features
|
||||
RETURN image_category
|
||||
```
|
||||
|
||||
# Swarm Kappa: Language Learner
|
||||
**Overview**: Translates and interprets multiple languages.
|
||||
**Strengths**: Supports multiple languages.
|
||||
**Weaknesses**: Nuances in dialects might pose challenges.
|
||||
|
||||
**Pseudo Code**:
|
||||
```vbnet
|
||||
RECEIVE input_text, target_language
|
||||
TRANSLATE input_text TO target_language
|
||||
RETURN translated_text
|
||||
```
|
||||
|
||||
# Swarm Lambda: Trend Tracker
|
||||
**Overview**: Monitors and predicts trends based on data.
|
||||
**Strengths**: Proactive trend identification.
|
||||
**Weaknesses**: Requires continuous data stream.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
COLLECT data_over_time
|
||||
ANALYZE data_trends
|
||||
PREDICT upcoming_trends
|
||||
RETURN trend_forecast
|
||||
```
|
||||
|
||||
# Swarm Mu: Financial Forecaster
|
||||
**Overview**: Analyzes financial data to predict market movements.
|
||||
**Strengths**: In-depth financial analytics.
|
||||
**Weaknesses**: Market volatility can affect predictions.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
GATHER financial_data
|
||||
COMPUTE statistical_analysis
|
||||
FORECAST market_movements
|
||||
RETURN financial_projections
|
||||
```
|
||||
|
||||
# Swarm Nu: Network Navigator
|
||||
**Overview**: Optimizes and manages network traffic.
|
||||
**Strengths**: Efficient traffic management.
|
||||
**Weaknesses**: Depends on network infrastructure.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
MONITOR network_traffic
|
||||
IDENTIFY congestion_points
|
||||
OPTIMIZE traffic_flow
|
||||
RETURN network_status
|
||||
```
|
||||
|
||||
# Swarm Xi: Content Curator
|
||||
**Overview**: Gathers and presents content based on user preferences.
|
||||
**Strengths**: Personalized content delivery.
|
||||
**Weaknesses**: Limited by available content sources.
|
||||
|
||||
**Pseudo Code**:
|
||||
```sql
|
||||
DEFINE user_preferences
|
||||
SEARCH content_sources
|
||||
FILTER content_matching_preferences
|
||||
DISPLAY curated_content
|
||||
```
|
||||
|
@ -0,0 +1,50 @@
|
||||
# Swarms Multi-Agent Permissions System (SMAPS)
|
||||
|
||||
## Description
|
||||
SMAPS is a robust permissions management system designed to integrate seamlessly with Swarm's multi-agent AI framework. Drawing inspiration from Amazon's IAM, SMAPS ensures secure, granular control over agent actions while allowing for collaborative human-in-the-loop interventions.
|
||||
|
||||
## Technical Specification
|
||||
|
||||
### 1. Components
|
||||
|
||||
- **User Management**: Handle user registrations, roles, and profiles.
|
||||
- **Agent Management**: Register, monitor, and manage AI agents.
|
||||
- **Permissions Engine**: Define and enforce permissions based on roles.
|
||||
- **Multiplayer Interface**: Allows multiple human users to intervene, guide, or collaborate on tasks being executed by AI agents.
|
||||
|
||||
### 2. Features
|
||||
|
||||
- **Role-Based Access Control (RBAC)**:
|
||||
- Users can be assigned predefined roles (e.g., Admin, Agent Supervisor, Collaborator).
|
||||
- Each role has specific permissions associated with it, defining what actions can be performed on AI agents or tasks.
|
||||
|
||||
- **Dynamic Permissions**:
|
||||
- Create custom roles with specific permissions.
|
||||
- Permissions granularity: From broad (e.g., view all tasks) to specific (e.g., modify parameters of a particular agent).
|
||||
|
||||
- **Multiplayer Collaboration**:
|
||||
- Multiple users can join a task in real-time.
|
||||
- Collaborators can provide real-time feedback or guidance to AI agents.
|
||||
- A voting system for decision-making when human intervention is required.
|
||||
|
||||
- **Agent Supervision**:
|
||||
- Monitor agent actions in real-time.
|
||||
- Intervene, if necessary, to guide agent actions based on permissions.
|
||||
|
||||
- **Audit Trail**:
|
||||
- All actions, whether performed by humans or AI agents, are logged.
|
||||
- Review historical actions, decisions, and interventions for accountability and improvement.
|
||||
|
||||
### 3. Security
|
||||
|
||||
- **Authentication**: Secure login mechanisms with multi-factor authentication options.
|
||||
- **Authorization**: Ensure users and agents can only perform actions they are permitted to.
|
||||
- **Data Encryption**: All data, whether at rest or in transit, is encrypted using industry-standard protocols.
|
||||
|
||||
### 4. Integration
|
||||
|
||||
- **APIs**: Expose APIs for integrating SMAPS with other systems or for extending its capabilities.
|
||||
- **SDK**: Provide software development kits for popular programming languages to facilitate integration and extension.
|
||||
|
||||
## Documentation Description
|
||||
Swarms Multi-Agent Permissions System (SMAPS) offers a sophisticated permissions management mechanism tailored for multi-agent AI frameworks. It combines the robustness of Amazon IAM-like permissions with a unique "multiplayer" feature, allowing multiple humans to collaboratively guide AI agents in real-time. This ensures not only that tasks are executed efficiently but also that they uphold the highest standards of accuracy and ethics. With SMAPS, businesses can harness the power of swarms with confidence, knowing that they have full control and transparency over their AI operations.
|
@ -0,0 +1,73 @@
|
||||
# AgentArchive Documentation
|
||||
## Swarms Multi-Agent Framework
|
||||
|
||||
**AgentArchive is an advanced feature crafted to archive, bookmark, and harness the transcripts of agent runs. It promotes the storing and leveraging of successful agent interactions, offering a powerful means for users to derive "recipes" for future agents. Furthermore, with its public archive feature, users can contribute to and benefit from the collective wisdom of the community.**
|
||||
|
||||
---
|
||||
|
||||
## Overview:
|
||||
|
||||
AgentArchive empowers users to:
|
||||
1. Preserve complete transcripts of agent instances.
|
||||
2. Bookmark and annotate significant runs.
|
||||
3. Categorize runs using various tags.
|
||||
4. Transform successful runs into actionable "recipes".
|
||||
5. Publish and access a shared knowledge base via a public archive.
|
||||
|
||||
---
|
||||
|
||||
## Features:
|
||||
|
||||
### 1. Archiving:
|
||||
|
||||
- **Save Transcripts**: Retain the full narrative of an agent's interaction and choices.
|
||||
- **Searchable Database**: Dive into archives using specific keywords, timestamps, or tags.
|
||||
|
||||
### 2. Bookmarking:
|
||||
|
||||
- **Highlight Essential Runs**: Designate specific agent runs for future reference.
|
||||
- **Annotations**: Embed notes or remarks to bookmarked runs for clearer understanding.
|
||||
|
||||
### 3. Tagging:
|
||||
|
||||
Organize and classify agent runs via:
|
||||
- **Prompt**: The originating instruction that triggered the agent run.
|
||||
- **Tasks**: Distinct tasks or operations executed by the agent.
|
||||
- **Model**: The specific AI model or iteration used during the interaction.
|
||||
- **Temperature (Temp)**: The set randomness or innovation level for the agent.
|
||||
|
||||
### 4. Recipe Generation:
|
||||
|
||||
- **Standardization**: Convert successful run transcripts into replicable "recipes".
|
||||
- **Guidance**: Offer subsequent agents a structured approach, rooted in prior successes.
|
||||
- **Evolution**: Periodically refine recipes based on newer, enhanced runs.
|
||||
|
||||
### 5. Public Archive & Sharing:
|
||||
|
||||
- **Publish Successful Runs**: Users can choose to share their successful agent runs.
|
||||
- **Collaborative Knowledge Base**: Access a shared repository of successful agent interactions from the community.
|
||||
- **Ratings & Reviews**: Users can rate and review shared runs, highlighting particularly effective "recipes."
|
||||
- **Privacy & Redaction**: Ensure that any sensitive information is automatically redacted before publishing.
|
||||
|
||||
---
|
||||
|
||||
## Benefits:
|
||||
|
||||
1. **Efficiency**: Revisit past agent activities to inform and guide future decisions.
|
||||
2. **Consistency**: Guarantee a uniform approach to recurring challenges, leading to predictable and trustworthy outcomes.
|
||||
3. **Collaborative Learning**: Tap into a reservoir of shared experiences, fostering community-driven learning and growth.
|
||||
4. **Transparency**: By sharing successful runs, users can build trust and contribute to the broader community's success.
|
||||
|
||||
---
|
||||
|
||||
## Usage:
|
||||
|
||||
1. **Access AgentArchive**: Navigate to the dedicated section within the Swarms Multi-Agent Framework dashboard.
|
||||
2. **Search, Filter & Organize**: Utilize the search bar and tagging system for precise retrieval.
|
||||
3. **Bookmark, Annotate & Share**: Pin important runs, add notes, and consider sharing with the broader community.
|
||||
4. **Engage with Public Archive**: Explore, rate, and apply shared knowledge to enhance agent performance.
|
||||
|
||||
---
|
||||
|
||||
With AgentArchive, users not only benefit from their past interactions but can also leverage the collective expertise of the Swarms community, ensuring continuous improvement and shared success.
|
||||
|
@ -0,0 +1,67 @@
|
||||
# Swarms Multi-Agent Framework Documentation
|
||||
|
||||
## Table of Contents
|
||||
- Agent Failure Protocol
|
||||
- Swarm Failure Protocol
|
||||
|
||||
---
|
||||
|
||||
## Agent Failure Protocol
|
||||
|
||||
### 1. Overview
|
||||
Agent failures may arise from bugs, unexpected inputs, or external system changes. This protocol aims to diagnose, address, and prevent such failures.
|
||||
|
||||
### 2. Root Cause Analysis
|
||||
- **Data Collection**: Record the task, inputs, and environmental variables present during the failure.
|
||||
- **Diagnostic Tests**: Run the agent in a controlled environment replicating the failure scenario.
|
||||
- **Error Logging**: Analyze error logs to identify patterns or anomalies.
|
||||
|
||||
### 3. Solution Brainstorming
|
||||
- **Code Review**: Examine the code sections linked to the failure for bugs or inefficiencies.
|
||||
- **External Dependencies**: Check if external systems or data sources have changed.
|
||||
- **Algorithmic Analysis**: Evaluate if the agent's algorithms were overwhelmed or faced an unhandled scenario.
|
||||
|
||||
### 4. Risk Analysis & Solution Ranking
|
||||
- Assess the potential risks associated with each solution.
|
||||
- Rank solutions based on:
|
||||
- Implementation complexity
|
||||
- Potential negative side effects
|
||||
- Resource requirements
|
||||
- Assign a success probability score (0.0 to 1.0) based on the above factors.
|
||||
|
||||
### 5. Solution Implementation
|
||||
- Implement the top 3 solutions sequentially, starting with the highest success probability.
|
||||
- If all three solutions fail, trigger the "Human-in-the-Loop" protocol.
|
||||
|
||||
---
|
||||
|
||||
## Swarm Failure Protocol
|
||||
|
||||
### 1. Overview
|
||||
Swarm failures are more complex, often resulting from inter-agent conflicts, systemic bugs, or large-scale environmental changes. This protocol delves deep into such failures to ensure the swarm operates optimally.
|
||||
|
||||
### 2. Root Cause Analysis
|
||||
- **Inter-Agent Analysis**: Examine if agents were in conflict or if there was a breakdown in collaboration.
|
||||
- **System Health Checks**: Ensure all system components supporting the swarm are operational.
|
||||
- **Environment Analysis**: Investigate if external factors or systems impacted the swarm's operation.
|
||||
|
||||
### 3. Solution Brainstorming
|
||||
- **Collaboration Protocols**: Review and refine how agents collaborate.
|
||||
- **Resource Allocation**: Check if the swarm had adequate computational and memory resources.
|
||||
- **Feedback Loops**: Ensure agents are effectively learning from each other.
|
||||
|
||||
### 4. Risk Analysis & Solution Ranking
|
||||
- Assess the potential systemic risks posed by each solution.
|
||||
- Rank solutions considering:
|
||||
- Scalability implications
|
||||
- Impact on individual agents
|
||||
- Overall swarm performance potential
|
||||
- Assign a success probability score (0.0 to 1.0) based on the above considerations.
|
||||
|
||||
### 5. Solution Implementation
|
||||
- Implement the top 3 solutions sequentially, prioritizing the one with the highest success probability.
|
||||
- If all three solutions are unsuccessful, invoke the "Human-in-the-Loop" protocol for expert intervention.
|
||||
|
||||
---
|
||||
|
||||
By following these protocols, the Swarms Multi-Agent Framework can systematically address and prevent failures, ensuring a high degree of reliability and efficiency.
|
@ -0,0 +1,49 @@
|
||||
# Human-in-the-Loop Task Handling Protocol
|
||||
|
||||
## Overview
|
||||
|
||||
The Swarms Multi-Agent Framework recognizes the invaluable contributions humans can make, especially in complex scenarios where nuanced judgment is required. The "Human-in-the-Loop Task Handling Protocol" ensures that when agents encounter challenges they cannot handle autonomously, the most capable human collaborator is engaged to provide guidance, based on their skills and expertise.
|
||||
|
||||
## Protocol Steps
|
||||
|
||||
### 1. Task Initiation & Analysis
|
||||
|
||||
- When a task is initiated, agents first analyze the task's requirements.
|
||||
- The system maintains an understanding of each task's complexity, requirements, and potential challenges.
|
||||
|
||||
### 2. Automated Resolution Attempt
|
||||
|
||||
- Agents first attempt to resolve the task autonomously using their algorithms and data.
|
||||
- If the task can be completed without issues, it progresses normally.
|
||||
|
||||
### 3. Challenge Detection
|
||||
|
||||
- If agents encounter challenges or uncertainties they cannot resolve, the "Human-in-the-Loop" protocol is triggered.
|
||||
|
||||
### 4. Human Collaborator Identification
|
||||
|
||||
- The system maintains a dynamic profile of each human collaborator, cataloging their skills, expertise, and past performance on related tasks.
|
||||
- Using this profile data, the system identifies the most capable human collaborator to assist with the current challenge.
|
||||
|
||||
### 5. Real-time Collaboration
|
||||
|
||||
- The identified human collaborator is notified and provided with all the relevant information about the task and the challenge.
|
||||
- Collaborators can provide guidance, make decisions, or even take over specific portions of the task.
|
||||
|
||||
### 6. Task Completion & Feedback Loop
|
||||
|
||||
- Once the challenge is resolved, agents continue with the task until completion.
|
||||
- Feedback from human collaborators is used to update agent algorithms, ensuring continuous learning and improvement.
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Maintain Up-to-date Human Profiles**: Ensure that the skillsets, expertise, and performance metrics of human collaborators are updated regularly.
|
||||
2. **Limit Interruptions**: Implement mechanisms to limit the frequency of human interventions, ensuring collaborators are not overwhelmed with requests.
|
||||
3. **Provide Context**: When seeking human intervention, provide collaborators with comprehensive context to ensure they can make informed decisions.
|
||||
4. **Continuous Training**: Regularly update and train agents based on feedback from human collaborators.
|
||||
5. **Measure & Optimize**: Monitor the efficiency of the "Human-in-the-Loop" protocol, aiming to reduce the frequency of interventions while maximizing the value of each intervention.
|
||||
6. **Skill Enhancement**: Encourage human collaborators to continuously enhance their skills, ensuring that the collective expertise of the group grows over time.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The integration of human expertise with AI capabilities is a cornerstone of the Swarms Multi-Agent Framework. This "Human-in-the-Loop Task Handling Protocol" ensures that tasks are executed efficiently, leveraging the best of both human judgment and AI automation. Through collaborative synergy, we can tackle challenges more effectively and drive innovation.
|
@ -0,0 +1,48 @@
|
||||
# Secure Communication Protocols
|
||||
|
||||
## Overview
|
||||
|
||||
The Swarms Multi-Agent Framework prioritizes the security and integrity of data, especially personal and sensitive information. Our Secure Communication Protocols ensure that all communications between agents are encrypted, authenticated, and resistant to tampering or unauthorized access.
|
||||
|
||||
## Features
|
||||
|
||||
### 1. End-to-End Encryption
|
||||
|
||||
- All inter-agent communications are encrypted using state-of-the-art cryptographic algorithms.
|
||||
- This ensures that data remains confidential and can only be read by the intended recipient agent.
|
||||
|
||||
### 2. Authentication
|
||||
|
||||
- Before initiating communication, agents authenticate each other using digital certificates.
|
||||
- This prevents impersonation attacks and ensures that agents are communicating with legitimate counterparts.
|
||||
|
||||
### 3. Forward Secrecy
|
||||
|
||||
- Key exchange mechanisms employ forward secrecy, meaning that even if a malicious actor gains access to an encryption key, they cannot decrypt past communications.
|
||||
|
||||
### 4. Data Integrity
|
||||
|
||||
- Cryptographic hashes ensure that the data has not been altered in transit.
|
||||
- Any discrepancies in data integrity result in the communication being rejected.
|
||||
|
||||
### 5. Zero-Knowledge Protocols
|
||||
|
||||
- When handling especially sensitive data, agents use zero-knowledge proofs to validate information without revealing the actual data.
|
||||
|
||||
### 6. Periodic Key Rotation
|
||||
|
||||
- To mitigate the risk of long-term key exposure, encryption keys are periodically rotated.
|
||||
- Old keys are securely discarded, ensuring that even if they are compromised, they cannot be used to decrypt communications.
|
||||
|
||||
## Best Practices for Handling Personal and Sensitive Information
|
||||
|
||||
1. **Data Minimization**: Agents should only request and process the minimum amount of personal data necessary for the task.
|
||||
2. **Anonymization**: Whenever possible, agents should anonymize personal data, stripping away identifying details.
|
||||
3. **Data Retention Policies**: Personal data should be retained only for the period necessary to complete the task, after which it should be securely deleted.
|
||||
4. **Access Controls**: Ensure that only authorized agents have access to personal and sensitive information. Implement strict access control mechanisms.
|
||||
5. **Regular Audits**: Conduct regular security audits to ensure compliance with privacy regulations and to detect any potential vulnerabilities.
|
||||
6. **Training**: All agents should be regularly updated and trained on the latest security protocols and best practices for handling sensitive data.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Secure communication is paramount in the Swarms Multi-Agent Framework, especially when dealing with personal and sensitive information. Adhering to these protocols and best practices ensures the safety, privacy, and trust of all stakeholders involved.
|
@ -0,0 +1,68 @@
|
||||
# Promptimizer Documentation
|
||||
## Swarms Multi-Agent Framework
|
||||
|
||||
**The Promptimizer Tool stands as a cornerstone innovation within the Swarms Multi-Agent Framework, meticulously engineered to refine and supercharge prompts across diverse categories. Capitalizing on extensive libraries of best-practice prompting techniques, this tool ensures your prompts are razor-sharp, tailored, and primed for optimal outcomes.**
|
||||
|
||||
---
|
||||
|
||||
## Overview:
|
||||
|
||||
The Promptimizer Tool is crafted to:
|
||||
1. Rigorously analyze and elevate the quality of provided prompts.
|
||||
2. Furnish best-in-class recommendations rooted in proven prompting strategies.
|
||||
3. Serve a spectrum of categories, from technical operations to expansive creative ventures.
|
||||
|
||||
---
|
||||
|
||||
## Core Features:
|
||||
|
||||
### 1. Deep Prompt Analysis:
|
||||
|
||||
- **Clarity Matrix**: A proprietary algorithm assessing prompt clarity, removing ambiguities and sharpening focus.
|
||||
- **Efficiency Gauge**: Evaluates the prompt's structure to ensure swift and precise desired results.
|
||||
|
||||
### 2. Adaptive Recommendations:
|
||||
|
||||
- **Technique Engine**: Suggests techniques aligned with the gold standard for the chosen category.
|
||||
- **Exemplar Database**: Offers an extensive array of high-quality prompt examples for comparison and inspiration.
|
||||
|
||||
### 3. Versatile Category Framework:
|
||||
|
||||
- **Tech Suite**: Optimizes prompts for technical tasks, ensuring actionable clarity.
|
||||
- **Narrative Craft**: Hones prompts to elicit vivid and coherent stories.
|
||||
- **Visual Visionary**: Shapes prompts for precise and dynamic visual generation.
|
||||
- **Sonic Sculptor**: Orchestrates prompts for audio creation, tuning into desired tones and moods.
|
||||
|
||||
### 4. Machine Learning Integration:
|
||||
|
||||
- **Feedback Dynamo**: Harnesses user feedback, continually refining the tool's recommendation capabilities.
|
||||
- **Live Library Updates**: Periodic syncing with the latest in prompting techniques, ensuring the tool remains at the cutting edge.
|
||||
|
||||
### 5. Collaboration & Sharing:
|
||||
|
||||
- **TeamSync**: Allows teams to collaborate on prompt optimization in real-time.
|
||||
- **ShareSpace**: Share and access a community-driven repository of optimized prompts, fostering collective growth.
|
||||
|
||||
---
|
||||
|
||||
## Benefits:
|
||||
|
||||
1. **Precision Engineering**: Harness the power of refined prompts, ensuring desired outcomes are achieved with surgical precision.
|
||||
2. **Learning Hub**: Immerse in a tool that not only refines but educates, enhancing the user's prompting acumen.
|
||||
3. **Versatile Mastery**: Navigate seamlessly across categories, ensuring top-tier prompt quality regardless of the domain.
|
||||
4. **Community-driven Excellence**: Dive into a world of shared knowledge, elevating the collective expertise of the Swarms community.
|
||||
|
||||
---
|
||||
|
||||
## Usage Workflow:
|
||||
|
||||
1. **Launch the Prompt Optimizer**: Access the tool directly from the Swarms Multi-Agent Framework dashboard.
|
||||
2. **Prompt Entry**: Input the initial prompt for refinement.
|
||||
3. **Category Selection**: Pinpoint the desired category for specialized optimization.
|
||||
4. **Receive & Review**: Engage with the tool's recommendations, comparing original and optimized prompts.
|
||||
5. **Collaborate, Implement & Share**: Work in tandem with team members, deploy the refined prompt, and consider contributing to the community repository.
|
||||
|
||||
---
|
||||
|
||||
By integrating the Promptimizer Tool into their workflow, Swarms users stand poised to redefine the boundaries of what's possible, turning each prompt into a beacon of excellence and efficiency.
|
||||
|
@ -0,0 +1,68 @@
|
||||
# Shorthand Communication System
|
||||
## Swarms Multi-Agent Framework
|
||||
|
||||
**The Enhanced Shorthand Communication System is designed to streamline agent-agent communication within the Swarms Multi-Agent Framework. This system employs concise alphanumeric notations to relay task-specific details to agents efficiently.**
|
||||
|
||||
---
|
||||
|
||||
## Format:
|
||||
|
||||
The shorthand format is structured as `[AgentType]-[TaskLayer].[TaskNumber]-[Priority]-[Status]`.
|
||||
|
||||
---
|
||||
|
||||
## Components:
|
||||
|
||||
### 1. Agent Type:
|
||||
- Denotes the specific agent role, such as:
|
||||
* `C`: Code agent
|
||||
* `D`: Data processing agent
|
||||
* `M`: Monitoring agent
|
||||
* `N`: Network agent
|
||||
* `R`: Resource management agent
|
||||
* `I`: Interface agent
|
||||
* `S`: Security agent
|
||||
|
||||
### 2. Task Layer & Number:
|
||||
- Represents the task's category.
|
||||
* Example: `1.8` signifies Task layer 1, task number 8.
|
||||
|
||||
### 3. Priority:
|
||||
- Indicates task urgency.
|
||||
* `H`: High
|
||||
* `M`: Medium
|
||||
* `L`: Low
|
||||
|
||||
### 4. Status:
|
||||
- Gives a snapshot of the task's progress.
|
||||
* `I`: Initialized
|
||||
* `P`: In-progress
|
||||
* `C`: Completed
|
||||
* `F`: Failed
|
||||
* `W`: Waiting
|
||||
|
||||
---
|
||||
|
||||
## Extended Features:
|
||||
|
||||
### 1. Error Codes (for failures):
|
||||
- `E01`: Resource issues
|
||||
- `E02`: Data inconsistency
|
||||
- `E03`: Dependency malfunction
|
||||
... and more as needed.
|
||||
|
||||
### 2. Collaboration Flag:
|
||||
- `+`: Denotes required collaboration.
|
||||
|
||||
---
|
||||
|
||||
## Example Codes:
|
||||
|
||||
- `C-1.8-H-I`: A high-priority coding task that's initializing.
|
||||
- `D-2.3-M-P`: A medium-priority data task currently in-progress.
|
||||
- `M-3.5-L-P+`: A low-priority monitoring task in progress needing collaboration.
|
||||
|
||||
---
|
||||
|
||||
By leveraging the Enhanced Shorthand Communication System, the Swarms Multi-Agent Framework can ensure swift interactions, concise communications, and effective task management.
|
||||
|
@ -0,0 +1,235 @@
|
||||
docs_dir: '.' # replace with the correct path if your documentation files are not in the same directory as mkdocs.yml
|
||||
site_name: Swarms
|
||||
site_url: https://docs.swarms.world
|
||||
site_author: Swarms
|
||||
site_description: The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework
|
||||
repo_name: kyegomez/swarms
|
||||
repo_url: https://github.com/kyegomez/swarms
|
||||
edit_uri: https://github.com/kyegomez/swarms/tree/main/docs
|
||||
copyright: TGSC Corp 2024. All rights reserved.
|
||||
|
||||
plugins:
|
||||
# - glightbox
|
||||
- search
|
||||
- git-authors
|
||||
- mkdocs-jupyter:
|
||||
kernel_name: python3
|
||||
execute: false
|
||||
include_source: True
|
||||
include_requirejs: true
|
||||
- mkdocstrings:
|
||||
default_handler: python
|
||||
handlers:
|
||||
python:
|
||||
options:
|
||||
parameter_headings: true
|
||||
paths: [supervision]
|
||||
load_external_modules: true
|
||||
allow_inspection: true
|
||||
show_bases: true
|
||||
group_by_category: true
|
||||
docstring_style: google
|
||||
show_symbol_type_heading: true
|
||||
show_symbol_type_toc: true
|
||||
show_category_heading: true
|
||||
domains: [std, py]
|
||||
- git-committers:
|
||||
repository: kyegomez/swarms
|
||||
branch: master
|
||||
# token: !ENV ["GITHUB_TOKEN"]
|
||||
- git-revision-date-localized:
|
||||
enable_creation_date: true
|
||||
extra_css:
|
||||
- assets/css/extra.css
|
||||
extra:
|
||||
social:
|
||||
- icon: fontawesome/brands/twitter
|
||||
link: https://x.com/KyeGomezB
|
||||
- icon: fontawesome/brands/github
|
||||
link: https://github.com/kyegomez/swarms
|
||||
- icon: fontawesome/brands/twitter
|
||||
link: https://x.com/swarms_corp
|
||||
- icon: fontawesome/brands/discord
|
||||
link: https://discord.com/servers/agora-999382051935506503
|
||||
|
||||
analytics:
|
||||
provider: google
|
||||
property: G-MPE9C65596
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: overrides
|
||||
logo: assets/img/swarms-logo.png
|
||||
palette:
|
||||
- scheme: default
|
||||
primary: black
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
name: Switch to dark mode
|
||||
# Palette toggle for dark mode
|
||||
- scheme: slate
|
||||
primary: black
|
||||
toggle:
|
||||
icon: material/brightness-4
|
||||
name: Switch to light mode
|
||||
features:
|
||||
- content.code.copy
|
||||
- content.code.annotate
|
||||
- navigation.tabs
|
||||
- navigation.sections
|
||||
- navigation.expand
|
||||
- navigation.top
|
||||
- announce.dismiss
|
||||
# Extensions
|
||||
markdown_extensions:
|
||||
- abbr
|
||||
- admonition
|
||||
- attr_list
|
||||
- def_list
|
||||
- footnotes
|
||||
- md_in_html
|
||||
- toc:
|
||||
permalink: true
|
||||
- pymdownx.arithmatex:
|
||||
generic: true
|
||||
- pymdownx.betterem:
|
||||
smart_enable: all
|
||||
- pymdownx.caret
|
||||
- pymdownx.details
|
||||
- pymdownx.emoji:
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.keys
|
||||
- pymdownx.magiclink:
|
||||
normalize_issue_symbols: true
|
||||
repo_url_shorthand: true
|
||||
user: squidfunk
|
||||
repo: mkdocs-material
|
||||
- pymdownx.mark
|
||||
- pymdownx.smartsymbols
|
||||
- pymdownx.snippets:
|
||||
auto_append:
|
||||
- includes/mkdocs.md
|
||||
- pymdownx.superfences:
|
||||
custom_fences:
|
||||
- name: mermaid
|
||||
class: mermaid
|
||||
format: !!python/name:pymdownx.superfences.fence_code_format
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
combine_header_slug: true
|
||||
slugify: !!python/object/apply:pymdownx.slugs.slugify
|
||||
kwds:
|
||||
case: lower
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
- pymdownx.tilde
|
||||
nav:
|
||||
- Home:
|
||||
- Overview: "index.md"
|
||||
# - Swarm Ecosystem: "swarms/ecosystem.md"
|
||||
- The Vision: "swarms/framework/vision.md"
|
||||
# - Philosophy: "swarms/framework/philosophy.md"
|
||||
# - Roadmap: "swarms/framework/roadmap.md"
|
||||
- Swarms Python Framework:
|
||||
- Install: "swarms/install/install.md"
|
||||
- Docker Setup: "swarms/install/docker_setup.md"
|
||||
- Multi-Agent Repository Template: "swarms/install/multi_agent_template.md"
|
||||
# - Getting Started with Agents: "swarms/install/getting_started.md"
|
||||
# - Getting Started with Multi-Agent Collaboration
|
||||
- Models:
|
||||
- Overview: "swarms/models/index.md"
|
||||
- How to Create A Custom Language Model: "swarms/models/custom_model.md"
|
||||
- Models Available: "swarms/models/index.md"
|
||||
- Available Models from OpenAI, Huggingface, TogetherAI, and more: "swarms/models/models_available_overview.md"
|
||||
- Language Models:
|
||||
- BaseLLM: "swarms/models/base_llm.md"
|
||||
- HuggingFaceLLM: "swarms/models/huggingface.md"
|
||||
- Anthropic: "swarms/models/anthropic.md"
|
||||
- OpenAIChat: "swarms/models/openai.md"
|
||||
- OpenAIFunctionCaller: "swarms/models/openai_function_caller.md"
|
||||
# - TogetherAI: "swarms/models/togetherai.md"
|
||||
- MultiModal Models:
|
||||
- BaseMultiModalModel: "swarms/models/base_multimodal_model.md"
|
||||
- Multi Modal Models Available: "swarms/models/multimodal_models.md"
|
||||
- GPT4VisionAPI: "swarms/models/gpt4v.md"
|
||||
- Agents:
|
||||
# - Overview: "swarms/structs/index.md"
|
||||
- Analyzing The Agent Architecture: "swarms/framework/agents_explained.md"
|
||||
- Build Custom Agents: "swarms/structs/diy_your_own_agent.md"
|
||||
- Complete Agent API: "swarms/structs/agent.md"
|
||||
- Tasks, Agents with runtimes, triggers, task prioritiies, scheduled tasks, and more: "swarms/structs/task.md"
|
||||
- Tools:
|
||||
- Overview: "swarms/tools/main.md"
|
||||
- What are tools?: "swarms/tools/build_tool.md"
|
||||
- ToolAgent: "swarms/agents/tool_agent.md"
|
||||
# - Tool Decorator: "swarms/tools/decorator.md"
|
||||
- Tool Storage & tool_registry decorator: "swarms/tools/tool_storage.md"
|
||||
- RAG or Long Term Memory:
|
||||
- Long Term Memory with RAG: "swarms/memory/diy_memory.md"
|
||||
- Artifacts:
|
||||
- Overview: "swarms/artifacts/artifact.md"
|
||||
- Multi Agent Collaboration:
|
||||
- Overview: "swarms/structs/multi_agent_orchestration.md"
|
||||
- Swarm Architectures: "swarms/concept/swarm_architectures.md"
|
||||
- Multi-Agent Workflows: "swarms/structs/multi_agent_collaboration_examples.md"
|
||||
- Conversation: "swarms/structs/conversation.md"
|
||||
- SwarmNetwork: "swarms/structs/swarm_network.md"
|
||||
- MajorityVoting: "swarms/structs/majorityvoting.md"
|
||||
- AgentRearrange: "swarms/structs/agent_rearrange.md"
|
||||
- RoundRobin: "swarms/structs/round_robin_swarm.md"
|
||||
- Mixture of Agents: "swarms/structs/moa.md"
|
||||
- GraphWorkflow: "swarms/structs/graph_workflow.md"
|
||||
- AsyncWorkflow: "swarms/structs/async_workflow.md"
|
||||
- AutoSwarmRouter: "swarms/structs/auto_swarm_router.md"
|
||||
- AutoSwarm: "swarms/structs/auto_swarm.md"
|
||||
- GroupChat: "swarms/structs/group_chat.md"
|
||||
- AgentRegistry: "swarms/structs/agent_registry.md"
|
||||
# - Workflows: "swarms/structs/workflows.md"
|
||||
# - Workflows:
|
||||
# - BaseWorkflow: "swarms/structs/base_workflow.md"
|
||||
# - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md"
|
||||
# - SequentialWorkflow: "swarms/structs/sequential_workflow.md"
|
||||
# - MultiProcessingWorkflow: "swarms/structs/multi_processing_workflow.md"
|
||||
- Structs:
|
||||
- BaseStructure: "swarms/structs/basestructure.md"
|
||||
- Task: "swarms/structs/task.md"
|
||||
- YamlModel: "swarms/structs/yaml_model.md"
|
||||
- Contributing:
|
||||
- Tests: "swarms/framework/test.md"
|
||||
- Contributing: "contributing.md"
|
||||
- Code Cleanliness: "swarms/framework/code_cleanliness.md"
|
||||
- Swarms Cloud API:
|
||||
- Overview: "swarms_cloud/main.md"
|
||||
- Available Models: "swarms_cloud/available_models.md"
|
||||
- Agent API: "swarms_cloud/agent_api.md"
|
||||
- Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md"
|
||||
- Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md"
|
||||
- Swarms Memory:
|
||||
- Overview: "swarms_memory/index.md"
|
||||
- Memory Systems:
|
||||
- ChromaDB: "swarms_memory/chromadb.md"
|
||||
- Pinecone: "swarms_memory/pinecone.md"
|
||||
- Faiss: "swarms_memory/faiss.md"
|
||||
- Swarms Marketplace:
|
||||
- Overview: "swarms_platform/index.md"
|
||||
- Share & Discover Prompts, Agents, Tools, and more: "swarms_platform/share_discover.md"
|
||||
- Prompts API:
|
||||
- Add Prompts: "swarms_platform/prompts/add_prompt.md"
|
||||
- Edit Prompts: "swarms_platform/prompts/edit_prompt.md"
|
||||
- Query Prompts: "swarms_platform/prompts/fetch_prompts.md"
|
||||
- Agents API:
|
||||
- Add Agents: "swarms_platform/agents/agents_api.md"
|
||||
- Query Agents: "swarms_platform/agents/fetch_agents.md"
|
||||
- Edit Agents: "swarms_platform/agents/edit_agent.md"
|
||||
# - Tools API:
|
||||
# - Overview: "swarms_platform/tools_api.md"
|
||||
# - Add Tools: "swarms_platform/fetch_tools.md"
|
||||
- Guides:
|
||||
- Understanding Agent Evaluation Mechanisms: "guides/agent_evals.md"
|
||||
- Agent Glossary: "swarms/glossary.md"
|
@ -0,0 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
<!--https://squidfunk.github.io/mkdocs-material/customization/#overriding-blocks-->
|
||||
|
||||
{% block announce %}
|
||||
<div style="text-align:center">
|
||||
<a href="https://github.com/kyegomez/swarms">Star and contribute</a> to Swarms on GitHub!
|
||||
</div>
|
||||
{% endblock %}
|
@ -0,0 +1,55 @@
|
||||
# The Limits of Individual Agents
|
||||
|
||||
![Reliable Agents](docs/assets/img/reliabilitythrough.png)
|
||||
|
||||
|
||||
Individual agents have pushed the boundaries of what machines can learn and accomplish. However, despite their impressive capabilities, these agents face inherent limitations that can hinder their effectiveness in complex, real-world applications. This blog explores the critical constraints of individual agents, such as context window limits, hallucination, single-task threading, and lack of collaboration, and illustrates how multi-agent collaboration can address these limitations. In short,
|
||||
|
||||
- Context Window Limits
|
||||
- Single Task Execution
|
||||
- Hallucination
|
||||
- No collaboration
|
||||
|
||||
|
||||
|
||||
#### Context Window Limits
|
||||
|
||||
One of the most significant constraints of individual agents, particularly in the domain of language models, is the context window limit. This limitation refers to the maximum amount of information an agent can consider at any given time. For instance, many language models can only process a fixed number of tokens (words or characters) in a single inference, restricting their ability to understand and generate responses based on longer texts. This limitation can lead to a lack of coherence in longer compositions and an inability to maintain context in extended conversations or documents.
|
||||
|
||||
#### Hallucination
|
||||
|
||||
Hallucination in AI refers to the phenomenon where an agent generates information that is not grounded in the input data or real-world facts. This can manifest as making up facts, entities, or events that do not exist or are incorrect. Hallucinations pose a significant challenge in ensuring the reliability and trustworthiness of AI-generated content, particularly in critical applications such as news generation, academic research, and legal advice.
|
||||
|
||||
#### Single Task Threading
|
||||
|
||||
Individual agents are often designed to excel at specific tasks, leveraging their architecture and training data to optimize performance in a narrowly defined domain. However, this specialization can also be a drawback, as it limits the agent's ability to multitask or adapt to tasks that fall outside its primary domain. Single-task threading means an agent may excel in language translation but struggle with image recognition or vice versa, necessitating the deployment of multiple specialized agents for comprehensive AI solutions.
|
||||
|
||||
#### Lack of Collaboration
|
||||
|
||||
Traditional AI agents operate in isolation, processing inputs and generating outputs independently. This isolation limits their ability to leverage diverse perspectives, share knowledge, or build upon the insights of other agents. In complex problem-solving scenarios, where multiple facets of a problem need to be addressed simultaneously, this lack of collaboration can lead to suboptimal solutions or an inability to tackle multifaceted challenges effectively.
|
||||
|
||||
# The Elegant yet Simple Solution
|
||||
|
||||
- ## Multi-Agent Collaboration
|
||||
|
||||
Recognizing the limitations of individual agents, researchers and practitioners have explored the potential of multi-agent collaboration as a means to transcend these constraints. Multi-agent systems comprise several agents that can interact, communicate, and collaborate to achieve common goals or solve complex problems. This collaborative approach offers several advantages:
|
||||
|
||||
#### Overcoming Context Window Limits
|
||||
|
||||
By dividing a large task among multiple agents, each focusing on different segments of the problem, multi-agent systems can effectively overcome the context window limits of individual agents. For instance, in processing a long document, different agents could be responsible for understanding and analyzing different sections, pooling their insights to generate a coherent understanding of the entire text.
|
||||
|
||||
#### Mitigating Hallucination
|
||||
|
||||
Through collaboration, agents can cross-verify facts and information, reducing the likelihood of hallucinations. If one agent generates a piece of information, other agents can provide checks and balances, verifying the accuracy against known data or through consensus mechanisms.
|
||||
|
||||
#### Enhancing Multitasking Capabilities
|
||||
|
||||
Multi-agent systems can tackle tasks that require a diverse set of skills by leveraging the specialization of individual agents. For example, in a complex project that involves both natural language processing and image analysis, one agent specialized in text can collaborate with another specialized in visual data, enabling a comprehensive approach to the task.
|
||||
|
||||
#### Facilitating Collaboration and Knowledge Sharing
|
||||
|
||||
Multi-agent collaboration inherently encourages the sharing of knowledge and insights, allowing agents to learn from each other and improve their collective performance. This can be particularly powerful in scenarios where iterative learning and adaptation are crucial, such as dynamic environments or tasks that evolve over time.
|
||||
|
||||
### Conclusion
|
||||
|
||||
While individual AI agents have made remarkable strides in various domains, their inherent limitations necessitate innovative approaches to unlock the full potential of artificial intelligence. Multi-agent collaboration emerges as a compelling solution, offering a pathway to transcend individual constraints through collective intelligence. By harnessing the power of collaborative AI, we can address more complex, multifaceted problems, paving the way for more versatile, efficient, and effective AI systems in the future.
|
@ -0,0 +1,134 @@
|
||||
# The Swarms Framework: Orchestrating Agents for Enterprise Automation
|
||||
|
||||
In the rapidly evolving landscape of artificial intelligence (AI) and automation, a new paradigm is emerging: the orchestration of multiple agents working in collaboration to tackle complex tasks. This approach, embodied by the Swarms Framework, aims to address the fundamental limitations of individual agents and unlocks the true potential of AI-driven automation in enterprise operations.
|
||||
|
||||
Individual agents are plagued by the same issues: short term memory constraints, hallucinations, single task limitations, lack of collaboration, and cost inefficiences.
|
||||
|
||||
[Learn more here from a list of compiled agent papers](https://github.com/kyegomez/awesome-multi-agent-papers)
|
||||
|
||||
## The Purpose of Swarms: Overcoming Agent Limitations
|
||||
|
||||
Individual agents, while remarkable in their own right, face several inherent challenges that hinder their ability to effectively automate enterprise operations at scale. These limitations include:
|
||||
|
||||
1. Short-Term Memory Constraints
|
||||
2. Hallucination and Factual Inconsistencies
|
||||
3. Single-Task Limitations
|
||||
4. Lack of Collaborative Capabilities
|
||||
5. Cost Inefficiencies
|
||||
|
||||
By orchestrating multiple agents to work in concert, the Swarms Framework directly tackles these limitations, paving the way for more efficient, reliable, and cost-effective enterprise automation.
|
||||
|
||||
### Limitation 1: Short-Term Memory Constraints
|
||||
|
||||
Many AI agents, particularly those based on large language models, suffer from short-term memory constraints. These agents can effectively process and respond to prompts, but their ability to retain and reason over information across multiple interactions or tasks is limited. This limitation can be problematic in enterprise environments, where complex workflows often involve retaining and referencing contextual information over extended periods.
|
||||
|
||||
The Swarms Framework addresses this limitation by leveraging the collective memory of multiple agents working in tandem. While individual agents may have limited short-term memory, their combined memory pool becomes significantly larger, enabling the retention and retrieval of contextual information over extended periods. This collective memory is facilitated by agents specializing in information storage and retrieval, such as those based on systems like Llama Index or Pinecone.
|
||||
|
||||
### Limitation 2: Hallucination and Factual Inconsistencies
|
||||
|
||||
Another challenge faced by many AI agents is the tendency to generate responses that may contain factual inconsistencies or hallucinations -- information that is not grounded in reality or the provided context. This issue can undermine the reliability and trustworthiness of automated systems, particularly in domains where accuracy and consistency are paramount.
|
||||
|
||||
The Swarms Framework mitigates this limitation by employing multiple agents with diverse knowledge bases and capabilities. By leveraging the collective intelligence of these agents, the framework can cross-reference and validate information, reducing the likelihood of hallucinations and factual inconsistencies. Additionally, specialized agents can be tasked with fact-checking and verification, further enhancing the overall reliability of the system.
|
||||
|
||||
### Limitation 3: Single-Task Limitations
|
||||
|
||||
Most individual AI agents are designed and optimized for specific tasks or domains, limiting their ability to handle complex, multi-faceted workflows that often characterize enterprise operations. While an agent may excel at a particular task, such as natural language processing or data analysis, it may struggle with other aspects of a larger workflow, such as task coordination or decision-making.
|
||||
|
||||
The Swarms Framework overcomes this limitation by orchestrating a diverse ensemble of agents, each specializing in different tasks or capabilities. By intelligently combining and coordinating these agents, the framework can tackle complex, multi-threaded workflows that span various domains and task types. This modular approach allows for the seamless integration of new agents as they become available, enabling the continuous expansion and enhancement of the system's capabilities.
|
||||
|
||||
### Limitation 4: Lack of Collaborative Capabilities
|
||||
|
||||
Most AI agents are designed to operate independently, lacking the ability to effectively collaborate with other agents or coordinate their actions towards a common goal. This limitation can hinder the scalability and efficiency of automated systems, particularly in enterprise environments where tasks often require the coordination of multiple agents or systems.
|
||||
|
||||
The Swarms Framework addresses this limitation by introducing a layer of coordination and collaboration among agents. Through specialized coordination agents and communication protocols, the framework enables agents to share information, divide tasks, and synchronize their actions. This collaborative approach not only increases efficiency but also enables the emergence of collective intelligence, where the combined capabilities of multiple agents surpass the sum of their individual abilities.
|
||||
|
||||
### Limitation 5: Cost Inefficiencies
|
||||
|
||||
Running large AI models or orchestrating multiple agents can be computationally expensive, particularly in enterprise environments where scalability and cost-effectiveness are critical considerations. Inefficient resource utilization or redundant computations can quickly escalate costs, making widespread adoption of AI-driven automation financially prohibitive.
|
||||
|
||||
The Swarms Framework tackles this limitation by optimizing resource allocation and workload distribution among agents. By intelligently assigning tasks to the most appropriate agents and leveraging agent specialization, the framework minimizes redundant computations and improves overall resource utilization. Additionally, the framework can dynamically scale agent instances based on demand, ensuring that computational resources are allocated efficiently and costs are minimized.
|
||||
|
||||
## The Swarms Framework: A Holistic Approach to Enterprise Automation
|
||||
|
||||
The Swarms Framework is a comprehensive solution that addresses the limitations of individual agents by orchestrating their collective capabilities. By integrating agents from various frameworks, including LangChain, AutoGPT, Llama Index, and others, the framework leverages the strengths of each agent while mitigating their individual weaknesses.
|
||||
|
||||
At its core, the Swarms Framework operates on the principle of multi-agent collaboration. By introducing specialized coordination agents and communication protocols, the framework enables agents to share information, divide tasks, and synchronize their actions towards a common goal. This collaborative approach not only increases efficiency but also enables the emergence of collective intelligence, where the combined capabilities of multiple agents surpass the sum of their individual abilities.
|
||||
|
||||
The framework's architecture is modular and extensible, allowing for the seamless integration of new agents as they become available. This flexibility ensures that the system's capabilities can continuously expand and adapt to evolving enterprise needs and technological advancements.
|
||||
|
||||
|
||||
## Benefits of the Swarms Framework
|
||||
|
||||
The adoption of the Swarms Framework in enterprise environments offers numerous benefits:
|
||||
|
||||
1. Increased Efficiency and Scalability
|
||||
2. Improved Reliability and Accuracy
|
||||
3. Adaptability and Continuous Improvement
|
||||
4. Cost Optimization
|
||||
5. Enhanced Security and Compliance
|
||||
|
||||
## Increased Efficiency and Scalability
|
||||
|
||||
By orchestrating the collective capabilities of multiple agents, the Swarms Framework enables the efficient execution of complex, multi-threaded workflows. Tasks can be parallelized and distributed across specialized agents, reducing bottlenecks and increasing overall throughput. Additionally, the framework's modular design and ability to dynamically scale agent instances based on demand ensure that the system can adapt to changing workloads and scale seamlessly as enterprise needs evolve.
|
||||
|
||||
## Improved Reliability and Accuracy
|
||||
|
||||
The collaborative nature of the Swarms Framework reduces the risk of hallucinations and factual inconsistencies that can arise from individual agents. By leveraging the collective knowledge and diverse perspectives of multiple agents, the framework can cross-reference and validate information, enhancing the overall reliability and accuracy of its outputs.
|
||||
|
||||
Additionally, the framework's ability to incorporate specialized fact-checking and verification agents further strengthens the trustworthiness of the system's outcomes, ensuring that critical decisions and actions are based on accurate and reliable information.
|
||||
|
||||
## Adaptability and Continuous Improvement
|
||||
|
||||
The modular architecture of the Swarms Framework allows for the seamless integration of new agents as they become available, enabling the continuous expansion and enhancement of the system's capabilities. As new AI models, algorithms, or data sources emerge, the framework can readily incorporate them, ensuring that enterprise operations remain at the forefront of technological advancements.
|
||||
|
||||
Furthermore, the framework's monitoring and analytics capabilities provide valuable insights into system performance, enabling the identification of areas for improvement and the optimization of agent selection, task assignments, and resource allocation strategies over time.
|
||||
|
||||
## Cost Optimization
|
||||
|
||||
By intelligently orchestrating the collaboration of multiple agents, the Swarms Framework optimizes resource utilization and minimizes redundant computations. This efficient use of computational resources translates into cost savings, making the widespread adoption of AI-driven automation more financially viable for enterprises.
|
||||
|
||||
The framework's ability to dynamically scale agent instances based on demand further contributes to cost optimization, ensuring that resources are allocated only when needed and minimizing idle or underutilized instances.
|
||||
|
||||
## Enhanced Security and Compliance
|
||||
|
||||
In enterprise environments, ensuring the security and compliance of automated systems is paramount. The Swarms Framework addresses these concerns by incorporating robust security measures and compliance controls.
|
||||
|
||||
The framework's centralized Memory Manager component enables the implementation of access control mechanisms and data encryption, protecting sensitive information from unauthorized access or breaches. Additionally, the framework's modular design allows for the integration of specialized agents focused on compliance monitoring and auditing, ensuring that enterprise operations adhere to relevant regulations and industry standards.
|
||||
|
||||
## Real-World Applications and Use Cases
|
||||
|
||||
The Swarms Framework finds applications across a wide range of enterprise domains, enabling organizations to automate complex operations and streamline their workflows. Here are some examples of real-world use cases:
|
||||
|
||||
1. Intelligent Process Automation (IPA)
|
||||
2. Customer Service and Support
|
||||
3. Fraud Detection and Risk Management
|
||||
4. Supply Chain Optimization
|
||||
5. Research and Development
|
||||
|
||||
## Intelligent Process Automation (IPA)
|
||||
|
||||
In the realm of business process automation, the Swarms Framework can orchestrate agents to automate and optimize complex workflows spanning multiple domains and task types. By combining agents specialized in areas such as natural language processing, data extraction, decision-making, and task coordination, the framework can streamline and automate processes that traditionally required manual intervention or coordination across multiple systems.
|
||||
|
||||
## Customer Service and Support
|
||||
|
||||
The framework's ability to integrate agents with diverse capabilities, such as natural language processing, knowledge retrieval, and decision-making, makes it well-suited for automating customer service and support operations. Agents can collaborate to understand customer inquiries, retrieve relevant information from knowledge bases, and provide accurate and personalized responses, improving customer satisfaction and reducing operational costs.
|
||||
|
||||
## Fraud Detection and Risk Management
|
||||
|
||||
In the financial and cybersecurity domains, the Swarms Framework can orchestrate agents specialized in data analysis, pattern recognition, and risk assessment to detect and mitigate fraudulent activities or security threats. By combining the collective intelligence of these agents, the framework can identify complex patterns and anomalies that may be difficult for individual agents to detect, enhancing the overall effectiveness of fraud detection and risk management strategies.
|
||||
|
||||
## Supply Chain Optimization
|
||||
|
||||
The complexity of modern supply chains often requires the coordination of multiple systems and stakeholders. The Swarms Framework can integrate agents specialized in areas such as demand forecasting, inventory management, logistics optimization, and supplier coordination to streamline and optimize supply chain operations. By orchestrating the collective capabilities of these agents, the framework can identify bottlenecks, optimize resource allocation, and facilitate seamless collaboration among supply chain partners.
|
||||
|
||||
## Research and Development
|
||||
|
||||
In research and development environments, the Swarms Framework can accelerate innovation by enabling the collaboration of agents specialized in areas such as literature review, data analysis, hypothesis generation, and experiment design. By orchestrating these agents, the framework can facilitate the exploration of new ideas, identify promising research directions, and streamline the iterative process of scientific inquiry.
|
||||
|
||||
# Conclusion
|
||||
|
||||
The Swarms Framework represents a paradigm shift in the field of enterprise automation, addressing the limitations of individual agents by orchestrating their collective capabilities. By integrating agents from various frameworks and enabling multi-agent collaboration, the Swarms Framework overcomes challenges such as short-term memory constraints, hallucinations, single-task limitations, lack of collaboration, and cost inefficiencies.
|
||||
|
||||
Through its modular architecture, centralized coordination, and advanced monitoring and analytics capabilities, the Swarms Framework empowers enterprises to automate complex operations with increased efficiency, reliability, and adaptability. It unlocks the true potential of AI-driven automation, enabling organizations to stay ahead of the curve and thrive in an ever-evolving technological landscape.
|
||||
|
||||
As the field of artificial intelligence continues to advance, the Swarms Framework stands as a robust and flexible solution, ready to embrace new developments and seamlessly integrate emerging agents and capabilities. By harnessing the power of collective intelligence, the framework paves the way for a future where enterprises can leverage the full potential of AI to drive innovation, optimize operations, and gain a competitive edge in their respective industries.
|
@ -0,0 +1,53 @@
|
||||
# Why Swarms?
|
||||
|
||||
The need for multiple agents to work together in artificial intelligence (AI) and particularly in the context of Large Language Models (LLMs) stems from several inherent limitations and challenges in handling complex, dynamic, and multifaceted tasks with single-agent systems. Collaborating with multiple agents offers a pathway to enhance reliability, computational efficiency, cognitive diversity, and problem-solving capabilities. This section delves into the rationale behind employing multi-agent systems and strategizes on overcoming the associated expenses, such as API bills and hosting costs.
|
||||
|
||||
### Why Multiple Agents Are Necessary
|
||||
|
||||
#### 1. **Cognitive Diversity**
|
||||
|
||||
Different agents can bring varied perspectives, knowledge bases, and problem-solving approaches to a task. This diversity is crucial in complex problem-solving scenarios where a single approach might not be sufficient. Cognitive diversity enhances creativity, leading to innovative solutions and the ability to tackle a broader range of problems.
|
||||
|
||||
#### 2. **Specialization and Expertise**
|
||||
|
||||
In many cases, tasks are too complex for a single agent to handle efficiently. By dividing the task among multiple specialized agents, each can focus on a segment where it excels, thereby increasing the overall efficiency and effectiveness of the solution. This approach leverages the expertise of individual agents to achieve superior performance in tasks that require multifaceted knowledge and skills.
|
||||
|
||||
#### 3. **Scalability and Flexibility**
|
||||
|
||||
Multi-agent systems can more easily scale to handle large-scale or evolving tasks. Adding more agents to the system can increase its capacity or capabilities, allowing it to adapt to larger workloads or new types of tasks. This scalability is essential in dynamic environments where the demand and nature of tasks can change rapidly.
|
||||
|
||||
#### 4. **Robustness and Redundancy**
|
||||
|
||||
Collaboration among multiple agents enhances the system's robustness by introducing redundancy. If one agent fails or encounters an error, others can compensate, ensuring the system remains operational. This redundancy is critical in mission-critical applications where failure is not an option.
|
||||
|
||||
### Overcoming Expenses with API Bills and Hosting
|
||||
|
||||
Deploying multiple agents, especially when relying on cloud-based services or APIs, can incur significant costs. Here are strategies to manage and reduce these expenses:
|
||||
|
||||
#### 1. **Optimize Agent Efficiency**
|
||||
|
||||
Before scaling up the number of agents, ensure each agent operates as efficiently as possible. This can involve refining algorithms, reducing unnecessary API calls, and optimizing data processing to minimize computational requirements and, consequently, the associated costs.
|
||||
|
||||
#### 2. **Use Open Source and Self-Hosted Solutions**
|
||||
|
||||
Where possible, leverage open-source models and technologies that can be self-hosted. While there is an initial investment in setting up the infrastructure, over time, self-hosting can significantly reduce costs related to API calls and reliance on third-party services.
|
||||
|
||||
#### 3. **Implement Intelligent Caching**
|
||||
|
||||
Caching results for frequently asked questions or common tasks can drastically reduce the need for repeated computations or API calls. Intelligent caching systems can determine what information to store and for how long, optimizing the balance between fresh data and computational savings.
|
||||
|
||||
#### 4. **Dynamic Scaling and Load Balancing**
|
||||
|
||||
Use cloud services that offer dynamic scaling and load balancing to adjust the resources allocated based on the current demand. This ensures you're not paying for idle resources during low-usage periods while still being able to handle high demand when necessary.
|
||||
|
||||
#### 5. **Collaborative Cost-Sharing Models**
|
||||
|
||||
In scenarios where multiple stakeholders benefit from the multi-agent system, consider implementing a cost-sharing model. This approach distributes the financial burden among the users or beneficiaries, making it more sustainable.
|
||||
|
||||
#### 6. **Monitor and Analyze Costs**
|
||||
|
||||
Regularly monitor and analyze your usage and associated costs to identify potential savings. Many cloud providers offer tools to track and forecast expenses, helping you to adjust your usage patterns and configurations to minimize costs without sacrificing performance.
|
||||
|
||||
### Conclusion
|
||||
|
||||
The collaboration of multiple agents in AI systems presents a robust solution to the complexity, specialization, scalability, and robustness challenges inherent in single-agent approaches. While the associated costs can be significant, strategic optimization, leveraging open-source technologies, intelligent caching, dynamic resource management, collaborative cost-sharing, and diligent monitoring can mitigate these expenses. By adopting these strategies, organizations can harness the power of multi-agent systems to tackle complex problems more effectively and efficiently, ensuring the sustainable deployment of these advanced technologies.
|
@ -0,0 +1,35 @@
|
||||
mkdocs
|
||||
mkdocs-material
|
||||
mkdocs-glightbox
|
||||
mkdocs-git-authors-plugin
|
||||
mkdocs-git-revision-date-plugin
|
||||
mkdocs-git-committers-plugin
|
||||
mkdocstrings
|
||||
mike
|
||||
mkdocs-jupyter
|
||||
mkdocs-git-committers-plugin-2
|
||||
mkdocs-git-revision-date-localized-plugin
|
||||
mkdocs-redirects
|
||||
mkdocs-material-extensions
|
||||
mkdocs-simple-hooks
|
||||
mkdocs-awesome-pages-plugin
|
||||
mkdocs-versioning
|
||||
mkdocs-mermaid2-plugin
|
||||
mkdocs-include-markdown-plugin
|
||||
mkdocs-enumerate-headings-plugin
|
||||
mkdocs-autolinks-plugin
|
||||
mkdocs-minify-html-plugin
|
||||
mkdocs-autolinks-plugin
|
||||
|
||||
# Requirements for core
|
||||
jinja2~=3.0
|
||||
markdown~=3.2
|
||||
mkdocs-material-extensions~=1.3
|
||||
pygments~=2.18
|
||||
pymdown-extensions~=10.2
|
||||
|
||||
# Requirements for plugins
|
||||
babel~=2.10
|
||||
colorama~=0.4
|
||||
paginate~=0.5
|
||||
regex>=2022.4
|
@ -0,0 +1,123 @@
|
||||
# swarms.agents
|
||||
|
||||
## 1. Introduction
|
||||
|
||||
`AbstractAgent` is an abstract class that serves as a foundation for implementing AI agents. An agent is an entity that can communicate with other agents and perform actions. The `AbstractAgent` class allows for customization in the implementation of the `receive` method, enabling different agents to define unique actions for receiving and processing messages.
|
||||
|
||||
`AbstractAgent` provides capabilities for managing tools and accessing memory, and has methods for running, chatting, and stepping through communication with other agents.
|
||||
|
||||
## 2. Class Definition
|
||||
|
||||
```python
|
||||
class AbstractAgent:
|
||||
"""An abstract class for AI agent.
|
||||
|
||||
An agent can communicate with other agents and perform actions.
|
||||
Different agents can differ in what actions they perform in the `receive` method.
|
||||
|
||||
Agents are full and completed:
|
||||
|
||||
Agents = llm + tools + memory
|
||||
"""
|
||||
|
||||
def __init__(self, name: str):
|
||||
"""
|
||||
Args:
|
||||
name (str): name of the agent.
|
||||
"""
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Get the name of the agent."""
|
||||
return self._name
|
||||
|
||||
def tools(self, tools):
|
||||
"""init tools"""
|
||||
|
||||
def memory(self, memory_store):
|
||||
"""init memory"""
|
||||
|
||||
def reset(self):
|
||||
"""(Abstract method) Reset the agent."""
|
||||
|
||||
def run(self, task: str):
|
||||
"""Run the agent once"""
|
||||
|
||||
def _arun(self, taks: str):
|
||||
"""Run Async run"""
|
||||
|
||||
def chat(self, messages: List[Dict]):
|
||||
"""Chat with the agent"""
|
||||
|
||||
def _achat(self, messages: List[Dict]):
|
||||
"""Asynchronous Chat"""
|
||||
|
||||
def step(self, message: str):
|
||||
"""Step through the agent"""
|
||||
|
||||
def _astep(self, message: str):
|
||||
"""Asynchronous step"""
|
||||
```
|
||||
|
||||
## 3. Functionality and Usage
|
||||
|
||||
The `AbstractAgent` class represents a generic AI agent and provides a set of methods to interact with it.
|
||||
|
||||
To create an instance of an agent, the `name` of the agent should be specified.
|
||||
|
||||
### Core Methods
|
||||
|
||||
#### 1. `reset`
|
||||
|
||||
The `reset` method allows the agent to be reset to its initial state.
|
||||
|
||||
```python
|
||||
agent.reset()
|
||||
```
|
||||
|
||||
#### 2. `run`
|
||||
|
||||
The `run` method allows the agent to perform a specific task.
|
||||
|
||||
```python
|
||||
agent.run("some_task")
|
||||
```
|
||||
|
||||
#### 3. `chat`
|
||||
|
||||
The `chat` method enables communication with the agent through a series of messages.
|
||||
|
||||
```python
|
||||
messages = [{"id": 1, "text": "Hello, agent!"}, {"id": 2, "text": "How are you?"}]
|
||||
agent.chat(messages)
|
||||
```
|
||||
|
||||
#### 4. `step`
|
||||
|
||||
The `step` method allows the agent to process a single message.
|
||||
|
||||
```python
|
||||
agent.step("Hello, agent!")
|
||||
```
|
||||
|
||||
### Asynchronous Methods
|
||||
|
||||
The class also provides asynchronous variants of the core methods.
|
||||
|
||||
### Additional Functionality
|
||||
|
||||
Additional functionalities for agent initialization and management of tools and memory are also provided.
|
||||
|
||||
```python
|
||||
agent.tools(some_tools)
|
||||
agent.memory(some_memory_store)
|
||||
```
|
||||
|
||||
## 4. Additional Information and Tips
|
||||
|
||||
When implementing a new agent using the `AbstractAgent` class, ensure that the `receive` method is overridden to define the specific behavior of the agent upon receiving messages.
|
||||
|
||||
## 5. References and Resources
|
||||
|
||||
For further exploration and understanding of AI agents and agent communication, refer to the relevant literature and research on this topic.
|
@ -0,0 +1,112 @@
|
||||
# The Module/Class Name: Message
|
||||
|
||||
In the swarms.agents framework, the class `Message` is used to represent a message with timestamp and optional metadata.
|
||||
|
||||
## Overview and Introduction
|
||||
|
||||
The `Message` class is a fundamental component that enables the representation of messages within an agent system. Messages contain essential information such as the sender, content, timestamp, and optional metadata.
|
||||
|
||||
## Class Definition
|
||||
|
||||
### Constructor: `__init__`
|
||||
|
||||
The constructor of the `Message` class takes three parameters:
|
||||
|
||||
1. `sender` (str): The sender of the message.
|
||||
2. `content` (str): The content of the message.
|
||||
3. `metadata` (dict or None): Optional metadata associated with the message.
|
||||
|
||||
### Methods
|
||||
|
||||
1. `__repr__(self)`: Returns a string representation of the `Message` object, including the timestamp, sender, and content.
|
||||
|
||||
```python
|
||||
class Message:
|
||||
"""
|
||||
Represents a message with timestamp and optional metadata.
|
||||
|
||||
Usage
|
||||
--------------
|
||||
mes = Message(
|
||||
sender = "Kye",
|
||||
content = "message"
|
||||
)
|
||||
|
||||
print(mes)
|
||||
"""
|
||||
|
||||
def __init__(self, sender, content, metadata=None):
|
||||
self.timestamp = datetime.datetime.now()
|
||||
self.sender = sender
|
||||
self.content = content
|
||||
self.metadata = metadata or {}
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
__repr__ represents the string representation of the Message object.
|
||||
|
||||
Returns:
|
||||
(str) A string containing the timestamp, sender, and content of the message.
|
||||
"""
|
||||
return f"{self.timestamp} - {self.sender}: {self.content}"
|
||||
```
|
||||
|
||||
## Functionality and Usage
|
||||
|
||||
The `Message` class represents a message in the agent system. Upon initialization, the `timestamp` is set to the current date and time, and the `metadata` is set to an empty dictionary if no metadata is provided.
|
||||
|
||||
### Usage Example 1
|
||||
|
||||
Creating a `Message` object and displaying its string representation.
|
||||
|
||||
```python
|
||||
mes = Message(sender="Kye", content="Hello! How are you?")
|
||||
|
||||
print(mes)
|
||||
```
|
||||
|
||||
Output:
|
||||
```
|
||||
2023-09-20 13:45:00 - Kye: Hello! How are you?
|
||||
```
|
||||
|
||||
### Usage Example 2
|
||||
|
||||
Creating a `Message` object with metadata.
|
||||
|
||||
```python
|
||||
metadata = {"priority": "high", "category": "urgent"}
|
||||
mes_with_metadata = Message(
|
||||
sender="Alice", content="Important update", metadata=metadata
|
||||
)
|
||||
|
||||
print(mes_with_metadata)
|
||||
```
|
||||
|
||||
Output:
|
||||
```
|
||||
2023-09-20 13:46:00 - Alice: Important update
|
||||
```
|
||||
|
||||
### Usage Example 3
|
||||
|
||||
Creating a `Message` object without providing metadata.
|
||||
|
||||
```python
|
||||
mes_no_metadata = Message(sender="Bob", content="Reminder: Meeting at 2PM")
|
||||
|
||||
print(mes_no_metadata)
|
||||
```
|
||||
|
||||
Output:
|
||||
```
|
||||
2023-09-20 13:47:00 - Bob: Reminder: Meeting at 2PM
|
||||
```
|
||||
|
||||
## Additional Information and Tips
|
||||
|
||||
When creating a new `Message` object, ensure that the required parameters `sender` and `content` are provided. The `timestamp` will automatically be assigned the current date and time. Optional `metadata` can be included to provide additional context or information associated with the message.
|
||||
|
||||
## References and Resources
|
||||
|
||||
For further information on the `Message` class and its usage, refer to the official swarms.agents documentation and relevant tutorials related to message handling and communication within the agent system.
|
@ -0,0 +1,617 @@
|
||||
# Swarms Framework: Integrating and Customizing Agent Libraries
|
||||
|
||||
Agent-based systems have emerged as a powerful paradigm for solving complex problems and automating tasks.
|
||||
|
||||
The swarms framework offers a flexible and extensible approach to working with various agent libraries, allowing developers to create custom agents and integrate them seamlessly into their projects.
|
||||
|
||||
In this comprehensive guide, we'll explore the swarms framework, discuss agent handling, and demonstrate how to build custom agents using swarms. We'll also cover the integration of popular agent libraries such as Langchain, Griptape, CrewAI, and Autogen.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Introduction to the Swarms Framework](#introduction-to-the-swarms-framework)
|
||||
2. [The Need for Wrappers](#the-need-for-wrappers)
|
||||
3. [Building Custom Agents with Swarms](#building-custom-agents-with-swarms)
|
||||
4. [Integrating Third-Party Agent Libraries](#integrating-third-party-agent-libraries)
|
||||
- [Griptape Integration](#griptape-integration)
|
||||
- [Langchain Integration](#langchain-integration)
|
||||
- [CrewAI Integration](#crewai-integration)
|
||||
- [Autogen Integration](#autogen-integration)
|
||||
5. [Advanced Agent Handling Techniques](#advanced-agent-handling-techniques)
|
||||
6. [Best Practices for Custom Agent Development](#best-practices-for-custom-agent-development)
|
||||
7. [Future Directions and Challenges](#future-directions-and-challenges)
|
||||
8. [Conclusion](#conclusion)
|
||||
|
||||
## 1. Introduction to the Swarms Framework
|
||||
|
||||
The swarms framework is a powerful and flexible system designed to facilitate the creation, management, and coordination of multiple AI agents. It provides a standardized interface for working with various agent types, allowing developers to leverage the strengths of different agent libraries while maintaining a consistent programming model.
|
||||
|
||||
At its core, the swarms framework is built around the concept of a parent `Agent` class, which serves as a foundation for creating custom agents and integrating third-party agent libraries. This approach offers several benefits:
|
||||
|
||||
1. **Consistency**: By wrapping different agent implementations with a common interface, developers can work with a unified API across various agent types.
|
||||
2. **Extensibility**: The framework makes it easy to add new agent types or customize existing ones without affecting the overall system architecture.
|
||||
3. **Interoperability**: Agents from different libraries can communicate and collaborate seamlessly within the swarms ecosystem.
|
||||
4. **Scalability**: The standardized approach allows for easier scaling of agent-based systems, from simple single-agent applications to complex multi-agent swarms.
|
||||
|
||||
## 2. The Need for Wrappers
|
||||
|
||||
As the field of AI and agent-based systems continues to grow, numerous libraries and frameworks have emerged, each with its own strengths and specialized features. While this diversity offers developers a wide range of tools to choose from, it also presents challenges in terms of integration and interoperability.
|
||||
|
||||
This is where the concept of wrappers becomes crucial. By creating wrappers around different agent libraries, we can:
|
||||
|
||||
1. **Unify interfaces**: Standardize the way we interact with agents, regardless of their underlying implementation.
|
||||
2. **Simplify integration**: Make it easier to incorporate new agent libraries into existing projects.
|
||||
3. **Enable composition**: Allow for the creation of complex agent systems that leverage the strengths of multiple libraries.
|
||||
4. **Facilitate maintenance**: Centralize the management of agent-related code and reduce the impact of library-specific changes.
|
||||
|
||||
In the context of the swarms framework, wrappers take the form of custom classes that inherit from the parent `Agent` class. These wrapper classes encapsulate the functionality of specific agent libraries while exposing a consistent interface that aligns with the swarms framework.
|
||||
|
||||
## 3. Building Custom Agents with Swarms
|
||||
|
||||
To illustrate the process of building custom agents using the swarms framework, let's start with a basic example of creating a custom agent class:
|
||||
|
||||
```python
|
||||
from swarms import Agent
|
||||
|
||||
class MyCustomAgent(Agent):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Custom initialization logic
|
||||
|
||||
def custom_method(self, *args, **kwargs):
|
||||
# Implement custom logic here
|
||||
pass
|
||||
|
||||
def run(self, task, *args, **kwargs):
|
||||
# Customize the run method
|
||||
response = super().run(task, *args, **kwargs)
|
||||
# Additional custom logic
|
||||
return response
|
||||
```
|
||||
|
||||
This example demonstrates the fundamental structure of a custom agent class within the swarms framework. Let's break down the key components:
|
||||
|
||||
1. **Inheritance**: The class inherits from the `Agent` parent class, ensuring it adheres to the swarms framework's interface.
|
||||
|
||||
2. **Initialization**: The `__init__` method calls the parent class's initializer and can include additional custom initialization logic.
|
||||
|
||||
3. **Custom methods**: You can add any number of custom methods to extend the agent's functionality.
|
||||
|
||||
4. **Run method**: The `run` method is a key component of the agent interface. By overriding this method, you can customize how the agent processes tasks while still leveraging the parent class's functionality.
|
||||
|
||||
To create more sophisticated custom agents, you can expand on this basic structure by adding features such as:
|
||||
|
||||
- **State management**: Implement methods to manage the agent's internal state.
|
||||
- **Communication protocols**: Define how the agent interacts with other agents in the swarm.
|
||||
- **Learning capabilities**: Incorporate machine learning models or adaptive behaviors.
|
||||
- **Specialized task handling**: Create methods for dealing with specific types of tasks or domains.
|
||||
|
||||
By leveraging these custom agent classes, developers can create highly specialized and adaptive agents tailored to their specific use cases while still benefiting from the standardized interface provided by the swarms framework.
|
||||
|
||||
## 4. Integrating Third-Party Agent Libraries
|
||||
|
||||
One of the key strengths of the swarms framework is its ability to integrate with various third-party agent libraries. In this section, we'll explore how to create wrappers for popular agent libraries, including Griptape, Langchain, CrewAI, and Autogen.
|
||||
|
||||
### Griptape Integration
|
||||
|
||||
Griptape is a powerful library for building AI agents with a focus on composability and tool use. Let's create a wrapper for a Griptape agent:
|
||||
|
||||
```python
|
||||
from typing import List, Optional
|
||||
|
||||
from griptape.structures import Agent as GriptapeAgent
|
||||
from griptape.tools import FileManager, TaskMemoryClient, WebScraper
|
||||
|
||||
from swarms import Agent
|
||||
|
||||
|
||||
class GriptapeAgentWrapper(Agent):
|
||||
"""
|
||||
A wrapper class for the GriptapeAgent from the griptape library.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str, tools: Optional[List] = None, *args, **kwargs):
|
||||
"""
|
||||
Initialize the GriptapeAgentWrapper.
|
||||
|
||||
Parameters:
|
||||
- name: The name of the agent.
|
||||
- tools: A list of tools to be used by the agent. If not provided, default tools will be used.
|
||||
- *args, **kwargs: Additional arguments to be passed to the parent class constructor.
|
||||
"""
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
self.tools = tools or [
|
||||
WebScraper(off_prompt=True),
|
||||
TaskMemoryClient(off_prompt=True),
|
||||
FileManager()
|
||||
]
|
||||
self.griptape_agent = GriptapeAgent(
|
||||
input=f"I am {name}, an AI assistant. How can I help you?",
|
||||
tools=self.tools
|
||||
)
|
||||
|
||||
def run(self, task: str, *args, **kwargs) -> str:
|
||||
"""
|
||||
Run a task using the GriptapeAgent.
|
||||
|
||||
Parameters:
|
||||
- task: The task to be performed by the agent.
|
||||
|
||||
Returns:
|
||||
- The response from the GriptapeAgent as a string.
|
||||
"""
|
||||
response = self.griptape_agent.run(task, *args, **kwargs)
|
||||
return str(response)
|
||||
|
||||
def add_tool(self, tool) -> None:
|
||||
"""
|
||||
Add a tool to the agent.
|
||||
|
||||
Parameters:
|
||||
- tool: The tool to be added.
|
||||
"""
|
||||
self.tools.append(tool)
|
||||
self.griptape_agent = GriptapeAgent(
|
||||
input=f"I am {self.name}, an AI assistant. How can I help you?",
|
||||
tools=self.tools
|
||||
)
|
||||
|
||||
# Usage example
|
||||
griptape_wrapper = GriptapeAgentWrapper("GriptapeAssistant")
|
||||
result = griptape_wrapper.run("Load https://example.com, summarize it, and store it in a file called example_summary.txt.")
|
||||
print(result)
|
||||
|
||||
```
|
||||
|
||||
This wrapper encapsulates the functionality of a Griptape agent while exposing it through the swarms framework's interface. It allows for easy customization of tools and provides a simple way to execute tasks using the Griptape agent.
|
||||
|
||||
### Langchain Integration
|
||||
|
||||
Langchain is a popular framework for developing applications powered by language models. Here's an example of how we can create a wrapper for a Langchain agent:
|
||||
|
||||
```python
|
||||
from typing import List, Optional
|
||||
|
||||
from langchain.agents import AgentExecutor, LLMSingleActionAgent, Tool
|
||||
from langchain.chains import LLMChain
|
||||
from langchain.llms import OpenAI
|
||||
from langchain.prompts import StringPromptTemplate
|
||||
from langchain.tools import DuckDuckGoSearchRun
|
||||
|
||||
from swarms import Agent
|
||||
|
||||
|
||||
class LangchainAgentWrapper(Agent):
|
||||
"""
|
||||
Initialize the LangchainAgentWrapper.
|
||||
|
||||
Args:
|
||||
name (str): The name of the agent.
|
||||
tools (List[Tool]): The list of tools available to the agent.
|
||||
llm (Optional[OpenAI], optional): The OpenAI language model to use. Defaults to None.
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
tools: List[Tool],
|
||||
llm: Optional[OpenAI] = None,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
self.tools = tools
|
||||
self.llm = llm or OpenAI(temperature=0)
|
||||
|
||||
prompt = StringPromptTemplate.from_template(
|
||||
"You are {name}, an AI assistant. Answer the following question: {question}"
|
||||
)
|
||||
|
||||
llm_chain = LLMChain(llm=self.llm, prompt=prompt)
|
||||
tool_names = [tool.name for tool in self.tools]
|
||||
|
||||
self.agent = LLMSingleActionAgent(
|
||||
llm_chain=llm_chain,
|
||||
output_parser=None,
|
||||
stop=["\nObservation:"],
|
||||
allowed_tools=tool_names,
|
||||
)
|
||||
|
||||
self.agent_executor = AgentExecutor.from_agent_and_tools(
|
||||
agent=self.agent, tools=self.tools, verbose=True
|
||||
)
|
||||
|
||||
def run(self, task: str, *args, **kwargs):
|
||||
"""
|
||||
Run the agent with the given task.
|
||||
|
||||
Args:
|
||||
task (str): The task to be performed by the agent.
|
||||
|
||||
Returns:
|
||||
Any: The result of the agent's execution.
|
||||
"""
|
||||
try:
|
||||
return self.agent_executor.run(task)
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
|
||||
|
||||
# Usage example
|
||||
|
||||
search_tool = DuckDuckGoSearchRun()
|
||||
tools = [
|
||||
Tool(
|
||||
name="Search",
|
||||
func=search_tool.run,
|
||||
description="Useful for searching the internet",
|
||||
)
|
||||
]
|
||||
|
||||
langchain_wrapper = LangchainAgentWrapper("LangchainAssistant", tools)
|
||||
result = langchain_wrapper.run("What is the capital of France?")
|
||||
print(result)
|
||||
```
|
||||
|
||||
This wrapper integrates a Langchain agent into the swarms framework, allowing for easy use of Langchain's powerful features such as tool use and multi-step reasoning.
|
||||
|
||||
### CrewAI Integration
|
||||
|
||||
CrewAI is a library focused on creating and managing teams of AI agents. Let's create a wrapper for a CrewAI agent:
|
||||
|
||||
```python
|
||||
from swarms import Agent
|
||||
from crewai import Agent as CrewAIAgent
|
||||
from crewai import Task, Crew, Process
|
||||
|
||||
class CrewAIAgentWrapper(Agent):
|
||||
def __init__(self, name, role, goal, backstory, tools=None, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
self.crewai_agent = CrewAIAgent(
|
||||
role=role,
|
||||
goal=goal,
|
||||
backstory=backstory,
|
||||
verbose=True,
|
||||
allow_delegation=False,
|
||||
tools=tools or []
|
||||
)
|
||||
|
||||
def run(self, task, *args, **kwargs):
|
||||
crew_task = Task(
|
||||
description=task,
|
||||
agent=self.crewai_agent
|
||||
)
|
||||
crew = Crew(
|
||||
agents=[self.crewai_agent],
|
||||
tasks=[crew_task],
|
||||
process=Process.sequential
|
||||
)
|
||||
result = crew.kickoff()
|
||||
return result
|
||||
|
||||
# Usage example
|
||||
from crewai_tools import SerperDevTool
|
||||
|
||||
search_tool = SerperDevTool()
|
||||
|
||||
crewai_wrapper = CrewAIAgentWrapper(
|
||||
"ResearchAnalyst",
|
||||
role='Senior Research Analyst',
|
||||
goal='Uncover cutting-edge developments in AI and data science',
|
||||
backstory="""You work at a leading tech think tank.
|
||||
Your expertise lies in identifying emerging trends.
|
||||
You have a knack for dissecting complex data and presenting actionable insights.""",
|
||||
tools=[search_tool]
|
||||
)
|
||||
|
||||
result = crewai_wrapper.run("Analyze the latest trends in quantum computing and summarize the key findings.")
|
||||
print(result)
|
||||
```
|
||||
|
||||
This wrapper allows us to use CrewAI agents within the swarms framework, leveraging CrewAI's focus on role-based agents and collaborative task execution.
|
||||
|
||||
### Autogen Integration
|
||||
|
||||
Autogen is a framework for building conversational AI agents. Here's how we can create a wrapper for an Autogen agent:
|
||||
|
||||
```python
|
||||
from swarms import Agent
|
||||
from autogen import ConversableAgent
|
||||
|
||||
class AutogenAgentWrapper(Agent):
|
||||
def __init__(self, name, llm_config, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
self.autogen_agent = ConversableAgent(
|
||||
name=name,
|
||||
llm_config=llm_config,
|
||||
code_execution_config=False,
|
||||
function_map=None,
|
||||
human_input_mode="NEVER"
|
||||
)
|
||||
|
||||
def run(self, task, *args, **kwargs):
|
||||
messages = [{"content": task, "role": "user"}]
|
||||
response = self.autogen_agent.generate_reply(messages)
|
||||
return response
|
||||
|
||||
# Usage example
|
||||
import os
|
||||
|
||||
llm_config = {
|
||||
"config_list": [{"model": "gpt-4", "api_key": os.environ.get("OPENAI_API_KEY")}]
|
||||
}
|
||||
|
||||
autogen_wrapper = AutogenAgentWrapper("AutogenAssistant", llm_config)
|
||||
result = autogen_wrapper.run("Tell me a joke about programming.")
|
||||
print(result)
|
||||
```
|
||||
|
||||
This wrapper integrates Autogen's ConversableAgent into the swarms framework, allowing for easy use of Autogen's conversational AI capabilities.
|
||||
|
||||
By creating these wrappers, we can seamlessly integrate agents from various libraries into the swarms framework, allowing for a unified approach to agent management and task execution.
|
||||
|
||||
## 5. Advanced Agent Handling Techniques
|
||||
|
||||
As you build more complex systems using the swarms framework and integrated agent libraries, you'll need to employ advanced techniques for agent handling. Here are some strategies to consider:
|
||||
|
||||
### 1. Dynamic Agent Creation
|
||||
|
||||
Implement a factory pattern to create agents dynamically based on task requirements:
|
||||
|
||||
```python
|
||||
class AgentFactory:
|
||||
@staticmethod
|
||||
def create_agent(agent_type, *args, **kwargs):
|
||||
if agent_type == "griptape":
|
||||
return GriptapeAgentWrapper(*args, **kwargs)
|
||||
elif agent_type == "langchain":
|
||||
return LangchainAgentWrapper(*args, **kwargs)
|
||||
elif agent_type == "crewai":
|
||||
return CrewAIAgentWrapper(*args, **kwargs)
|
||||
elif agent_type == "autogen":
|
||||
return AutogenAgentWrapper(*args, **kwargs)
|
||||
else:
|
||||
raise ValueError(f"Unknown agent type: {agent_type}")
|
||||
|
||||
# Usage
|
||||
agent = AgentFactory.create_agent("griptape", "DynamicGriptapeAgent")
|
||||
```
|
||||
|
||||
|
||||
### 2. Agent Pooling
|
||||
|
||||
Implement an agent pool to manage and reuse agents efficiently:
|
||||
|
||||
```python
|
||||
from queue import Queue
|
||||
|
||||
class AgentPool:
|
||||
def __init__(self, pool_size=5):
|
||||
self.pool = Queue(maxsize=pool_size)
|
||||
self.pool_size = pool_size
|
||||
|
||||
def get_agent(self, agent_type, *args, **kwargs):
|
||||
if not self.pool.empty():
|
||||
return self.pool.get()
|
||||
else:
|
||||
return AgentFactory.create_agent(agent_type, *args, **kwargs)
|
||||
|
||||
def release_agent(self, agent):
|
||||
if self.pool.qsize() < self.pool_size:
|
||||
self.pool.put(agent)
|
||||
|
||||
# Usage
|
||||
pool = AgentPool()
|
||||
agent = pool.get_agent("langchain", "PooledLangchainAgent")
|
||||
result = agent.run("Perform a task")
|
||||
pool.release_agent(agent)
|
||||
```
|
||||
|
||||
### 3. Agent Composition
|
||||
|
||||
Create composite agents that combine the capabilities of multiple agent types:
|
||||
|
||||
```python
|
||||
class CompositeAgent(Agent):
|
||||
def __init__(self, name, agents):
|
||||
super().__init__()
|
||||
self.name = name
|
||||
self.agents = agents
|
||||
|
||||
def run(self, task):
|
||||
results = []
|
||||
for agent in self.agents:
|
||||
results.append(agent.run(task))
|
||||
return self.aggregate_results(results)
|
||||
|
||||
def aggregate_results(self, results):
|
||||
# Implement your own logic to combine results
|
||||
return "\n".join(results)
|
||||
|
||||
# Usage
|
||||
griptape_agent = GriptapeAgentWrapper("GriptapeComponent")
|
||||
langchain_agent = LangchainAgentWrapper("LangchainComponent", [])
|
||||
composite_agent = CompositeAgent("CompositeAssistant", [griptape_agent, langchain_agent])
|
||||
result = composite_agent.run("Analyze the pros and cons of quantum computing")
|
||||
```
|
||||
|
||||
### 4. Agent Specialization
|
||||
|
||||
Create specialized agents for specific domains or tasks:
|
||||
|
||||
```python
|
||||
class DataAnalysisAgent(Agent):
|
||||
def __init__(self, name, analysis_tools):
|
||||
super().__init__()
|
||||
self.name = name
|
||||
self.analysis_tools = analysis_tools
|
||||
|
||||
def run(self, data):
|
||||
results = {}
|
||||
for tool in self.analysis_tools:
|
||||
results[tool.name] = tool.analyze(data)
|
||||
return results
|
||||
|
||||
# Usage
|
||||
import pandas as pd
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
from sklearn.decomposition import PCA
|
||||
|
||||
class AnalysisTool:
|
||||
def __init__(self, name, func):
|
||||
self.name = name
|
||||
self.func = func
|
||||
|
||||
def analyze(self, data):
|
||||
return self.func(data)
|
||||
|
||||
tools = [
|
||||
AnalysisTool("Descriptive Stats", lambda data: data.describe()),
|
||||
AnalysisTool("Correlation", lambda data: data.corr()),
|
||||
AnalysisTool("PCA", lambda data: PCA().fit_transform(StandardScaler().fit_transform(data)))
|
||||
]
|
||||
|
||||
data_agent = DataAnalysisAgent("DataAnalyst", tools)
|
||||
df = pd.read_csv("sample_data.csv")
|
||||
analysis_results = data_agent.run(df)
|
||||
```
|
||||
|
||||
### 5. Agent Monitoring and Logging
|
||||
|
||||
Implement a monitoring system to track agent performance and log their activities:
|
||||
|
||||
```python
|
||||
import logging
|
||||
from functools import wraps
|
||||
|
||||
def log_agent_activity(func):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
logging.info(f"Agent {self.name} started task: {args[0]}")
|
||||
result = func(self, *args, **kwargs)
|
||||
logging.info(f"Agent {self.name} completed task. Result length: {len(str(result))}")
|
||||
return result
|
||||
return wrapper
|
||||
|
||||
class MonitoredAgent(Agent):
|
||||
def __init__(self, name, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
|
||||
@log_agent_activity
|
||||
def run(self, task, *args, **kwargs):
|
||||
return super().run(task, *args, **kwargs)
|
||||
|
||||
# Usage
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
monitored_agent = MonitoredAgent("MonitoredGriptapeAgent")
|
||||
result = monitored_agent.run("Summarize the latest AI research papers")
|
||||
```
|
||||
|
||||
## 6. Best Practices for Custom Agent Development
|
||||
|
||||
When developing custom agents using the swarms framework, consider the following best practices:
|
||||
|
||||
1. **Modular Design**: Design your agents with modularity in mind. Break down complex functionality into smaller, reusable components.
|
||||
|
||||
2. **Consistent Interfaces**: Maintain consistent interfaces across your custom agents to ensure interoperability within the swarms framework.
|
||||
|
||||
3. **Error Handling**: Implement robust error handling and graceful degradation in your agents to ensure system stability.
|
||||
|
||||
4. **Performance Optimization**: Optimize your agents for performance, especially when dealing with resource-intensive tasks or large-scale deployments.
|
||||
|
||||
5. **Testing and Validation**: Develop comprehensive test suites for your custom agents to ensure their reliability and correctness.
|
||||
|
||||
6. **Documentation**: Provide clear and detailed documentation for your custom agents, including their capabilities, limitations, and usage examples.
|
||||
|
||||
7. **Versioning**: Implement proper versioning for your custom agents to manage updates and maintain backwards compatibility.
|
||||
|
||||
8. **Security Considerations**: Implement security best practices, especially when dealing with sensitive data or integrating with external services.
|
||||
|
||||
Here's an example that incorporates some of these best practices:
|
||||
|
||||
```python
|
||||
import logging
|
||||
from typing import Dict, Any
|
||||
from swarms import Agent
|
||||
|
||||
class SecureCustomAgent(Agent):
|
||||
def __init__(self, name: str, api_key: str, version: str = "1.0.0", *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.name = name
|
||||
self._api_key = api_key # Store sensitive data securely
|
||||
self.version = version
|
||||
self.logger = logging.getLogger(f"{self.__class__.__name__}.{self.name}")
|
||||
|
||||
def run(self, task: str, *args, **kwargs) -> Dict[str, Any]:
|
||||
try:
|
||||
self.logger.info(f"Agent {self.name} (v{self.version}) starting task: {task}")
|
||||
result = self._process_task(task)
|
||||
self.logger.info(f"Agent {self.name} completed task successfully")
|
||||
return {"status": "success", "result": result}
|
||||
except Exception as e:
|
||||
self.logger.error(f"Error in agent {self.name}: {str(e)}")
|
||||
return {"status": "error", "message": str(e)}
|
||||
|
||||
def _process_task(self, task: str) -> str:
|
||||
# Implement the core logic of your agent here
|
||||
# This is a placeholder implementation
|
||||
return f"Processed task: {task}"
|
||||
|
||||
@property
|
||||
def api_key(self) -> str:
|
||||
# Provide a secure way to access the API key
|
||||
return self._api_key
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<{self.__class__.__name__} name='{self.name}' version='{self.version}'>"
|
||||
|
||||
# Usage
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
secure_agent = SecureCustomAgent("SecureAgent", api_key="your-api-key-here")
|
||||
result = secure_agent.run("Perform a secure operation")
|
||||
print(result)
|
||||
```
|
||||
|
||||
This example demonstrates several best practices:
|
||||
- Modular design with separate methods for initialization and task processing
|
||||
- Consistent interface adhering to the swarms framework
|
||||
- Error handling and logging
|
||||
- Secure storage of sensitive data (API key)
|
||||
- Version tracking
|
||||
- Type hinting for improved code readability and maintainability
|
||||
- Informative string representation of the agent
|
||||
|
||||
## 7. Future Directions and Challenges
|
||||
|
||||
As the field of AI and agent-based systems continues to evolve, the swarms framework and its ecosystem of integrated agent libraries will face new opportunities and challenges. Some potential future directions and areas of focus include:
|
||||
|
||||
1. **Enhanced Interoperability**: Developing more sophisticated protocols for agent communication and collaboration across different libraries and frameworks.
|
||||
|
||||
2. **Scalability**: Improving the framework's ability to handle large-scale swarms of agents, potentially leveraging distributed computing techniques.
|
||||
|
||||
3. **Adaptive Learning**: Incorporating more advanced machine learning techniques to allow agents to adapt and improve their performance over time.
|
||||
|
||||
4. **Ethical AI**: Integrating ethical considerations and safeguards into the agent development process to ensure responsible AI deployment.
|
||||
|
||||
5. **Human-AI Collaboration**: Exploring new paradigms for human-AI interaction and collaboration within the swarms framework.
|
||||
|
||||
6. **Domain-Specific Optimizations**: Developing specialized agent types and tools for specific industries or problem domains.
|
||||
|
||||
7. **Explainability and Transparency**: Improving the ability to understand and explain agent decision-making processes.
|
||||
|
||||
8. **Security and Privacy**: Enhancing the framework's security features to protect against potential vulnerabilities and ensure data privacy.
|
||||
|
||||
As these areas develop, developers working with the swarms framework will need to stay informed about new advancements and be prepared to adapt their agent implementations accordingly.
|
||||
|
||||
## 8. Conclusion
|
||||
|
||||
The swarms framework provides a powerful and flexible foundation for building custom agents and integrating various agent libraries. By leveraging the techniques and best practices discussed in this guide, developers can create sophisticated, efficient, and scalable agent-based systems.
|
||||
|
||||
The ability to seamlessly integrate agents from libraries like Griptape, Langchain, CrewAI, and Autogen opens up a world of possibilities for creating diverse and specialized AI applications. Whether you're building a complex multi-agent system for data analysis, a conversational AI platform, or a collaborative problem-solving environment, the swarms framework offers the tools and flexibility to bring your vision to life.
|
||||
|
||||
As you embark on your journey with the swarms framework, remember that the field of AI and agent-based systems is rapidly evolving. Stay curious, keep experimenting, and don't hesitate to push the boundaries of what's possible with custom agents and integrated libraries.
|
||||
|
||||
By embracing the power of the swarms framework and the ecosystem of agent libraries it supports, you're well-positioned to create the next generation of intelligent, adaptive, and collaborative AI systems. Happy agent building!
|
@ -0,0 +1,304 @@
|
||||
# ToolAgent Documentation
|
||||
|
||||
The `ToolAgent` class is a specialized agent that facilitates the execution of specific tasks using a model and tokenizer. It is part of the `swarms` module and inherits from the `Agent` class. This agent is designed to generate functions based on a given JSON schema and task, making it highly adaptable for various use cases, including natural language processing and data generation.
|
||||
|
||||
The `ToolAgent` class plays a crucial role in leveraging pre-trained models and tokenizers to automate tasks that require the interpretation and generation of structured data. By providing a flexible interface and robust error handling, it ensures smooth integration and efficient task execution.
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|--------------------|-----------------------------------|---------------------------------------------------------------------------------|
|
||||
| `name` | `str` | The name of the tool agent. Default is "Function Calling Agent". |
|
||||
| `description` | `str` | A description of the tool agent. Default is "Generates a function based on the input json schema and the task". |
|
||||
| `model` | `Any` | The model used by the tool agent. |
|
||||
| `tokenizer` | `Any` | The tokenizer used by the tool agent. |
|
||||
| `json_schema` | `Any` | The JSON schema used by the tool agent. |
|
||||
| `max_number_tokens`| `int` | The maximum number of tokens for generation. Default is 500. |
|
||||
| `parsing_function` | `Optional[Callable]` | An optional parsing function to process the output of the tool agent. |
|
||||
| `llm` | `Any` | An optional large language model to be used by the tool agent. |
|
||||
| `*args` | Variable length argument list | Additional positional arguments. |
|
||||
| `**kwargs` | Arbitrary keyword arguments | Additional keyword arguments. |
|
||||
|
||||
### Attributes
|
||||
|
||||
| Attribute | Type | Description |
|
||||
|--------------------|-------|----------------------------------------------|
|
||||
| `name` | `str` | The name of the tool agent. |
|
||||
| `description` | `str` | A description of the tool agent. |
|
||||
| `model` | `Any` | The model used by the tool agent. |
|
||||
| `tokenizer` | `Any` | The tokenizer used by the tool agent. |
|
||||
| `json_schema` | `Any` | The JSON schema used by the tool agent. |
|
||||
|
||||
### Methods
|
||||
|
||||
#### `run`
|
||||
|
||||
```python
|
||||
def run(self, task: str, *args, **kwargs) -> Any:
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|------------|---------------------------|------------------------------------------------------------------|
|
||||
| `task` | `str` | The task to be performed by the tool agent. |
|
||||
| `*args` | Variable length argument list | Additional positional arguments. |
|
||||
| `**kwargs` | Arbitrary keyword arguments | Additional keyword arguments. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
- The output of the tool agent.
|
||||
|
||||
**Raises:**
|
||||
|
||||
- `Exception`: If an error occurs during the execution of the tool agent.
|
||||
|
||||
## Functionality and Usage
|
||||
|
||||
The `ToolAgent` class provides a structured way to perform tasks using a model and tokenizer. It initializes with essential parameters and attributes, and the `run` method facilitates the execution of the specified task.
|
||||
|
||||
### Initialization
|
||||
|
||||
The initialization of a `ToolAgent` involves specifying its name, description, model, tokenizer, JSON schema, maximum number of tokens, optional parsing function, and optional large language model.
|
||||
|
||||
```python
|
||||
agent = ToolAgent(
|
||||
name="My Tool Agent",
|
||||
description="A tool agent for specific tasks",
|
||||
model=model,
|
||||
tokenizer=tokenizer,
|
||||
json_schema=json_schema,
|
||||
max_number_tokens=1000,
|
||||
parsing_function=my_parsing_function,
|
||||
llm=my_llm
|
||||
)
|
||||
```
|
||||
|
||||
### Running a Task
|
||||
|
||||
To execute a task using the `ToolAgent`, the `run` method is called with the task description and any additional arguments or keyword arguments.
|
||||
|
||||
```python
|
||||
result = agent.run("Generate a person's information based on the given schema.")
|
||||
print(result)
|
||||
```
|
||||
|
||||
### Detailed Examples
|
||||
|
||||
#### Example 1: Basic Usage
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
from swarms import ToolAgent
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained("databricks/dolly-v2-12b")
|
||||
tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-12b")
|
||||
|
||||
json_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"type": "string"},
|
||||
"age": {"type": "number"},
|
||||
"is_student": {"type": "boolean"},
|
||||
"courses": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task = "Generate a person's information based on the following schema:"
|
||||
agent = ToolAgent(model=model, tokenizer=tokenizer, json_schema=json_schema)
|
||||
generated_data = agent.run(task)
|
||||
|
||||
print(generated_data)
|
||||
```
|
||||
|
||||
#### Example 2: Using a Parsing Function
|
||||
|
||||
```python
|
||||
def parse_output(output):
|
||||
# Custom parsing logic
|
||||
return output
|
||||
|
||||
agent = ToolAgent(
|
||||
name="Parsed Tool Agent",
|
||||
description="A tool agent with a parsing function",
|
||||
model=model,
|
||||
tokenizer=tokenizer,
|
||||
json_schema=json_schema,
|
||||
parsing_function=parse_output
|
||||
)
|
||||
|
||||
task = "Generate a person's information with custom parsing:"
|
||||
parsed_data = agent.run(task)
|
||||
|
||||
print(parsed_data)
|
||||
```
|
||||
|
||||
#### Example 3: Specifying Maximum Number of Tokens
|
||||
|
||||
```python
|
||||
agent = ToolAgent(
|
||||
name="Token Limited Tool Agent",
|
||||
description="A tool agent with a token limit",
|
||||
model=model,
|
||||
tokenizer=tokenizer,
|
||||
json_schema=json_schema,
|
||||
max_number_tokens=200
|
||||
)
|
||||
|
||||
task = "Generate a concise person's information:"
|
||||
limited_data = agent.run(task)
|
||||
|
||||
print(limited_data)
|
||||
```
|
||||
|
||||
|
||||
## Full Usage
|
||||
```python
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
from swarms import ToolAgent
|
||||
from swarms.tools.json_utils import base_model_to_json
|
||||
|
||||
# Model name
|
||||
model_name = "CohereForAI/c4ai-command-r-v01-4bit"
|
||||
|
||||
# Load the pre-trained model and tokenizer
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
device_map="auto",
|
||||
)
|
||||
|
||||
# Load the pre-trained model and tokenizer
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
|
||||
# Initialize the schema for the person's information
|
||||
class APIExampleRequestSchema(BaseModel):
|
||||
endpoint: str = Field(
|
||||
..., description="The API endpoint for the example request"
|
||||
)
|
||||
method: str = Field(
|
||||
..., description="The HTTP method for the example request"
|
||||
)
|
||||
headers: dict = Field(
|
||||
..., description="The headers for the example request"
|
||||
)
|
||||
body: dict = Field(..., description="The body of the example request")
|
||||
response: dict = Field(
|
||||
...,
|
||||
description="The expected response of the example request",
|
||||
)
|
||||
|
||||
|
||||
# Convert the schema to a JSON string
|
||||
api_example_schema = base_model_to_json(APIExampleRequestSchema)
|
||||
# Convert the schema to a JSON string
|
||||
|
||||
# Define the task to generate a person's information
|
||||
task = "Generate an example API request using this code:\n"
|
||||
|
||||
# Create an instance of the ToolAgent class
|
||||
agent = ToolAgent(
|
||||
name="Command R Tool Agent",
|
||||
description=(
|
||||
"An agent that generates an API request using the Command R"
|
||||
" model."
|
||||
),
|
||||
model=model,
|
||||
tokenizer=tokenizer,
|
||||
json_schema=api_example_schema,
|
||||
)
|
||||
|
||||
# Run the agent to generate the person's information
|
||||
generated_data = agent.run(task)
|
||||
|
||||
# Print the generated data
|
||||
print(f"Generated data: {generated_data}")
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Jamba ++ ToolAgent
|
||||
```python
|
||||
from pydantic import BaseModel, Field
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
from swarms import ToolAgent
|
||||
from swarms.tools.json_utils import base_model_to_json
|
||||
|
||||
# Model name
|
||||
model_name = "ai21labs/Jamba-v0.1"
|
||||
|
||||
# Load the pre-trained model and tokenizer
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
device_map="auto",
|
||||
)
|
||||
|
||||
# Load the pre-trained model and tokenizer
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
|
||||
# Initialize the schema for the person's information
|
||||
class APIExampleRequestSchema(BaseModel):
|
||||
endpoint: str = Field(
|
||||
..., description="The API endpoint for the example request"
|
||||
)
|
||||
method: str = Field(
|
||||
..., description="The HTTP method for the example request"
|
||||
)
|
||||
headers: dict = Field(
|
||||
..., description="The headers for the example request"
|
||||
)
|
||||
body: dict = Field(..., description="The body of the example request")
|
||||
response: dict = Field(
|
||||
...,
|
||||
description="The expected response of the example request",
|
||||
)
|
||||
|
||||
|
||||
# Convert the schema to a JSON string
|
||||
api_example_schema = base_model_to_json(APIExampleRequestSchema)
|
||||
# Convert the schema to a JSON string
|
||||
|
||||
# Define the task to generate a person's information
|
||||
task = "Generate an example API request using this code:\n"
|
||||
|
||||
# Create an instance of the ToolAgent class
|
||||
agent = ToolAgent(
|
||||
name="Command R Tool Agent",
|
||||
description=(
|
||||
"An agent that generates an API request using the Command R"
|
||||
" model."
|
||||
),
|
||||
model=model,
|
||||
tokenizer=tokenizer,
|
||||
json_schema=api_example_schema,
|
||||
)
|
||||
|
||||
# Run the agent to generate the person's information
|
||||
generated_data = agent(task)
|
||||
|
||||
# Print the generated data
|
||||
print(f"Generated data: {generated_data}")
|
||||
```
|
||||
|
||||
## Additional Information and Tips
|
||||
|
||||
- Ensure that either the `model` or `llm` parameter is provided during initialization. If neither is provided, the `ToolAgent` will raise an exception.
|
||||
- The `parsing_function` parameter is optional but can be very useful for post-processing the output of the tool agent.
|
||||
- Adjust the `max_number_tokens` parameter to control the length of the generated output, depending on the requirements of the task.
|
||||
|
||||
## References and Resources
|
||||
|
||||
- [Transformers Documentation](https://huggingface.co/transformers/)
|
||||
- [Loguru Logger](https://loguru.readthedocs.io/en/stable/)
|
||||
|
||||
This documentation provides a comprehensive guide to the `ToolAgent` class, including its initialization, usage, and practical examples. By following the detailed instructions and examples, developers can effectively utilize the `ToolAgent` for various tasks involving model and tokenizer-based operations.
|
@ -0,0 +1,243 @@
|
||||
# `Artifact`
|
||||
|
||||
The `Artifact` class represents a file artifact, encapsulating the file's path, type, contents, versions, and edit count. This class provides a comprehensive way to manage file versions, edit contents, and handle various file-related operations such as saving, loading, and exporting to JSON.
|
||||
|
||||
The `Artifact` class is particularly useful in contexts where file version control and content management are essential. By keeping track of the number of edits and maintaining a version history, it allows for robust file handling and auditability.
|
||||
|
||||
## Class Definition
|
||||
|
||||
### Artifact
|
||||
|
||||
|
||||
| Attribute | Type | Default Value | Description |
|
||||
|-------------|---------------------|------------------|--------------------------------------------------|
|
||||
| `file_path` | `str` | N/A | The path to the file. |
|
||||
| `file_type` | `str` | N/A | The type of the file. |
|
||||
| `contents` | `str` | `""` | The contents of the file. |
|
||||
| `versions` | `List[FileVersion]` | `[]` | The list of file versions. |
|
||||
| `edit_count`| `int` | `0` | The number of times the file has been edited. |
|
||||
|
||||
### Parameters and Validation
|
||||
|
||||
- `file_path`: A string representing the file path.
|
||||
- `file_type`: A string representing the file type. This attribute is validated to ensure it matches supported file types based on the file extension if not provided.
|
||||
- `contents`: A string representing the contents of the file. Defaults to an empty string.
|
||||
- `versions`: A list of `FileVersion` instances representing the version history of the file. Defaults to an empty list.
|
||||
- `edit_count`: An integer representing the number of edits made to the file. Defaults to 0.
|
||||
|
||||
### Methods
|
||||
|
||||
The `Artifact` class includes various methods for creating, editing, saving, loading, and exporting file artifacts.
|
||||
|
||||
#### `create`
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|--------------------|--------|----------------------------------------|
|
||||
| `initial_content` | `str` | The initial content of the file. |
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact = Artifact(file_path="example.txt", file_type="txt")
|
||||
artifact.create(initial_content="Initial file content")
|
||||
```
|
||||
|
||||
#### `edit`
|
||||
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|---------------|--------|----------------------------------------|
|
||||
| `new_content` | `str` | The new content of the file. |
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact.edit(new_content="Updated file content")
|
||||
```
|
||||
|
||||
#### `save`
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact.save()
|
||||
```
|
||||
|
||||
#### `load`
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact.load()
|
||||
```
|
||||
|
||||
#### `get_version`
|
||||
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-------------------|-------|-----------------------------------------|
|
||||
| `version_number` | `int` | The version number to retrieve. |
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
version = artifact.get_version(version_number=1)
|
||||
```
|
||||
|
||||
#### `get_contents`
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
current_contents = artifact.get_contents()
|
||||
```
|
||||
|
||||
#### `get_version_history`
|
||||
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
version_history = artifact.get_version_history()
|
||||
```
|
||||
|
||||
#### `export_to_json`
|
||||
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-------------|-------|----------------------------------------------|
|
||||
| `file_path` | `str` | The path to the JSON file to save the artifact.|
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact.export_to_json(file_path="artifact.json")
|
||||
```
|
||||
|
||||
#### `import_from_json`
|
||||
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-------------|-------|--------------------------------------------------|
|
||||
| `file_path` | `str` | The path to the JSON file to import the artifact from.|
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
imported_artifact = Artifact.import_from_json(file_path="artifact.json")
|
||||
```
|
||||
|
||||
#### `get_metrics`
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
metrics = artifact.get_metrics()
|
||||
```
|
||||
|
||||
#### `to_dict`
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact_dict = artifact.to_dict()
|
||||
```
|
||||
|
||||
#### `from_dict`
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------------------|--------------------------------------------------|
|
||||
| `data` | `Dict[str, Any]` | The dictionary representation of the artifact. |
|
||||
|
||||
**Usage Example:**
|
||||
|
||||
```python
|
||||
artifact_data = {
|
||||
"file_path": "example.txt",
|
||||
"file_type": "txt",
|
||||
"contents": "File content",
|
||||
"versions": [],
|
||||
"edit_count": 0
|
||||
}
|
||||
artifact = Artifact.from_dict(artifact_data)
|
||||
```
|
||||
|
||||
## Additional Information and Tips
|
||||
|
||||
- The `Artifact` class uses the `pydantic` library to handle data validation and serialization.
|
||||
- When editing the artifact, ensure that the `file_path` is set correctly to avoid file operation errors.
|
||||
- Use the `get_version` and `get_version_history` methods to maintain a clear audit trail of changes to the file.
|
||||
- The `export_to_json` and `import_from_json` methods are useful for backing up and restoring the state of an artifact.
|
||||
|
||||
## References and Resources
|
||||
|
||||
- [Pydantic Documentation](https://pydantic-docs.helpmanual.io/)
|
||||
- [Python os.path module](https://docs.python.org/3/library/os.path.html)
|
||||
- [JSON Documentation](https://docs.python.org/3/library/json.html)
|
||||
|
||||
## Examples of Usage
|
||||
|
||||
### Example 1: Creating and Editing an Artifact
|
||||
|
||||
```python
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from typing import List, Dict, Any, Union
|
||||
import os
|
||||
import json
|
||||
|
||||
# Define FileVersion class
|
||||
class FileVersion(BaseModel):
|
||||
version_number: int
|
||||
content: str
|
||||
timestamp: datetime
|
||||
|
||||
# Artifact class definition goes here
|
||||
|
||||
# Create an artifact
|
||||
artifact = Artifact(file_path="example.txt", file_type="txt")
|
||||
artifact.create(initial_content="Initial file content")
|
||||
|
||||
# Edit the artifact
|
||||
artifact.edit(new_content="Updated file content")
|
||||
|
||||
# Save the artifact to a file
|
||||
artifact.save()
|
||||
|
||||
# Load the artifact from the file
|
||||
artifact.load()
|
||||
|
||||
# Print the current contents of the artifact
|
||||
print(artifact.get_contents())
|
||||
|
||||
# Print the version history
|
||||
print(artifact.get_version_history())
|
||||
```
|
||||
|
||||
### Example 2: Exporting and Importing an Artifact
|
||||
|
||||
```python
|
||||
# Export the artifact to a JSON file
|
||||
artifact.export_to_json(file_path="artifact.json")
|
||||
|
||||
# Import
|
||||
|
||||
the artifact from a JSON file
|
||||
imported_artifact = Artifact.import_from_json(file_path="artifact.json")
|
||||
|
||||
# Print the metrics of the imported artifact
|
||||
print(imported_artifact.get_metrics())
|
||||
```
|
||||
|
||||
### Example 3: Converting an Artifact to and from a Dictionary
|
||||
|
||||
```python
|
||||
# Convert the artifact to a dictionary
|
||||
artifact_dict = artifact.to_dict()
|
||||
|
||||
# Create a new artifact from the dictionary
|
||||
new_artifact = Artifact.from_dict(artifact_dict)
|
||||
|
||||
# Print the metrics of the new artifact
|
||||
print(new_artifact.get_metrics())
|
||||
```
|
@ -0,0 +1,205 @@
|
||||
# Swarm Architectures
|
||||
|
||||
### Hierarchical Swarm
|
||||
|
||||
**Overview:**
|
||||
A Hierarchical Swarm architecture organizes the agents in a tree-like structure. Higher-level agents delegate tasks to lower-level agents, which can further divide tasks among themselves. This structure allows for efficient task distribution and scalability.
|
||||
|
||||
**Use-Cases:**
|
||||
|
||||
- Complex decision-making processes where tasks can be broken down into subtasks.
|
||||
|
||||
- Multi-stage workflows such as data processing pipelines or hierarchical reinforcement learning.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Root Agent] --> B1[Sub-Agent 1]
|
||||
A --> B2[Sub-Agent 2]
|
||||
B1 --> C1[Sub-Agent 1.1]
|
||||
B1 --> C2[Sub-Agent 1.2]
|
||||
B2 --> C3[Sub-Agent 2.1]
|
||||
B2 --> C4[Sub-Agent 2.2]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Parallel Swarm
|
||||
|
||||
**Overview:**
|
||||
In a Parallel Swarm architecture, multiple agents operate independently and simultaneously on different tasks. Each agent works on its own task without dependencies on the others.
|
||||
|
||||
**Use-Cases:**
|
||||
- Tasks that can be processed independently, such as parallel data analysis.
|
||||
- Large-scale simulations where multiple scenarios are run in parallel.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Coordinator Agent] --> B1[Sub-Agent 1]
|
||||
A --> B2[Sub-Agent 2]
|
||||
A --> B3[Sub-Agent 3]
|
||||
A --> B4[Sub-Agent 4]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Sequential Swarm
|
||||
|
||||
**Overview:**
|
||||
A Sequential Swarm architecture processes tasks in a linear sequence. Each agent completes its task before passing the result to the next agent in the chain. This architecture ensures orderly processing and is useful when tasks have dependencies.
|
||||
|
||||
**Use-Cases:**
|
||||
- Workflows where each step depends on the previous one, such as assembly lines or sequential data processing.
|
||||
|
||||
- Scenarios requiring strict order of operations.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[First Agent] --> B[Second Agent]
|
||||
B --> C[Third Agent]
|
||||
C --> D[Fourth Agent]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Round Robin Swarm
|
||||
|
||||
**Overview:**
|
||||
In a Round Robin Swarm architecture, tasks are distributed cyclically among a set of agents. Each agent takes turns handling tasks in a rotating order, ensuring even distribution of workload.
|
||||
|
||||
**Use-Cases:**
|
||||
- Load balancing in distributed systems.
|
||||
|
||||
- Scenarios requiring fair distribution of tasks to avoid overloading any single agent.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Coordinator Agent] --> B1[Sub-Agent 1]
|
||||
A --> B2[Sub-Agent 2]
|
||||
A --> B3[Sub-Agent 3]
|
||||
A --> B4[Sub-Agent 4]
|
||||
B1 --> A
|
||||
B2 --> A
|
||||
B3 --> A
|
||||
B4 --> A
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Federated Swarm
|
||||
|
||||
**Overview:**
|
||||
A Federated Swarm architecture involves multiple independent swarms collaborating to complete a task. Each swarm operates autonomously but can share information and results with other swarms.
|
||||
|
||||
**Use-Cases:**
|
||||
- Distributed learning systems where data is processed across multiple nodes.
|
||||
|
||||
- Scenarios requiring collaboration between different teams or departments.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Central Coordinator]
|
||||
subgraph Swarm1
|
||||
B1[Agent 1.1] --> B2[Agent 1.2]
|
||||
B2 --> B3[Agent 1.3]
|
||||
end
|
||||
subgraph Swarm2
|
||||
C1[Agent 2.1] --> C2[Agent 2.2]
|
||||
C2 --> C3[Agent 2.3]
|
||||
end
|
||||
subgraph Swarm3
|
||||
D1[Agent 3.1] --> D2[Agent 3.2]
|
||||
D2 --> D3[Agent 3.3]
|
||||
end
|
||||
B1 --> A
|
||||
C1 --> A
|
||||
D1 --> A
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Star Swarm
|
||||
|
||||
**Overview:**
|
||||
A Star Swarm architecture features a central agent that coordinates the activities of several peripheral agents. The central agent assigns tasks to the peripheral agents and aggregates their results.
|
||||
|
||||
**Use-Cases:**
|
||||
- Centralized decision-making processes.
|
||||
|
||||
- Scenarios requiring a central authority to coordinate multiple workers.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Central Agent] --> B1[Peripheral Agent 1]
|
||||
A --> B2[Peripheral Agent 2]
|
||||
A --> B3[Peripheral Agent 3]
|
||||
A --> B4[Peripheral Agent 4]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Mesh Swarm
|
||||
|
||||
**Overview:**
|
||||
A Mesh Swarm architecture allows for a fully connected network of agents where each agent can communicate with any other agent. This setup provides high flexibility and redundancy.
|
||||
|
||||
**Use-Cases:**
|
||||
- Complex systems requiring high fault tolerance and redundancy.
|
||||
|
||||
- Scenarios involving dynamic and frequent communication between agents.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A1[Agent 1] --> A2[Agent 2]
|
||||
A1 --> A3[Agent 3]
|
||||
A1 --> A4[Agent 4]
|
||||
A2 --> A3
|
||||
A2 --> A4
|
||||
A3 --> A4
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Cascade Swarm
|
||||
|
||||
**Overview:**
|
||||
A Cascade Swarm architecture involves a chain of agents where each agent triggers the next one in a cascade effect. This is useful for scenarios where tasks need to be processed in stages, and each stage initiates the next.
|
||||
|
||||
**Use-Cases:**
|
||||
- Multi-stage processing tasks such as data transformation pipelines.
|
||||
|
||||
- Event-driven architectures where one event triggers subsequent actions.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Trigger Agent] --> B[Agent 1]
|
||||
B --> C[Agent 2]
|
||||
C --> D[Agent 3]
|
||||
D --> E[Agent 4]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Hybrid Swarm
|
||||
|
||||
**Overview:**
|
||||
A Hybrid Swarm architecture combines elements of various architectures to suit specific needs. It might integrate hierarchical and parallel components, or mix sequential and round robin patterns.
|
||||
|
||||
**Use-Cases:**
|
||||
- Complex workflows requiring a mix of different processing strategies.
|
||||
|
||||
- Custom scenarios tailored to specific operational requirements.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Root Agent] --> B1[Sub-Agent 1]
|
||||
A --> B2[Sub-Agent 2]
|
||||
B1 --> C1[Parallel Agent 1]
|
||||
B1 --> C2[Parallel Agent 2]
|
||||
B2 --> C3[Sequential Agent 1]
|
||||
C3 --> C4[Sequential Agent 2]
|
||||
C3 --> C5[Sequential Agent 3]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
These swarm architectures provide different models for organizing and orchestrating large language models (LLMs) to perform various tasks efficiently. Depending on the specific requirements of your project, you can choose the appropriate architecture or even combine elements from multiple architectures to create a hybrid solution.
|
@ -0,0 +1,75 @@
|
||||
|
||||
# Swarm Ecosystem
|
||||
|
||||
Welcome to the Swarm Ecosystem, a comprehensive suite of tools and frameworks designed to empower developers to orhestrate swarms of autonomous agents for a variety of applications. Dive into our ecosystem below:
|
||||
|
||||
[Full Github Link](https://github.com/kyegomez/swarm-ecosystem)
|
||||
|
||||
## Getting Started
|
||||
|
||||
| Project | Description | Link |
|
||||
| ------- | ----------- | ---- |
|
||||
| **Swarms Framework** | A Python-based framework that enables the creation, deployment, and scaling of reliable swarms of autonomous agents aimed at automating complex workflows. | [Swarms Framework](https://github.com/kyegomez/swarms) |
|
||||
| **Swarms Cloud** | A cloud-based service offering Swarms-as-a-Service with guaranteed 100% uptime, cutting-edge performance, and enterprise-grade reliability for seamless scaling and management of swarms. | [Swarms Cloud](https://github.com/kyegomez/swarms-cloud) |
|
||||
| **Swarms Core** | Provides backend utilities focusing on concurrency, multi-threading, and advanced execution strategies, developed in Rust for maximum efficiency and performance. | [Swarms Core](https://github.com/kyegomez/swarms-core) |
|
||||
| **Swarm Foundation Models** | A dedicated repository for the creation, optimization, and training of groundbreaking swarming models. Features innovative models like PSO with transformers, ant colony optimizations, and more, aiming to surpass traditional architectures like Transformers and SSMs. Open for community contributions and ideas. | [Swarm Foundation Models](https://github.com/kyegomez/swarms-pytorch) |
|
||||
| **Swarm Platform** | The Swarms dashboard Platform | [Swarm Platform](https://github.com/kyegomez/swarms-platform) |
|
||||
| **Swarms JS** | Swarms Framework in JS. Orchestrate any agents and enable multi-agent collaboration between various agents! | [Swarm JS](https://github.com/kyegomez/swarms-js) |
|
||||
| **Swarms Memory** | Easy to use, reliable, and bleeding-edge RAG systems.! | [Swarm JS](https://github.com/kyegomez/swarms-memory) |
|
||||
| **Swarms Evals** | Evaluating Swarms! | [Swarm JS](https://github.com/kyegomez/swarms-evals) |
|
||||
| **Swarms Zero** | RPC Enterprise-Grade Automation Framework | [Swarm Zero]([https://github.com/kyegomez/swarms-evals](https://github.com/kyegomez/Zero)) |
|
||||
|
||||
----
|
||||
|
||||
## 🫶 Contributions:
|
||||
|
||||
The easiest way to contribute is to pick any issue with the `good first issue` tag 💪. Read the Contributing guidelines [here](/CONTRIBUTING.md). Bug Report? [File here](https://github.com/swarms/gateway/issues) | Feature Request? [File here](https://github.com/swarms/gateway/issues)
|
||||
|
||||
Swarms is an open-source project, and contributions are VERY welcome. If you want to contribute, you can create new features, fix bugs, or improve the infrastructure. Please refer to the [CONTRIBUTING.md](https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md) and our [contributing board](https://github.com/users/kyegomez/projects/1) to participate in Roadmap discussions!
|
||||
|
||||
<a href="https://github.com/kyegomez/swarms/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=kyegomez/swarms" />
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/kyegomez/swarms/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=kyegomez/swarms-cloud" />
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/kyegomez/swarms/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=kyegomez/swarms-platform" />
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/kyegomez/swarms/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=kyegomez/swarms-js" />
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
## Community
|
||||
|
||||
Join our growing community around the world, for real-time support, ideas, and discussions on Swarms 😊
|
||||
|
||||
- View our official [Blog](https://swarms.apac.ai)
|
||||
- Chat live with us on [Discord](https://discord.gg/kS3rwKs3ZC)
|
||||
- Follow us on [Twitter](https://twitter.com/kyegomez)
|
||||
- Connect with us on [LinkedIn](https://www.linkedin.com/company/the-swarm-corporation)
|
||||
- Visit us on [YouTube](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ)
|
||||
- [Join the Swarms community on Discord!](https://discord.gg/AJazBmhKnr)
|
||||
- Join our Swarms Community Gathering every Thursday at 1pm NYC Time to unlock the potential of autonomous agents in automating your daily tasks [Sign up here](https://lu.ma/5p2jnc2v)
|
||||
|
||||
---
|
||||
|
||||
## Discovery Call
|
||||
Book a discovery call to learn how Swarms can lower your operating costs by 40% with swarms of autonomous agents in lightspeed. [Click here to book a time that works for you!](https://calendly.com/swarm-corp/30min?month=2023-11)
|
||||
|
||||
|
||||
|
||||
## Accelerate Backlog
|
||||
Help us accelerate our backlog by supporting us financially! Note, we're an open source corporation and so all the revenue we generate is through donations at the moment ;)
|
||||
|
||||
<a href="https://polar.sh/kyegomez"><img src="https://polar.sh/embed/fund-our-backlog.svg?org=kyegomez" /></a>
|
||||
|
||||
---
|
@ -0,0 +1,407 @@
|
||||
# Code Cleanliness in Python: A Comprehensive Guide
|
||||
|
||||
Code cleanliness is an essential aspect of software development that ensures code is easy to read, understand, and maintain. Clean code leads to fewer bugs, easier debugging, and more efficient collaboration among developers. This blog article delves into the principles of writing clean Python code, emphasizing the use of type annotations, docstrings, and the Loguru logging library. We'll explore the importance of each component and provide practical examples to illustrate best practices.
|
||||
|
||||
## Table of Contents
|
||||
1. Introduction to Code Cleanliness
|
||||
2. Importance of Type Annotations
|
||||
3. Writing Effective Docstrings
|
||||
4. Structuring Your Code
|
||||
5. Error Handling and Logging with Loguru
|
||||
6. Refactoring for Clean Code
|
||||
7. Examples of Clean Code
|
||||
8. Conclusion
|
||||
|
||||
## 1. Introduction to Code Cleanliness
|
||||
|
||||
Code cleanliness refers to the practice of writing code that is easy to read, understand, and maintain. Clean code follows consistent conventions and is organized logically, making it easier for developers to collaborate and for new team members to get up to speed quickly.
|
||||
|
||||
### Why Clean Code Matters
|
||||
|
||||
1. **Readability**: Clean code is easy to read and understand, which reduces the time needed to grasp what the code does.
|
||||
2. **Maintainability**: Clean code is easier to maintain and modify, reducing the risk of introducing bugs when making changes.
|
||||
3. **Collaboration**: Clean code facilitates collaboration among team members, as everyone can easily understand and follow the codebase.
|
||||
4. **Debugging**: Clean code makes it easier to identify and fix bugs, leading to more reliable software.
|
||||
|
||||
## 2. Importance of Type Annotations
|
||||
|
||||
Type annotations in Python provide a way to specify the types of variables, function arguments, and return values. They enhance code readability and help catch type-related errors early in the development process.
|
||||
|
||||
### Benefits of Type Annotations
|
||||
|
||||
1. **Improved Readability**: Type annotations make it clear what types of values are expected, improving code readability.
|
||||
2. **Error Detection**: Type annotations help catch type-related errors during development, reducing runtime errors.
|
||||
3. **Better Tooling**: Many modern IDEs and editors use type annotations to provide better code completion and error checking.
|
||||
|
||||
### Example of Type Annotations
|
||||
|
||||
```python
|
||||
from typing import List
|
||||
|
||||
def calculate_average(numbers: List[float]) -> float:
|
||||
"""
|
||||
Calculates the average of a list of numbers.
|
||||
|
||||
Args:
|
||||
numbers (List[float]): A list of numbers.
|
||||
|
||||
Returns:
|
||||
float: The average of the numbers.
|
||||
"""
|
||||
return sum(numbers) / len(numbers)
|
||||
```
|
||||
|
||||
In this example, the `calculate_average` function takes a list of floats as input and returns a float. The type annotations make it clear what types are expected and returned, enhancing readability and maintainability.
|
||||
|
||||
## 3. Writing Effective Docstrings
|
||||
|
||||
Docstrings are an essential part of writing clean code in Python. They provide inline documentation for modules, classes, methods, and functions. Effective docstrings improve code readability and make it easier for other developers to understand and use your code.
|
||||
|
||||
### Benefits of Docstrings
|
||||
|
||||
1. **Documentation**: Docstrings serve as inline documentation, making it easier to understand the purpose and usage of code.
|
||||
2. **Consistency**: Well-written docstrings ensure consistent documentation across the codebase.
|
||||
3. **Ease of Use**: Docstrings make it easier for developers to use and understand code without having to read through the implementation details.
|
||||
|
||||
### Example of Effective Docstrings
|
||||
|
||||
```python
|
||||
def calculate_factorial(n: int) -> int:
|
||||
"""
|
||||
Calculates the factorial of a given non-negative integer.
|
||||
|
||||
Args:
|
||||
n (int): The non-negative integer to calculate the factorial of.
|
||||
|
||||
Returns:
|
||||
int: The factorial of the given number.
|
||||
|
||||
Raises:
|
||||
ValueError: If the input is a negative integer.
|
||||
"""
|
||||
if n < 0:
|
||||
raise ValueError("Input must be a non-negative integer.")
|
||||
factorial = 1
|
||||
for i in range(1, n + 1):
|
||||
factorial *= i
|
||||
return factorial
|
||||
```
|
||||
|
||||
In this example, the docstring clearly explains the purpose of the `calculate_factorial` function, its arguments, return value, and the exception it may raise.
|
||||
|
||||
## 4. Structuring Your Code
|
||||
|
||||
Proper code structure is crucial for code cleanliness. A well-structured codebase is easier to navigate, understand, and maintain. Here are some best practices for structuring your Python code:
|
||||
|
||||
### Organizing Code into Modules and Packages
|
||||
|
||||
Organize your code into modules and packages to group related functionality together. This makes it easier to find and manage code.
|
||||
|
||||
```python
|
||||
# project/
|
||||
# ├── main.py
|
||||
# ├── utils/
|
||||
# │ ├── __init__.py
|
||||
# │ ├── file_utils.py
|
||||
# │ └── math_utils.py
|
||||
# └── models/
|
||||
# ├── __init__.py
|
||||
# ├── user.py
|
||||
# └── product.py
|
||||
```
|
||||
|
||||
### Using Functions and Classes
|
||||
|
||||
Break down your code into small, reusable functions and classes. This makes your code more modular and easier to test.
|
||||
|
||||
```python
|
||||
class User:
|
||||
def __init__(self, name: str, age: int):
|
||||
"""
|
||||
Initializes a new user.
|
||||
|
||||
Args:
|
||||
name (str): The name of the user.
|
||||
age (int): The age of the user.
|
||||
"""
|
||||
self.name = name
|
||||
self.age = age
|
||||
|
||||
def greet(self) -> str:
|
||||
"""
|
||||
Greets the user.
|
||||
|
||||
Returns:
|
||||
str: A greeting message.
|
||||
"""
|
||||
return f"Hello, {self.name}!"
|
||||
```
|
||||
|
||||
### Keeping Functions Small
|
||||
|
||||
Functions should do one thing and do it well. Keep functions small and focused on a single task.
|
||||
|
||||
```python
|
||||
def save_user(user: User, filename: str) -> None:
|
||||
"""
|
||||
Saves user data to a file.
|
||||
|
||||
Args:
|
||||
user (User): The user object to save.
|
||||
filename (str): The name of the file to save the user data to.
|
||||
"""
|
||||
with open(filename, 'w') as file:
|
||||
file.write(f"{user.name},{user.age}")
|
||||
```
|
||||
|
||||
## 5. Error Handling and Logging with Loguru
|
||||
|
||||
Effective error handling and logging are critical components of clean code. They help you manage and diagnose issues that arise during the execution of your code.
|
||||
|
||||
### Error Handling Best Practices
|
||||
|
||||
1. **Use Specific Exceptions**: Catch specific exceptions rather than using a generic `except` clause.
|
||||
2. **Provide Meaningful Messages**: When raising exceptions, provide meaningful error messages to help diagnose the issue.
|
||||
3. **Clean Up Resources**: Use `finally` blocks or context managers to ensure that resources are properly cleaned up.
|
||||
|
||||
### Example of Error Handling
|
||||
|
||||
```python
|
||||
def divide_numbers(numerator: float, denominator: float) -> float:
|
||||
"""
|
||||
Divides the numerator by the denominator.
|
||||
|
||||
Args:
|
||||
numerator (float): The number to be divided.
|
||||
denominator (float): The number to divide by.
|
||||
|
||||
Returns:
|
||||
float: The result of the division.
|
||||
|
||||
Raises:
|
||||
ValueError: If the denominator is zero.
|
||||
"""
|
||||
if denominator == 0:
|
||||
raise ValueError("The denominator cannot be zero.")
|
||||
return numerator / denominator
|
||||
```
|
||||
|
||||
### Logging with Loguru
|
||||
|
||||
Loguru is a powerful logging library for Python that makes logging simple and enjoyable. It provides a clean and easy-to-use API for logging messages with different severity levels.
|
||||
|
||||
#### Installing Loguru
|
||||
|
||||
```bash
|
||||
pip install loguru
|
||||
```
|
||||
|
||||
#### Basic Usage of Loguru
|
||||
|
||||
```python
|
||||
from loguru import logger
|
||||
|
||||
logger.debug("This is a debug message")
|
||||
logger.info("This is an info message")
|
||||
logger.warning("This is a warning message")
|
||||
logger.error("This is an error message")
|
||||
logger.critical("This is a critical message")
|
||||
```
|
||||
|
||||
### Example of Logging in a Function
|
||||
|
||||
```python
|
||||
from loguru import logger
|
||||
|
||||
def fetch_data(url: str) -> str:
|
||||
"""
|
||||
Fetches data from a given URL and returns it as a string.
|
||||
|
||||
Args:
|
||||
url (str): The URL to fetch data from.
|
||||
|
||||
Returns:
|
||||
str: The data fetched from the URL.
|
||||
|
||||
Raises:
|
||||
requests.exceptions.RequestException: If there is an error with the request.
|
||||
"""
|
||||
try:
|
||||
logger.info(f"Fetching data from {url}")
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
logger.info("Data fetched successfully")
|
||||
return response.text
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error(f"Error fetching data: {e}")
|
||||
raise
|
||||
```
|
||||
|
||||
In this example, Loguru is used to log messages at different severity levels. The `fetch_data` function logs informational messages when fetching data and logs an error message if an exception is raised.
|
||||
|
||||
## 6. Refactoring for Clean Code
|
||||
|
||||
Refactoring is the process of restructuring existing code without changing its external behavior. It is an essential practice for maintaining clean code. Refactoring helps improve code readability, reduce complexity, and eliminate redundancy.
|
||||
|
||||
### Identifying Code Smells
|
||||
|
||||
Code smells are indicators of potential issues in the code that may require refactoring. Common code smells include:
|
||||
1. **Long Methods**: Methods that are too long and do too many things.
|
||||
2. **Duplicated Code**: Code that is duplicated in multiple places.
|
||||
3. **Large Classes**: Classes that have too many responsibilities.
|
||||
4. **Poor Naming**: Variables, functions, or classes with unclear or misleading names.
|
||||
|
||||
### Refactoring Techniques
|
||||
|
||||
1. **Extract Method**: Break down long methods into smaller, more focused methods.
|
||||
2. **Rename Variables**: Use meaningful names for variables, functions, and classes.
|
||||
3. **Remove Duplicated Code**: Consolidate duplicated code into a single location.
|
||||
4. **Simplify Conditional Expressions**: Simplify complex conditional expressions for
|
||||
|
||||
better readability.
|
||||
|
||||
### Example of Refactoring
|
||||
|
||||
Before refactoring:
|
||||
```python
|
||||
def process_data(data: List[int]) -> int:
|
||||
total = 0
|
||||
for value in data:
|
||||
if value > 0:
|
||||
total += value
|
||||
return total
|
||||
```
|
||||
|
||||
After refactoring:
|
||||
```python
|
||||
def filter_positive_values(data: List[int]) -> List[int]:
|
||||
"""
|
||||
Filters the positive values from the input data.
|
||||
|
||||
Args:
|
||||
data (List[int]): The input data.
|
||||
|
||||
Returns:
|
||||
List[int]: A list of positive values.
|
||||
"""
|
||||
return [value for value in data if value > 0]
|
||||
|
||||
def sum_values(values: List[int]) -> int:
|
||||
"""
|
||||
Sums the values in the input list.
|
||||
|
||||
Args:
|
||||
values (List[int]): A list of values to sum.
|
||||
|
||||
Returns:
|
||||
int: The sum of the values.
|
||||
"""
|
||||
return sum(values)
|
||||
|
||||
def process_data(data: List[int]) -> int:
|
||||
"""
|
||||
Processes the data by filtering positive values and summing them.
|
||||
|
||||
Args:
|
||||
data (List[int]): The input data.
|
||||
|
||||
Returns:
|
||||
int: The sum of the positive values.
|
||||
"""
|
||||
positive_values = filter_positive_values(data)
|
||||
return sum_values(positive_values)
|
||||
```
|
||||
|
||||
In this example, the `process_data` function is refactored into smaller, more focused functions. This improves readability and maintainability.
|
||||
|
||||
## 7. Examples of Clean Code
|
||||
|
||||
### Example 1: Reading a File
|
||||
|
||||
```python
|
||||
def read_file(file_path: str) -> str:
|
||||
"""
|
||||
Reads the content of a file and returns it as a string.
|
||||
|
||||
Args:
|
||||
file_path (str): The path to the file to read.
|
||||
|
||||
Returns:
|
||||
str: The content of the file.
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If the file does not exist.
|
||||
IOError: If there is an error reading the file.
|
||||
"""
|
||||
try:
|
||||
with open(file_path, 'r') as file:
|
||||
return file.read()
|
||||
except FileNotFoundError as e:
|
||||
logger.error(f"File not found: {file_path}")
|
||||
raise
|
||||
except IOError as e:
|
||||
logger.error(f"Error reading file: {file_path}")
|
||||
raise
|
||||
```
|
||||
|
||||
### Example 2: Fetching Data from a URL
|
||||
|
||||
```python
|
||||
import requests
|
||||
from loguru import logger
|
||||
|
||||
def fetch_data(url: str) -> str:
|
||||
"""
|
||||
Fetches data from a given URL and returns it as a string.
|
||||
|
||||
Args:
|
||||
url (str): The URL to fetch data from.
|
||||
|
||||
Returns:
|
||||
str: The data fetched from the URL.
|
||||
|
||||
Raises:
|
||||
requests.exceptions.RequestException: If there is an error with the request.
|
||||
"""
|
||||
try:
|
||||
logger.info(f"Fetching data from {url}")
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
logger.info("Data fetched successfully")
|
||||
return response.text
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.error(f"Error fetching data: {e}")
|
||||
raise
|
||||
```
|
||||
|
||||
### Example 3: Calculating Factorial
|
||||
|
||||
```python
|
||||
def calculate_factorial(n: int) -> int:
|
||||
"""
|
||||
Calculates the factorial of a given non-negative integer.
|
||||
|
||||
Args:
|
||||
n (int): The non-negative integer to calculate the factorial of.
|
||||
|
||||
Returns:
|
||||
int: The factorial of the given number.
|
||||
|
||||
Raises:
|
||||
ValueError: If the input is a negative integer.
|
||||
"""
|
||||
if n < 0:
|
||||
raise ValueError("Input must be a non-negative integer.")
|
||||
factorial = 1
|
||||
for i in range(1, n + 1):
|
||||
factorial *= i
|
||||
return factorial
|
||||
```
|
||||
|
||||
## 8. Conclusion
|
||||
|
||||
Writing clean code in Python is crucial for developing maintainable, readable, and error-free software. By using type annotations, writing effective docstrings, structuring your code properly, and leveraging logging with Loguru, you can significantly improve the quality of your codebase.
|
||||
|
||||
Remember to refactor your code regularly to eliminate code smells and improve readability. Clean code not only makes your life as a developer easier but also enhances collaboration and reduces the likelihood of bugs.
|
||||
|
||||
By following the principles and best practices outlined in this article, you'll be well on your way to writing clean, maintainable Python code.
|
@ -0,0 +1,67 @@
|
||||
To create a comprehensive overview of the Swarms framework, we can break it down into key concepts such as models, agents, tools, Retrieval-Augmented Generation (RAG) systems, and swarm systems. Below are conceptual explanations of these components along with mermaid diagrams to illustrate their interactions.
|
||||
|
||||
### Swarms Framework Overview
|
||||
|
||||
#### 1. **Models**
|
||||
Models are the core component of the Swarms framework, representing the neural networks and machine learning models used to perform various tasks. These can be Large Language Models (LLMs), vision models, or any other AI models.
|
||||
|
||||
#### 2. **Agents**
|
||||
Agents are autonomous units that use models to perform specific tasks. In the Swarms framework, agents can leverage tools and interact with RAG systems.
|
||||
|
||||
- **LLMs with Tools**: These agents use large language models along with tools like databases, APIs, and external knowledge sources to enhance their capabilities.
|
||||
- **RAG Systems**: These systems combine retrieval mechanisms with generative models to produce more accurate and contextually relevant outputs.
|
||||
|
||||
#### 3. **Swarm Systems**
|
||||
Swarm systems involve multiple agents working collaboratively to achieve complex tasks. These systems coordinate and communicate among agents to ensure efficient and effective task execution.
|
||||
|
||||
### Mermaid Diagrams
|
||||
|
||||
#### Models
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Model] -->|Uses| B[Data]
|
||||
A -->|Trains| C[Algorithm]
|
||||
A -->|Outputs| D[Predictions]
|
||||
```
|
||||
|
||||
#### Agents: LLMs with Tools and RAG Systems
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Agent] -->|Uses| B[LLM]
|
||||
A -->|Interacts with| C[Tool]
|
||||
C -->|Provides Data to| B
|
||||
A -->|Queries| D[RAG System]
|
||||
D -->|Retrieves Information from| E[Database]
|
||||
D -->|Generates Responses with| F[Generative Model]
|
||||
```
|
||||
|
||||
#### Swarm Systems
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Swarm System]
|
||||
A -->|Coordinates| B[Agent 1]
|
||||
A -->|Coordinates| C[Agent 2]
|
||||
A -->|Coordinates| D[Agent 3]
|
||||
B -->|Communicates with| C
|
||||
C -->|Communicates with| D
|
||||
D -->|Communicates with| B
|
||||
B -->|Performs Task| E[Task 1]
|
||||
C -->|Performs Task| F[Task 2]
|
||||
D -->|Performs Task| G[Task 3]
|
||||
E -->|Reports to| A
|
||||
F -->|Reports to| A
|
||||
G -->|Reports to| A
|
||||
```
|
||||
|
||||
### Conceptualization
|
||||
|
||||
1. **Models**: The basic building blocks trained on specific datasets to perform tasks.
|
||||
2. **Agents**: Intelligent entities that utilize models and tools to perform actions. LLM agents can use additional tools to enhance their capabilities.
|
||||
3. **RAG Systems**: Enhance agents by combining retrieval mechanisms (to fetch relevant information) with generative models (to create contextually relevant responses).
|
||||
4. **Swarm Systems**: Complex systems where multiple agents collaborate, communicate, and coordinate to perform complex, multi-step tasks efficiently.
|
||||
|
||||
### Summary
|
||||
The Swarms framework leverages models, agents, tools, RAG systems, and swarm systems to create a robust, collaborative environment for executing complex AI tasks. By coordinating multiple agents and enhancing their capabilities with tools and retrieval-augmented generation, Swarms can handle sophisticated and multi-faceted applications effectively.
|
@ -0,0 +1,117 @@
|
||||
## Swarms Framework Conceptual Breakdown
|
||||
|
||||
The `swarms` framework is a sophisticated structure designed to orchestrate the collaborative work of multiple agents in a hierarchical manner. This breakdown provides a conceptual and visual representation of the framework, highlighting the interactions between models, tools, memory, agents, and swarms.
|
||||
|
||||
### Hierarchical Structure
|
||||
|
||||
The framework can be visualized as a multi-layered hierarchy:
|
||||
|
||||
1. **Models, Tools, Memory**: These form the foundational components that agents utilize to perform tasks.
|
||||
2. **Agents**: Individual entities that encapsulate specific functionalities, utilizing models, tools, and memory.
|
||||
3. **Swarm**: A collection of multiple agents working together in a coordinated manner.
|
||||
4. **Structs**: High-level structures that organize and manage swarms, enabling complex workflows and interactions.
|
||||
|
||||
### Visual Representation
|
||||
|
||||
Below are visual graphs illustrating the hierarchical and tree structure of the `swarms` framework.
|
||||
|
||||
#### 1. Foundational Components: Models, Tools, Memory
|
||||
|
||||
![Diagram](assets/img/agent_def.png)
|
||||
|
||||
#### 2. Agents and Their Interactions
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
Agents --> Swarm
|
||||
subgraph Agents_Collection
|
||||
Agent1
|
||||
Agent2
|
||||
Agent3
|
||||
end
|
||||
subgraph Individual_Agents
|
||||
Agent1 --> Models
|
||||
Agent1 --> Tools
|
||||
Agent1 --> Memory
|
||||
Agent2 --> Models
|
||||
Agent2 --> Tools
|
||||
Agent2 --> Memory
|
||||
Agent3 --> Models
|
||||
Agent3 --> Tools
|
||||
Agent3 --> Memory
|
||||
end
|
||||
```
|
||||
|
||||
#### 3. Multiple Agents Form a Swarm
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
Swarm1 --> Struct
|
||||
Swarm2 --> Struct
|
||||
Swarm3 --> Struct
|
||||
subgraph Swarms_Collection
|
||||
Swarm1
|
||||
Swarm2
|
||||
Swarm3
|
||||
end
|
||||
subgraph Individual_Swarms
|
||||
Swarm1 --> Agent1
|
||||
Swarm1 --> Agent2
|
||||
Swarm1 --> Agent3
|
||||
Swarm2 --> Agent4
|
||||
Swarm2 --> Agent5
|
||||
Swarm2 --> Agent6
|
||||
Swarm3 --> Agent7
|
||||
Swarm3 --> Agent8
|
||||
Swarm3 --> Agent9
|
||||
end
|
||||
```
|
||||
|
||||
#### 4. Structs Organizing Multiple Swarms
|
||||
|
||||
```mermaid
|
||||
graph TD;
|
||||
Struct --> Swarms_Collection
|
||||
subgraph High_Level_Structs
|
||||
Struct1
|
||||
Struct2
|
||||
Struct3
|
||||
end
|
||||
subgraph Struct1
|
||||
Swarm1
|
||||
Swarm2
|
||||
end
|
||||
subgraph Struct2
|
||||
Swarm3
|
||||
end
|
||||
subgraph Struct3
|
||||
Swarm4
|
||||
Swarm5
|
||||
end
|
||||
```
|
||||
|
||||
### Directory Breakdown
|
||||
|
||||
The directory structure of the `swarms` framework is organized to support its hierarchical architecture:
|
||||
|
||||
```sh
|
||||
swarms/
|
||||
├── agents/
|
||||
├── artifacts/
|
||||
├── marketplace/
|
||||
├── memory/
|
||||
├── models/
|
||||
├── prompts/
|
||||
├── schemas/
|
||||
├── structs/
|
||||
├── telemetry/
|
||||
├── tools/
|
||||
├── utils/
|
||||
└── __init__.py
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
The `swarms` framework is designed to facilitate complex multi-agent interactions through a structured and layered approach. By leveraging foundational components like models, tools, and memory, individual agents are empowered to perform specialized tasks. These agents are then coordinated within swarms to achieve collective goals, and swarms are managed within high-level structs to orchestrate sophisticated workflows.
|
||||
|
||||
This hierarchical design ensures scalability, flexibility, and robustness, making the `swarms` framework a powerful tool for various applications in AI, data analysis, optimization, and beyond.
|
@ -0,0 +1,155 @@
|
||||
### Swarms Vision
|
||||
|
||||
**Swarms** is dedicated to transforming enterprise automation by offering a robust and intuitive interface for multi-agent collaboration and seamless integration with multiple models. Our mission is to enable enterprises to enhance their operational efficiency and effectiveness through intelligent automation.
|
||||
|
||||
#### Vision Statement
|
||||
|
||||
**To become the preeminent framework for orchestrating multi-agent collaboration and integration, empowering enterprises to achieve exceptional automation efficiency and operational excellence.**
|
||||
|
||||
#### Core Principles
|
||||
|
||||
1. **Multi-Agent Collaboration**: Facilitate seamless collaboration between diverse agents to solve complex and dynamic problems.
|
||||
2. **Integration**: Provide robust and flexible integration with various models and frameworks to maximize functionality.
|
||||
3. **Enterprise Automation**: Deliver enterprise-grade solutions designed for reliability, scalability, and security.
|
||||
4. **Open Ecosystem**: Promote an open and extensible ecosystem that encourages innovation, community engagement, and collaborative development.
|
||||
|
||||
### Vision Document with Mermaid Graphs
|
||||
|
||||
#### Overview Diagram
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Swarms Framework] --> B[Multi-Agent Collaboration]
|
||||
A --> C[Integration with Multiple Models]
|
||||
A --> D[Enterprise Automation]
|
||||
A --> E[Open Ecosystem]
|
||||
|
||||
B --> F[Seamless Communication]
|
||||
B --> G[Collaboration Protocols]
|
||||
|
||||
C --> H[Model Integration]
|
||||
C --> I[Framework Compatibility]
|
||||
|
||||
D --> J[Operational Efficiency]
|
||||
D --> K[Reliability and Scalability]
|
||||
|
||||
E --> L[Encourage Innovation]
|
||||
E --> M[Community Driven]
|
||||
```
|
||||
|
||||
#### Multi-Agent Collaboration
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
B[Multi-Agent Collaboration] --> F[Seamless Communication]
|
||||
B --> G[Collaboration Protocols]
|
||||
|
||||
F --> N[Cross-Agent Messaging]
|
||||
F --> O[Task Coordination]
|
||||
F --> P[Real-Time Updates]
|
||||
|
||||
G --> Q[Standard APIs]
|
||||
G --> R[Extensible Protocols]
|
||||
G --> S[Security and Compliance]
|
||||
|
||||
N --> T[Agent Messaging Hub]
|
||||
O --> U[Task Assignment and Monitoring]
|
||||
P --> V[Instantaneous Data Sync]
|
||||
|
||||
Q --> W[Unified API Interface]
|
||||
R --> X[Customizable Protocols]
|
||||
S --> Y[Compliance with Standards]
|
||||
S --> Z[Secure Communication Channels]
|
||||
```
|
||||
|
||||
#### Integration with Multiple Models
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
C[Integration with Multiple Models] --> H[Model Integration]
|
||||
C --> I[Framework Compatibility]
|
||||
|
||||
H --> R[Plug-and-Play Models]
|
||||
H --> S[Model Orchestration]
|
||||
H --> T[Model Versioning]
|
||||
|
||||
I --> U[Support for OpenAI]
|
||||
I --> V[Support for Anthropic]
|
||||
I --> W[Support for Gemini]
|
||||
I --> X[Support for LangChain]
|
||||
I --> Y[Support for AutoGen]
|
||||
I --> Z[Support for Custom Models]
|
||||
|
||||
R --> AA[Easy Model Integration]
|
||||
S --> AB[Dynamic Model Orchestration]
|
||||
T --> AC[Version Control]
|
||||
|
||||
U --> AD[Integration with OpenAI Models]
|
||||
V --> AE[Integration with Anthropic Models]
|
||||
W --> AF[Integration with Gemini Models]
|
||||
X --> AG[Integration with LangChain Models]
|
||||
Y --> AH[Integration with AutoGen Models]
|
||||
Z --> AI[Support for Proprietary Models]
|
||||
```
|
||||
|
||||
#### Enterprise Automation
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
D[Enterprise Automation] --> J[Operational Efficiency]
|
||||
D --> K[Reliability and Scalability]
|
||||
|
||||
J --> Y[Automate Workflows]
|
||||
J --> Z[Reduce Manual Work]
|
||||
J --> AA[Increase Productivity]
|
||||
|
||||
K --> AB[High Uptime]
|
||||
K --> AC[Enterprise-Grade Security]
|
||||
K --> AD[Scalable Solutions]
|
||||
|
||||
Y --> AE[Workflow Automation Tools]
|
||||
Z --> AF[Eliminate Redundant Tasks]
|
||||
AA --> AG[Boost Employee Efficiency]
|
||||
|
||||
AB --> AH[Robust Infrastructure]
|
||||
AC --> AI[Security Compliance]
|
||||
AD --> AJ[Scale with Demand]
|
||||
```
|
||||
|
||||
#### Open Ecosystem
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
E[Open Ecosystem] --> L[Encourage Innovation]
|
||||
E --> M[Community Driven]
|
||||
|
||||
L --> AC[Open Source Contributions]
|
||||
L --> AD[Hackathons and Workshops]
|
||||
L --> AE[Research and Development]
|
||||
|
||||
M --> AF[Active Community Support]
|
||||
M --> AG[Collaborative Development]
|
||||
M --> AH[Shared Resources]
|
||||
|
||||
AC --> AI[Community Contributions]
|
||||
AD --> AJ[Innovative Events]
|
||||
AE --> AK[Continuous R&D]
|
||||
|
||||
AF --> AL[Supportive Community]
|
||||
AG --> AM[Joint Development Projects]
|
||||
AH --> AN[Shared Knowledge Base]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Conclusion
|
||||
|
||||
Swarms excels in enabling seamless communication and coordination between multiple agents, fostering a collaborative environment where agents can work together to solve complex tasks. Our platform supports cross-agent messaging, task coordination, and real-time updates, ensuring that all agents are synchronized and can efficiently contribute to the collective goal.
|
||||
|
||||
Swarms provides robust integration capabilities with a wide array of models, including OpenAI, Anthropic, Gemini, LangChain, AutoGen, and custom models. This ensures that enterprises can leverage the best models available to meet their specific needs, while also allowing for dynamic model orchestration and version control to keep operations up-to-date and effective.
|
||||
|
||||
Our framework is designed to enhance operational efficiency through automation. By automating workflows, reducing manual work, and increasing productivity, Swarms helps enterprises achieve higher efficiency and operational excellence. Our solutions are built for high uptime, enterprise-grade security, and scalability, ensuring reliable and secure operations.
|
||||
|
||||
Swarms promotes an open and extensible ecosystem, encouraging community-driven innovation and development. We support open-source contributions, organize hackathons and workshops, and continuously invest in research and development. Our active community fosters collaborative development, shared resources, and a supportive environment for innovation.
|
||||
|
||||
**Swarms** is dedicated to providing a comprehensive and powerful framework for enterprises seeking to automate operations through multi-agent collaboration and integration with various models. Our commitment to an open ecosystem, enterprise-grade automation solutions, and seamless multi-agent collaboration ensures that Swarms remains the leading choice for enterprises aiming to achieve operational excellence through intelligent automation.
|
@ -0,0 +1,48 @@
|
||||
# Glossary of Terms
|
||||
|
||||
**Agent**:
|
||||
An LLM (Large Language Model) equipped with tools and memory, operating with a specific objective in a loop. An agent can perform tasks, interact with other agents, and utilize external tools and memory systems to achieve its goals.
|
||||
|
||||
**Swarms**:
|
||||
A group of more than two agents working together and communicating to accomplish a shared objective. Swarms enable complex, collaborative tasks that leverage the strengths of multiple agents.
|
||||
|
||||
**Tool**:
|
||||
A Python function that is converted into a function call, allowing agents to perform specific actions or access external resources. Tools enhance the capabilities of agents by providing specialized functionalities.
|
||||
|
||||
**Memory System**:
|
||||
A system for managing information retrieval and storage, often implemented as a Retrieval-Augmented Generation (RAG) system or a memory vector database. Memory systems enable agents to recall previous interactions, store new information, and improve decision-making based on historical data.
|
||||
|
||||
**LLM (Large Language Model)**:
|
||||
A type of AI model designed to understand and generate human-like text. LLMs, such as GPT-3 or GPT-4, are used as the core computational engine for agents.
|
||||
|
||||
**System Prompt**:
|
||||
A predefined prompt that sets the context and instructions for an agent's task. The system prompt guides the agent's behavior and response generation.
|
||||
|
||||
**Max Loops**:
|
||||
The maximum number of iterations an agent will perform to complete its task. This parameter helps control the extent of an agent's processing and ensures tasks are completed efficiently.
|
||||
|
||||
**Dashboard**:
|
||||
A user interface that provides real-time monitoring and control over the agents and their activities. Dashboards can display agent status, logs, and performance metrics.
|
||||
|
||||
**Streaming On**:
|
||||
A setting that enables agents to stream their output incrementally, providing real-time feedback as they process tasks. This feature is useful for monitoring progress and making adjustments on the fly.
|
||||
|
||||
**Verbose**:
|
||||
A setting that controls the level of detail in an agent's output and logging. When verbose mode is enabled, the agent provides more detailed information about its operations and decisions.
|
||||
|
||||
**Multi-modal**:
|
||||
The capability of an agent to process and integrate multiple types of data, such as text, images, and audio. Multi-modal agents can handle more complex tasks that require diverse inputs.
|
||||
|
||||
**Autosave**:
|
||||
A feature that automatically saves the agent's state and progress at regular intervals. Autosave helps prevent data loss and allows for recovery in case of interruptions.
|
||||
|
||||
**Flow**:
|
||||
The predefined sequence in which agents in a swarm interact and process tasks. The flow ensures that each agent's output is appropriately passed to the next agent, facilitating coordinated efforts.
|
||||
|
||||
**Long Term Memory**:
|
||||
A component of the memory system that retains information over extended periods, enabling agents to recall and utilize past interactions and experiences.
|
||||
|
||||
**Output Schema**:
|
||||
A structured format for the output generated by agents, often defined using data models like Pydantic's BaseModel. Output schemas ensure consistency and clarity in the information produced by agents.
|
||||
|
||||
By understanding these terms, you can effectively build and orchestrate agents and swarms, leveraging their capabilities to perform complex, collaborative tasks.
|
@ -0,0 +1,288 @@
|
||||
# Swarms Installation Guide
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<a align="center" href="" target="_blank">
|
||||
<img
|
||||
width="850"
|
||||
src="https://github.com/kyegomez/swarms/raw/master/images/swarmslogobanner.png"
|
||||
>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
You can install `swarms` with pip in a
|
||||
[**Python>=3.10**](https://www.python.org/) environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you begin, ensure you have the following installed:
|
||||
|
||||
- Python 3.10 or higher: [Download Python](https://www.python.org/)
|
||||
- pip (specific version recommended): `pip >= 21.0`
|
||||
- git (for cloning the repository): [Download Git](https://git-scm.com/)
|
||||
|
||||
## Installation Options
|
||||
|
||||
=== "pip (Recommended)"
|
||||
|
||||
#### Headless Installation
|
||||
|
||||
The headless installation of `swarms` is designed for environments where graphical user interfaces (GUI) are not needed, making it more lightweight and suitable for server-side applications.
|
||||
|
||||
```bash
|
||||
pip install swarms
|
||||
```
|
||||
|
||||
=== "Development Installation"
|
||||
|
||||
=== "Using virtualenv"
|
||||
|
||||
1. **Clone the repository and navigate to the root directory:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kyegomez/swarms.git
|
||||
cd swarms
|
||||
```
|
||||
|
||||
2. **Setup Python environment and activate it:**
|
||||
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
```
|
||||
|
||||
3. **Install Swarms:**
|
||||
|
||||
- Headless install:
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
- Desktop install:
|
||||
|
||||
```bash
|
||||
pip install -e .[desktop]
|
||||
```
|
||||
|
||||
=== "Using Anaconda"
|
||||
|
||||
1. **Create and activate an Anaconda environment:**
|
||||
|
||||
```bash
|
||||
conda create -n swarms python=3.10
|
||||
conda activate swarms
|
||||
```
|
||||
|
||||
2. **Clone the repository and navigate to the root directory:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kyegomez/swarms.git
|
||||
cd swarms
|
||||
```
|
||||
|
||||
3. **Install Swarms:**
|
||||
|
||||
- Headless install:
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
- Desktop install:
|
||||
|
||||
```bash
|
||||
pip install -e .[desktop]
|
||||
```
|
||||
|
||||
=== "Using Poetry"
|
||||
|
||||
1. **Clone the repository and navigate to the root directory:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kyegomez/swarms.git
|
||||
cd swarms
|
||||
```
|
||||
|
||||
2. **Setup Python environment and activate it:**
|
||||
|
||||
```bash
|
||||
poetry env use python3.10
|
||||
poetry shell
|
||||
```
|
||||
|
||||
3. **Install Swarms:**
|
||||
|
||||
- Headless install:
|
||||
|
||||
```bash
|
||||
poetry install
|
||||
```
|
||||
|
||||
- Desktop install:
|
||||
|
||||
```bash
|
||||
poetry install --extras "desktop"
|
||||
```
|
||||
|
||||
=== "Using Docker"
|
||||
|
||||
Docker is an excellent option for creating isolated and reproducible environments, suitable for both development and production.
|
||||
|
||||
1. **Pull the Docker image:**
|
||||
|
||||
```bash
|
||||
docker pull kyegomez/swarms
|
||||
```
|
||||
|
||||
2. **Run the Docker container:**
|
||||
|
||||
```bash
|
||||
docker run -it --rm kyegomez/swarms
|
||||
```
|
||||
|
||||
3. **Build and run a custom Docker image:**
|
||||
|
||||
```dockerfile
|
||||
# Dockerfile
|
||||
FROM python:3.10-slim
|
||||
|
||||
# Set up environment
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Install dependencies
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install -e .
|
||||
|
||||
CMD ["python", "your_script.py"]
|
||||
```
|
||||
|
||||
```bash
|
||||
# Build and run the Docker image
|
||||
docker build -t swarms-custom .
|
||||
docker run -it --rm swarms-custom
|
||||
```
|
||||
|
||||
=== "Using Kubernetes"
|
||||
|
||||
Kubernetes provides an automated way to deploy, scale, and manage containerized applications.
|
||||
|
||||
1. **Create a Deployment YAML file:**
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: swarms-deployment
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: swarms
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: swarms
|
||||
spec:
|
||||
containers:
|
||||
- name: swarms
|
||||
image: kyegomez/swarms
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
```
|
||||
|
||||
2. **Apply the Deployment:**
|
||||
|
||||
```bash
|
||||
kubectl apply -f deployment.yaml
|
||||
```
|
||||
|
||||
3. **Expose the Deployment:**
|
||||
|
||||
```bash
|
||||
kubectl expose deployment swarms-deployment --type=LoadBalancer --name=swarms-service
|
||||
```
|
||||
|
||||
=== "CI/CD Pipelines"
|
||||
|
||||
Integrating Swarms into your CI/CD pipeline ensures automated testing and deployment.
|
||||
|
||||
#### Using GitHub Actions
|
||||
|
||||
```yaml
|
||||
# .github/workflows/ci.yml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.10
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -e .
|
||||
- name: Run tests
|
||||
run: |
|
||||
source venv/bin/activate
|
||||
pytest
|
||||
```
|
||||
|
||||
#### Using Jenkins
|
||||
|
||||
```groovy
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Clone repository') {
|
||||
steps {
|
||||
git 'https://github.com/kyegomez/swarms.git'
|
||||
}
|
||||
}
|
||||
stage('Setup Python') {
|
||||
steps {
|
||||
sh 'python3 -m venv venv'
|
||||
sh 'source venv/bin/activate && pip install --upgrade pip'
|
||||
}
|
||||
}
|
||||
stage('Install dependencies') {
|
||||
steps {
|
||||
sh 'source venv/bin/activate && pip install -e .'
|
||||
}
|
||||
}
|
||||
stage('Run tests') {
|
||||
steps {
|
||||
sh 'source venv/bin/activate && pytest'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Javascript
|
||||
|
||||
=== "NPM install (Work in Progress)"
|
||||
|
||||
Get started with the NPM implementation of Swarms:
|
||||
|
||||
```bash
|
||||
npm install swarms-js
|
||||
```
|
@ -0,0 +1,6 @@
|
||||
# Getting Started with Multi-Agent Collaboration Using the Multi-Agent Github Template
|
||||
|
||||
|
||||
The Multi-Agent Github Template, a radically simple, reliable, and high-performance framework, is designed to empower developers and prompt engineers to harness the full potential of multi-agent collaboration. [LINK](https://medium.com/@kyeg/getting-started-with-multi-agent-collaboration-using-the-multi-agent-github-template-0f0a6cba0dc0)
|
||||
|
||||
[GITHUB](https://github.com/kyegomez/Multi-Agent-Template-App)
|