Skip to content

Commit

Permalink
FIX: Layoutdocumentlm, swarm docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Nov 15, 2023
1 parent e5dce12 commit 9efcbff
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 339 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ Swarms framework is not just a tool but a robust, scalable, and secure partner i
## Community
- [Join the Swarms community here on Discord!](https://discord.gg/AJazBmhKnr)

# Discovery Call
Book a discovery call with the Swarms team to learn how to optimize and scale your swarm! [Click here to book a time that works for you!](https://calendly.com/swarm-corp/30min?month=2023-11)

# License
MIT
4 changes: 2 additions & 2 deletions docs/swarms/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Swarms is a modular framework that enables reliable and useful multi-agent collaboration at scale to automate real-world tasks.


<!--
[![GitHub issues](https://img.shields.io/github/issues/kyegomez/swarms)](https://github.com/kyegomez/swarms/issues) [![GitHub forks](https://img.shields.io/github/forks/kyegomez/swarms)](https://github.com/kyegomez/swarms/network) [![GitHub stars](https://img.shields.io/github/stars/kyegomez/swarms)](https://github.com/kyegomez/swarms/stargazers) [![GitHub license](https://img.shields.io/github/license/kyegomez/swarms)](https://github.com/kyegomez/swarms/blob/main/LICENSE)[![GitHub star chart](https://img.shields.io/github/stars/kyegomez/swarms?style=social)](https://star-history.com/#kyegomez/swarms)[![Dependency Status](https://img.shields.io/librariesio/github/kyegomez/swarms)](https://libraries.io/github/kyegomez/swarms) [![Downloads](https://static.pepy.tech/badge/swarms/month)](https://pepy.tech/project/swarms)
Expand All @@ -14,7 +14,7 @@ Swarms is a modular framework that enables reliable and useful multi-agent colla
[![Share on Reddit](https://img.shields.io/badge/-Share%20on%20Reddit-orange)](https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&title=Swarms%20-%20the%20future%20of%20AI) [![Share on Hacker News](https://img.shields.io/badge/-Share%20on%20Hacker%20News-orange)](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&t=Swarms%20-%20the%20future%20of%20AI) [![Share on Pinterest](https://img.shields.io/badge/-Share%20on%20Pinterest-red)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms&media=https%3A%2F%2Fexample.com%2Fimage.jpg&description=Swarms%20-%20the%20future%20of%20AI) [![Share on WhatsApp](https://img.shields.io/badge/-Share%20on%20WhatsApp-green)](https://api.whatsapp.com/send?text=Check%20out%20Swarms%20-%20the%20future%20of%20AI%20%23swarms%20%23AI%0A%0Ahttps%3A%2F%2Fgithub.com%2Fkyegomez%2Fswarms)
</div>
</div> -->

<!-- [![Swarm Fest](images/swarmfest.png)](https://github.com/users/kyegomez/projects/1) -->

Expand Down
6 changes: 1 addition & 5 deletions swarms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
warnings.filterwarnings("ignore", category=UserWarning)

# disable tensorflow warnings

os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
from swarms.agents import * # noqa: E402, F403
from swarms.swarms import * # noqa: E402, F403
from swarms.structs import * # noqa: E402, F403
from swarms.models import * # noqa: E402, F403

# from swarms.chunkers import * # noqa: E402, F403
from swarms.workers import * # noqa: E402, F403
from swarms.models import * # noqa: E402, F403
4 changes: 3 additions & 1 deletion swarms/models/layoutlm_document_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(
model_name: str = "impira/layoutlm-document-qa",
task_type: str = "document-question-answering",
):
self.pipeline = pipeline(self.task_type, model=self.model_name)
self.model_name = model_name
self.task_type = task_type
self.pipeline = pipeline(task_type, model=self.model_name)

def __call__(self, task: str, img_path: str):
"""Call for model"""
Expand Down
20 changes: 4 additions & 16 deletions swarms/structs/flow.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
"""
TODO:
- add a method that scrapes all the methods from the llm object and outputs them as a string
- Add tools
- Add open interpreter style conversation
- Add memory vector database retrieval
- add batch processing
- add async processing for run and batch run
- add plan module
- concurrent
- Add batched inputs
"""
import asyncio
import re
import inspect
import json
import logging
import random
import re
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
from termcolor import colored
import inspect
import random

from termcolor import colored

# Prompts
DYNAMIC_STOP_PROMPT = """
Expand Down
2 changes: 1 addition & 1 deletion swarms/swarms/autobloggen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from termcolor import colored

from swarms.prompts.autoblogen import (
from swarms.prompts.autobloggen import (
DRAFT_AGENT_SYSTEM_PROMPT,
REVIEW_PROMPT,
SOCIAL_MEDIA_SYSTEM_PROMPT_AGENT,
Expand Down
26 changes: 14 additions & 12 deletions swarms/swarms/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
import queue
import threading
from time import sleep
from swarms.utils.decorators import error_decorator, log_decorator, timing_decorator
from swarms.structs.flow import Flow
from typing import Dict, List, Callable
from typing import Callable, Dict, List

from termcolor import colored

from swarms.structs.flow import Flow
from swarms.utils.decorators import error_decorator, log_decorator, timing_decorator


class AutoScaler:
"""
The AutoScaler is like a kubernetes pod, that autoscales an agent or worker or boss!
# TODO Handle task assignment and task delegation
# TODO: User task => decomposed into very small sub tasks => sub tasks assigned to workers => workers complete and update the swarm, can ask for help from other agents.
# TODO: Missing, Task Assignment, Task delegation, Task completion, Swarm level communication with vector db
Wraps around a structure like SequentialWorkflow
and or Flow and parallelizes them on multiple threads so they're split across devices
and you can use them like that
Args:
initial_agents (int, optional): Number of initial agents. Defaults to 10.
Expand All @@ -35,12 +36,13 @@ class AutoScaler:
Usage
```
# usage of usage
auto_scaler = AutoScaler(agent=YourCustomAgent)
auto_scaler.start()
from swarms.swarms import AutoScaler
from swarms.structs.flow import Flow
@AutoScaler
flow = Flow()
for i in range(100):
auto_scaler.add_task9f"task {I}})
flow.run("what is your name")
```
"""

Expand Down
1 change: 0 additions & 1 deletion swarms/workers/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# from swarms.workers.worker import Worker
Loading

0 comments on commit 9efcbff

Please sign in to comment.