feat: Setup dev env

Former-commit-id: 56fcab5783aa33117bc1053d2ea19a5c39c47e46
pull/88/head
Zack 1 year ago
parent 01b2f4631d
commit 5db25123ac

@ -0,0 +1,8 @@
{
"name": "Swarms Project",
"dockerFile": "Dockerfile",
"forwardPorts": [
8000
],
"postCreateCommand": "pip install -r requirements.txt"
}

@ -0,0 +1,11 @@
FROM python:3.8-slim-buster
WORKDIR /app
ADD . /app
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8000
CMD ["python", "example.py"]

@ -0,0 +1,21 @@
# Swarms Project Development Environment
This repository uses [VS Code's Dev Containers](https://code.visualstudio.com/docs/remote/containers) to standardize the development environment. To get started, follow these steps:
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop).
2. Install [Visual Studio Code](https://code.visualstudio.com/).
3. Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension in VS Code.
4. Clone this repository and open it in VS Code.
5. When prompted to reopen the project in a container, click "Reopen in Container".
If you missed the prompt, you can open the command palette (F1) and run the "Remote-Containers: Reopen Folder in Container" command.
6. Wait for the container to build. This can take a few minutes the first time.
7. You're now developing inside a Docker container! Any changes you make will be reflected in the container.
For more information, see the [VS Code Dev Containers documentation](https://code.visualstudio.com/docs/remote/containers).

@ -20,8 +20,9 @@ from swarms.models.layoutlm_document_qa import LayoutLMDocumentQA
# from swarms.models.fuyu import Fuyu # Not working, wait until they update
import sys
log_file = open("errors.txt", "w")
sys.stderr = log_file
# Uncomment for clean ouput
# log_file = open("errors.txt", "w")
# sys.stderr = log_file
__all__ = [

@ -94,8 +94,8 @@ class Flow:
def __init__(
self,
llm: Any,
# template: str,
llm: Any,
max_loops: int = 5,
stopping_condition: Optional[Callable[[str], bool]] = None,
loop_interval: int = 1,
@ -107,8 +107,8 @@ class Flow:
dynamic_temperature: bool = False,
**kwargs: Any,
):
self.llm = llm
# self.template = template
self.llm = llm
self.max_loops = max_loops
self.stopping_condition = stopping_condition
self.loop_interval = loop_interval
@ -121,7 +121,21 @@ class Flow:
self.interactive = interactive
self.dashboard = dashboard
self.dynamic_temperature = dynamic_temperature
self.tools = tools
self.tools = tools or []
def load_tools(self, task: str, **kwargs):
for i in range(self.max_loops):
for tool in self.tools:
tool_prompt = f"\n\nTool: {tool.__name__}\n{tool.__doc__}"
reponse = self.llm(
f"""
{FLOW_SYSTEM_PROMPT}
{tool_prompt}
History: {reponse}
""", **kwargs
)
def provide_feedback(self, feedback: str) -> None:
"""Allow users to provide feedback on the responses."""

Loading…
Cancel
Save