pull/378/merge
evelynmitchell 1 year ago committed by GitHub
commit 331f890cc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

@ -0,0 +1,35 @@
name: Test on Macos-14 M1
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11.7
uses: actions/setup-python@v5
with:
python-version: 3.11.7
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: |
poetry install
- name: Run tests
run: |
poetry run pytest

@ -19,9 +19,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
test_type:
- "core"
- "extended"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
@ -29,48 +27,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
poetry-version: "1.4.2"
cache-key: ${{ matrix.test_type }}
install-command:
if [ "${{ matrix.test_type }}" == "core" ]; then
echo "Running core tests, installing dependencies with poetry..."
poetry install
else
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing
fi
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
echo "Running core tests, installing dependencies with poetry..."
poetry install
- name: Run core tests
run: pytest
shell: bash
name: Python ${{ matrix.python-version }} ${{ matrix.test_type }}
steps:
- uses: actions/checkout@v4
- name: Python ${{ matrix.python-version }} core
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: "./.github/actions/poetry_setup"
uses: "actions/setup-python@v2"
with:
python-version: ${{ matrix.python-version }}
poetry-version: "1.4.2"
cache-key: ${{ matrix.test_type }}
install-command: |
if [ "${{ matrix.test_type }}" == "core" ]; then
echo "Running core tests, installing dependencies with poetry..."
poetry install
else
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing
fi
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
echo "Running core tests, installing dependencies with poetry..."
poetry install
- name: Run core tests
run: pytest
shell: bash
build:
runs-on: ubuntu-latest
strategy:
@ -80,31 +56,17 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
test_type:
- "core"
- "extended"
name: Python ${{ matrix.python-version }} ${{ matrix.test_type }}
name: Python ${{ matrix.python-version }} core
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: "./.github/actions/poetry_setup"
uses: "actions/setup-python@v2"
with:
python-version: ${{ matrix.python-version }}
poetry-version: "1.4.2"
cache-key: ${{ matrix.test_type }}
install-command: |
if [ "${{ matrix.test_type }}" == "core" ]; then
echo "Running core tests, installing dependencies with poetry..."
poetry install
else
echo "Running extended tests, installing dependencies with poetry..."
poetry install -E extended_testing
fi
- name: Run ${{matrix.test_type}} tests
run: |
if [ "${{ matrix.test_type }}" == "core" ]; then
make test
else
make extended_tests
fi
echo "Running core tests, installing dependencies with poetry..."
poetry install
- name: Run core tests
run: pytest
shell: bash

@ -1,3 +1,4 @@
""" Example of using the OpenAIChat model to generate a blog post. """
import os
from dotenv import load_dotenv

@ -1,8 +1,10 @@
from swarms.agents import MultiModalAgent
""" Example of using the MultiModalAgent """
from swarms.agents import OmniModalAgent
load_dict = {"ImageCaptioning": "cuda"}
node = MultiModalAgent(load_dict)
node = OmniModalAgent(load_dict)
text = node.run_text(
"What is your name? Generate a picture of yourself"

@ -23,7 +23,7 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.6.1"
python = ">=3.9.1,<3.12"
torch = "2.1.1"
transformers = "4.37.1"
openai = "0.28.0"
@ -33,6 +33,7 @@ einops = "0.7.0"
google-generativeai = "0.3.1"
langchain-experimental = "0.0.10"
tensorflow = "*"
tensorflow-io = "*"
weaviate-client = "3.25.3"
opencv-python-headless = "4.8.1.78"
faiss-cpu = "1.7.4"
@ -74,6 +75,7 @@ supervision = "*"
scikit-image = "*"
pinecone-client = "*"
roboflow = "*"
python-dotenv = "*"

@ -18,6 +18,7 @@ PyPDF2==3.0.1
accelerate==0.22.0
chromadb==0.4.14
tensorflow
tensorflow-io
optimum
toml
tiktoken==0.4.0
@ -52,3 +53,4 @@ scikit-image
anthropic
pinecone-client
roboflow
python-dotenv

@ -1,3 +1,4 @@
""" init file for swarms package. """
# from swarms.telemetry.main import Telemetry # noqa: E402, F403
from swarms.telemetry.bootup import bootup # noqa: E402, F403
from swarms.telemetry.user_utils import (
@ -6,15 +7,15 @@ from swarms.telemetry.user_utils import (
bootup()
get_user_device_data()
from swarms.agents import * # noqa: E402, F403, C0413
from swarms.structs import * # noqa: E402, F403, C0413
from swarms.models import * # noqa: E402, F403, C0413
from swarms.telemetry import * # noqa: E402, F403, C0413
from swarms.utils import * # noqa: E402, F403, C0413
from swarms.prompts import * # noqa: E402, F403, C0413
from swarms.tokenizers import * # noqa: E402, F403, C0413
from swarms.loaders import * # noqa: E402, F403, C0413
from swarms.artifacts import * # noqa: E402, F403, C0413
from swarms.chunkers import * # noqa: E402, F403, C0413
from swarms.agents import * # noqa: E402, F403
from swarms.structs import * # noqa: E402, F403
from swarms.models import * # noqa: E402, F403
from swarms.telemetry import * # noqa: E402, F403
from swarms.utils import * # noqa: E402, F403
from swarms.prompts import * # noqa: E402, F403
from swarms.tokenizers import * # noqa: E402, F403
from swarms.loaders import * # noqa: E402, F403
from swarms.artifacts import * # noqa: E402, F403
from swarms.chunkers import * # noqa: E402, F403
get_user_device_data()

@ -1,3 +1,4 @@
""" init file for swarms/agents module. """
from swarms.agents.base import AbstractAgent
from swarms.agents.omni_modal_agent import OmniModalAgent
from swarms.agents.simple_agent import SimpleAgent

@ -1,3 +1,5 @@
""" This module provides a function to wrap a class to inherit from 'Agent'. """
from swarms.structs.agent import Agent
@ -14,7 +16,8 @@ def agent_wrapper(ClassToWrap):
type: The new class that inherits from both 'ClassToWrap' and 'Agent'.
"""
class WrappedClass(ClassToWrap, Agent):
class WrappedClass(ClassToWrap, Agent): # noqa C0103
""" A class that inherits from both 'ClassToWrap' and 'Agent'. """
def __init__(self, *args, **kwargs):
try:
Agent.__init__(self, *args, **kwargs)

@ -1,3 +1,5 @@
""" Base class for AI agents. """
from typing import Dict, List

@ -1,3 +1,5 @@
""" OmniModalAgent """
from langchain.base_language import BaseLanguageModel
from langchain_experimental.autonomous_agents.hugginggpt.repsonse_generator import (
load_response_generator,
@ -72,11 +74,11 @@ class OmniModalAgent:
# self.task_executor = TaskExecutor
self.history = []
def run(self, input: str) -> str:
def run(self, inputtoagent: str) -> str:
"""Run the OmniAgent"""
plan = self.chat_planner.plan(
inputs={
"input": input,
"input": inputtoagent,
"hf_tools": self.tools,
}
)

Loading…
Cancel
Save