Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/compose viz #33

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Pipeline

on: push

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.10.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.1
virtualenvs-in-project: 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
- name: pylint
run: |
source .venv/bin/activate
pylint build tests || echo ignore for now
- name: black
run: |
source .venv/bin/activate
black --check .

run-tests:
needs: code-quality
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.10.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.1
virtualenvs-in-project: 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
- name: Run all tests with pytest
run: |
source .venv/bin/activate
pytest --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

publish-all-images:
needs: run-tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get Git Commit Tag Name
uses: olegtarasov/get-tag@v2.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.10.12
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.1
virtualenvs-in-project: 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
- name: Publish Image to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
source .venv/bin/activate
python -m build.publish
40 changes: 32 additions & 8 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,57 @@ on:
pull_request:
branches: [ "main" ]
jobs:
build:
python-package-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: [
#"3.10",
"3.x"]
steps:


- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@master
with:
submodules: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
#- name: Set up Python ${{ matrix.python-version }}
#3 uses: actions/setup-python@v3
# with:
# architecture: x64
# python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
#python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install podman-compose
#- name: Lint with flake8
# run: |
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Docker Compose Action
uses: isbang/compose-action@v1.5.1
- name: Docker Compose Action build
#uses: meta-introspector/compose-action@main
env:
GITHUB_PAT: ${{ secrets.PAT }}
GITHUB_REPO: "jmikedupont2/ai-ticket"
run: docker-compose build


- name: create openai
env:
GITHUB_PAT: ${{ secrets.PAT }}
GITHUB_REPO: "jmikedupont2/ai-ticket"
run: |
GITHUB_PAT=${{ secrets.PAT }} GITHUB_REPO="jmikedupont2/ai-ticket" docker-compose up -d mockopenai

- name: run autogpt
env:
GITHUB_PAT: ${{ secrets.PAT }}
GITHUB_REPO: "jmikedupont2/ai-ticket"
run: |
GITHUB_PAT=${{ secrets.PAT }} GITHUB_REPO="jmikedupont2/ai-ticket" docker-compose run autogpt


4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

*~
*~
/dckr_pat_.txt
/github_pat.txt
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
[submodule "vendor/Auto-GPT-Benchmarks"]
path = vendor/Auto-GPT-Benchmarks
url = https://github.com/Significant-Gravitas/Auto-GPT-Benchmarks
[submodule "vendor/act_base"]
path = vendor/act_base
url = https://github.com/meta-introspector/act_base/
[submodule "vendor/python-poetry"]
path = vendor/python-poetry
url = https://github.com/meta-introspector/python-poetry
[submodule "vendor/basic_agent"]
path = vendor/basic_agent
url = https://github.com/meta-introspector/basic_agent
[submodule "vendor/docker-compose-viz"]
path = vendor/docker-compose-viz
url = https://github.com/meta-introspector/docker-compose-viz
4 changes: 4 additions & 0 deletions .secrets.example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GITHUB_TOKEN=
GITHUB_PAT=
PAT=this isused
DOCKER=
45 changes: 38 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
FROM python:3.10-slim
# The Poetry installation is provided through the base image. Please check the
# base image if you interested in the details.
# Base image: https://hub.docker.com/r/pfeiffermax/python-poetry
# Dockerfile: https://github.com/max-pfeiffer/python-poetry/blob/main/build/Dockerfile
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN apt update
RUN apt install -y git

LABEL maintainer="Mike DuPont <jmikedupont2@gmail.com>"

ENV PYTHONUNBUFFERED=1 \
# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/application_root \
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_CACHE_DIR="/application_root/.cache" \
VIRTUAL_ENVIRONMENT_PATH="/application_root/.venv" \
POETRY_HOME="/opt/poetry"
# https://python-poetry.org/docs/#installing-manually
RUN python -m venv ${VIRTUAL_ENVIRONMENT_PATH}

# Adding the virtual environment to PATH in order to "activate" it.
# https://docs.python.org/3/library/venv.html#how-venvs-work
ENV PATH="$VIRTUAL_ENVIRONMENT_PATH/bin:$PATH"

# Set the WORKDIR to the application root.
# https://www.uvicorn.org/settings/#development
# https://docs.docker.com/engine/reference/builder/#workdir
WORKDIR ${PYTHONPATH}

# https://python-poetry.org/docs/configuration/#cache-directory

WORKDIR /opt/ai-ticket
COPY pyproject.toml /opt/ai-ticket/
COPY setup.cfg /opt/ai-ticket/
COPY README.md /opt/ai-ticket/
COPY requirements.txt /opt/ai-ticket/
COPY ./src/ /opt/ai-ticket/src/
RUN pip install /opt/ai-ticket/


RUN apt update
RUN apt install -y git
RUN pip install --trusted-host pypi.python.org -r requirements.txt

RUN ls ${VIRTUAL_ENVIRONMENT_PATH}/bin/activate
RUN pip install /opt/ai-ticket/ && pip install --trusted-host pypi.python.org -r requirements.txt
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_build:
sudo docker-compose build

test:
bash ./runact.sh
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ai-ticket
# AI-Ticket
The AI Ticket system to handle the AI with tickets.
Human Powered AI-Ops to Help you with the last mile of your AI code generated system.

Expand Down Expand Up @@ -35,3 +35,11 @@ Welcome to our innovative user-driven workflow, designed to empower you to inter
- Be mindful of providing timely and appropriate responses to prevent workflow stalls.

This user-driven ticket-based workflow offers flexibility, control, and a unique way to collaborate with our system. Dive in, generate tickets, and explore the possibilities of this interactive and dynamic approach.


# Infrastructure

The docker images are organized like this :

* act_base is the foundation of all actions.
* poetry_base is contains the poetry magic layer with shared containers.
Binary file added docker-compose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 64 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,57 @@
version: '3'
services:

ai_ticket:
image: ai_ticket
build:
act_base: #root base of action
build: vendor/act_base
image: h4ckermike/act_base
#h4ckermike/
poetry_base: # use poetry
image: h4ckermike/poetry_base
build:
context: vendor/python-poetry/build
args:
OFFICIAL_PYTHON_IMAGE: h4ckermike/act_base:latest
POETRY_VERSION: 1.6.1
depends_on:
- act_base

ai_ticket: # the ticket to unite
image: h4ckermike/ai_ticket
build:
context: .
#entrypoint: /bin/bash
#stdin_open: true # docker run -i
#tty: true # docker run -t
args:
BASE_IMAGE: poetry_base
depends_on:
- poetry_base

basic_agent: #basic agnet
image: h4ckermike/basic_agent
build:

context: vendor/basic_agent/
args:
OFFICIAL_PYTHON_IMAGE: act_base
depends_on:
- ai_ticket

mockopenai: # interface
depends_on:
- ai_ticket
environment:
- GITHUB_PAT=${GITHUB_PAT}
- GITHUB_REPO=${GITHUB_REPO}
image: h4ckermike/mockopenai
build:

context: vendor/lollms/
args:
OFFICIAL_PYTHON_IMAGE: h4ckermike/ai_ticket:latest
ports:
- "5000:8080"

autogpt: #the beast
entrypoint: bash -c "poetry run pip install /opt/ai-ticket && poetry run autogpt --install-plugin-deps --skip-news -y --ai-name 'meta-autogpt' --ai-role 'you will introspect autogpt and reveal its internals via reflection and comprehension' --ai-goal 'Observe your behaviour' --ai-goal 'Reflect over your outcomes' --ai-goal 'Orient yourself to your knowledge' --ai-goal 'Decide on your next step' --ai-goal 'Act on your chosen next experiment' "

autogpt:
#entrypoint: bash -c "poetry run pip install /opt/ai-ticket && poetry run autogpt --install-plugin-deps --skip-news -y"
entrypoint: bash -c "poetry run pip install /opt/ai-ticket && poetry run autogpt --install-plugin-deps --skip-news -y --ai-name 'meta-autogpt' --ai-role 'you will introspect autogpt and reveal its internals via reflection and comprehension' --ai-goal 'Observe your behaviour' --ai-goal 'Reflect over your outcomes' --ai-goal 'Orient yourself to your knowledge' --ai-goal 'Decide on your next step' --ai-goal 'Act on your chosen next experiment' "

# uncomment thse next 3 lines for debugging
#entrypoint: /bin/bash
Expand All @@ -21,22 +61,24 @@ services:
- GITHUB_PAT="${GITHUB_PAT}"
- GITHUB_REPO="jmikedupont2/ai-ticket"
- OPENAI_API_KEY=your-openai-api-key
- OPENAI_API_BASE=http://mockopenai:5000/v1
- OPENAI_API_BASE=http://mockopenai:8080/v1
image: h4ckermike/autogpt
build:

context: vendor/Auto-GPT/
depends_on:
- mockopenai
dockerfile: slim/Dockerfile
args:
OFFICIAL_PYTHON_IMAGE: h4ckermike/ai_ticket:latest

mockopenai:
depends_on:
- ai_ticket

environment:
- GITHUB_PAT=${GITHUB_PAT}
- GITHUB_REPO=${GITHUB_REPO}
- basic_agent
- mockopenai
viz: #
build: vendor/docker-compose-viz
image: h4ckermike/docker-compose-viz

build:
context: vendor/lollms/
ports:
- "5000:5000"
volumes:
- .:/input:rw
# - ./docker-compose.yml:/input/docker-compose.yml

command: render -m image /input/docker-compose.yml -vvv --ansi -o /input/docker-compose.png --force
1 change: 1 addition & 0 deletions dockerbuild/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
1 change: 1 addition & 0 deletions dockerbuild/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
taken from pfeiffermax/uvicorn-poetry
Empty file added dockerbuild/__init__.py
Empty file.
Loading
Loading