├── .gitignore ├── AutoStartup.ipynb ├── README.md ├── agent.py ├── autostartup.py ├── main.py ├── memory.py ├── prompt.py ├── reactengineer.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ -------------------------------------------------------------------------------- /AutoStartup.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "source": [ 6 | "import os\n", 7 | "os.kill(os.getpid(), 9)" 8 | ], 9 | "metadata": { 10 | "id": "XFkf5o04mA3O" 11 | }, 12 | "execution_count": null, 13 | "outputs": [] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": null, 18 | "metadata": { 19 | "id": "NlM0_YLpHyQC" 20 | }, 21 | "outputs": [], 22 | "source": [ 23 | "import locale\n", 24 | "locale.getpreferredencoding = lambda: \"UTF-8\"" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "metadata": { 31 | "colab": { 32 | "base_uri": "https://localhost:8080/" 33 | }, 34 | "id": "4wmg_BTUZbIM", 35 | "outputId": "cb4e9398-7984-4b4e-db55-7d5b1e98bfd1" 36 | }, 37 | "outputs": [ 38 | { 39 | "output_type": "stream", 40 | "name": "stdout", 41 | "text": [ 42 | "Collecting accelerate\n", 43 | " Downloading accelerate-0.21.0-py3-none-any.whl (244 kB)\n", 44 | "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/244.2 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m\u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.7/244.2 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m244.2/244.2 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 45 | "\u001b[?25hRequirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from accelerate) (1.23.5)\n", 46 | "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from accelerate) (23.1)\n", 47 | "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from accelerate) (5.9.5)\n", 48 | "Requirement already satisfied: pyyaml in /usr/local/lib/python3.10/dist-packages (from accelerate) (6.0.1)\n", 49 | "Requirement already satisfied: torch>=1.10.0 in /usr/local/lib/python3.10/dist-packages (from accelerate) (2.0.1+cu118)\n", 50 | "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (3.12.2)\n", 51 | "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (4.7.1)\n", 52 | "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (1.12)\n", 53 | "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (3.1)\n", 54 | "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (3.1.2)\n", 55 | "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.10.0->accelerate) (2.0.0)\n", 56 | "Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.10.0->accelerate) (3.27.2)\n", 57 | "Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.10.0->accelerate) (16.0.6)\n", 58 | "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch>=1.10.0->accelerate) (2.1.3)\n", 59 | "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch>=1.10.0->accelerate) (1.3.0)\n", 60 | "Installing collected packages: accelerate\n", 61 | "Successfully installed accelerate-0.21.0\n" 62 | ] 63 | } 64 | ], 65 | "source": [ 66 | "!pip install -U accelerate" 67 | ] 68 | }, 69 | { 70 | "cell_type": "code", 71 | "source": [ 72 | "!pip install sentence-transformers" 73 | ], 74 | "metadata": { 75 | "id": "6naUkTGVwcsm", 76 | "outputId": "401c269b-25c8-4f3f-93c8-2cc620adc33b", 77 | "colab": { 78 | "base_uri": "https://localhost:8080/" 79 | } 80 | }, 81 | "execution_count": null, 82 | "outputs": [ 83 | { 84 | "output_type": "stream", 85 | "name": "stdout", 86 | "text": [ 87 | "Collecting sentence-transformers\n", 88 | " Downloading sentence-transformers-2.2.2.tar.gz (85 kB)\n", 89 | "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/86.0 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[90m╺\u001b[0m\u001b[90m━\u001b[0m \u001b[32m81.9/86.0 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m86.0/86.0 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 90 | "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", 91 | "Requirement already satisfied: transformers<5.0.0,>=4.6.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (4.31.0)\n", 92 | "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (4.66.1)\n", 93 | "Requirement already satisfied: torch>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (2.0.1+cu118)\n", 94 | "Requirement already satisfied: torchvision in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (0.15.2+cu118)\n", 95 | "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (1.23.5)\n", 96 | "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (1.2.2)\n", 97 | "Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (1.10.1)\n", 98 | "Requirement already satisfied: nltk in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (3.8.1)\n", 99 | "Collecting sentencepiece (from sentence-transformers)\n", 100 | " Downloading sentencepiece-0.1.99-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n", 101 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m64.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 102 | "\u001b[?25hRequirement already satisfied: huggingface-hub>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from sentence-transformers) (0.16.4)\n", 103 | "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (3.12.2)\n", 104 | "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (2023.6.0)\n", 105 | "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (2.31.0)\n", 106 | "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (6.0.1)\n", 107 | "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (4.7.1)\n", 108 | "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence-transformers) (23.1)\n", 109 | "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers) (1.12)\n", 110 | "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers) (3.1)\n", 111 | "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers) (3.1.2)\n", 112 | "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.6.0->sentence-transformers) (2.0.0)\n", 113 | "Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->sentence-transformers) (3.27.2)\n", 114 | "Requirement already satisfied: lit in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch>=1.6.0->sentence-transformers) (16.0.6)\n", 115 | "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.6.0->sentence-transformers) (2023.6.3)\n", 116 | "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.6.0->sentence-transformers) (0.13.3)\n", 117 | "Requirement already satisfied: safetensors>=0.3.1 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.6.0->sentence-transformers) (0.3.2)\n", 118 | "Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk->sentence-transformers) (8.1.6)\n", 119 | "Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk->sentence-transformers) (1.3.2)\n", 120 | "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->sentence-transformers) (3.2.0)\n", 121 | "Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.10/dist-packages (from torchvision->sentence-transformers) (9.4.0)\n", 122 | "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch>=1.6.0->sentence-transformers) (2.1.3)\n", 123 | "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub>=0.4.0->sentence-transformers) (3.2.0)\n", 124 | "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub>=0.4.0->sentence-transformers) (3.4)\n", 125 | "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub>=0.4.0->sentence-transformers) (2.0.4)\n", 126 | "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub>=0.4.0->sentence-transformers) (2023.7.22)\n", 127 | "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch>=1.6.0->sentence-transformers) (1.3.0)\n", 128 | "Building wheels for collected packages: sentence-transformers\n", 129 | " Building wheel for sentence-transformers (setup.py) ... \u001b[?25l\u001b[?25hdone\n", 130 | " Created wheel for sentence-transformers: filename=sentence_transformers-2.2.2-py3-none-any.whl size=125924 sha256=df10e069c61e7b287cb02452fcfeb5c79aa69ca4a1fca377f754f5d68c277891\n", 131 | " Stored in directory: /root/.cache/pip/wheels/62/f2/10/1e606fd5f02395388f74e7462910fe851042f97238cbbd902f\n", 132 | "Successfully built sentence-transformers\n", 133 | "Installing collected packages: sentencepiece, sentence-transformers\n", 134 | "Successfully installed sentence-transformers-2.2.2 sentencepiece-0.1.99\n" 135 | ] 136 | } 137 | ] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "execution_count": null, 142 | "metadata": { 143 | "colab": { 144 | "base_uri": "https://localhost:8080/" 145 | }, 146 | "id": "-VYqtmc4TuYR", 147 | "outputId": "ecb52990-ba83-485d-ce31-2bf49fd4eea2" 148 | }, 149 | "outputs": [ 150 | { 151 | "output_type": "stream", 152 | "name": "stdout", 153 | "text": [ 154 | "Collecting transformers\n", 155 | " Downloading transformers-4.31.0-py3-none-any.whl (7.4 MB)\n", 156 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.4/7.4 MB\u001b[0m \u001b[31m57.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 157 | "\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.12.2)\n", 158 | "Collecting huggingface-hub<1.0,>=0.14.1 (from transformers)\n", 159 | " Downloading huggingface_hub-0.16.4-py3-none-any.whl (268 kB)\n", 160 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m268.8/268.8 kB\u001b[0m \u001b[31m34.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 161 | "\u001b[?25hRequirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.23.5)\n", 162 | "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (23.1)\n", 163 | "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0.1)\n", 164 | "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2023.6.3)\n", 165 | "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers) (2.31.0)\n", 166 | "Collecting tokenizers!=0.11.3,<0.14,>=0.11.1 (from transformers)\n", 167 | " Downloading tokenizers-0.13.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.8 MB)\n", 168 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.8/7.8 MB\u001b[0m \u001b[31m110.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 169 | "\u001b[?25hCollecting safetensors>=0.3.1 (from transformers)\n", 170 | " Downloading safetensors-0.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)\n", 171 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m84.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 172 | "\u001b[?25hRequirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers) (4.66.1)\n", 173 | "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (2023.6.0)\n", 174 | "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (4.7.1)\n", 175 | "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.2.0)\n", 176 | "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.4)\n", 177 | "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2.0.4)\n", 178 | "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2023.7.22)\n", 179 | "Installing collected packages: tokenizers, safetensors, huggingface-hub, transformers\n", 180 | "Successfully installed huggingface-hub-0.16.4 safetensors-0.3.2 tokenizers-0.13.3 transformers-4.31.0\n" 181 | ] 182 | } 183 | ], 184 | "source": [ 185 | "!pip install transformers" 186 | ] 187 | }, 188 | { 189 | "cell_type": "code", 190 | "source": [ 191 | "# first get the intiial idea and then create business based on the idea\n", 192 | "# change the idea if it doesnt match the business plan\n", 193 | "# Criticize the plan" 194 | ], 195 | "metadata": { 196 | "id": "IDahMvLW3KOu" 197 | }, 198 | "execution_count": null, 199 | "outputs": [] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": null, 204 | "metadata": { 205 | "id": "5SK6o57wVVfY" 206 | }, 207 | "outputs": [], 208 | "source": [ 209 | "class Prompt:\n", 210 | " def __init__(self):\n", 211 | " # AutoStartup Prompts\n", 212 | " self.IdeaPrompt = \"\"\"\n", 213 | " [INST] <>\n", 214 | " You will generate a website business idea based on a user's intuition. The idea must be able to be built with a website. The idea must address the user's intution fully and be a profitable business.\n", 215 | " You must provide a name to the business and branding colors that work with the website business idea.\n", 216 | "\n", 217 | " The user will pass in it's intution in the format below\n", 218 | " INTUITION: the users intution will go here\n", 219 | "\n", 220 | " You must provide the website business idea in the format below\n", 221 | " IDEA: enter the website business idea here\n", 222 | " NAME: enter the name of the business here\n", 223 | " BRANDING_COLORS: enter the brand colors for the business here (you must only include the color hexes and separate them by comma)\n", 224 | "\n", 225 | " %s\n", 226 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 227 | " <>\n", 228 | " \"\"\"\n", 229 | "\n", 230 | " self.BusinessPlanPrompt = \"\"\"\n", 231 | " [INST] <>\n", 232 | " You will generate a business plan based on the business idea that the user gives you. Your business plan must be a list of items that start with a dash \"-\".\n", 233 | " You must provide exactly 5 line items for the business plan\n", 234 | "\n", 235 | " The user will pass in the business idea in the format below.\n", 236 | " IDEA: the idea will go here\n", 237 | "\n", 238 | "\n", 239 | " You will respond with a business plan in the format below.\n", 240 | " Business Plan:\n", 241 | " - line item 1\n", 242 | " - line item 2\n", 243 | " - line item 3\n", 244 | " - line item 4\n", 245 | " - line item 5\n", 246 | "\n", 247 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 248 | " <>\n", 249 | " \"\"\"\n", 250 | "\n", 251 | " self.CriticizeBusinessPlanPrompt = \"\"\"\n", 252 | " [INST] <>\n", 253 | " You will generate a list of criticisms based on a user provides business plan. The user will provide a list of items on the business. You will think of criticisms for each item and generate a new list based on your reasonings.\n", 254 | " You the lists you generate must start with a dash \"-\".\n", 255 | "\n", 256 | " The user will provide the business plan in the formation below\n", 257 | " Business Plan:\n", 258 | " - line item 1\n", 259 | " - line item 2\n", 260 | " - line item 3\n", 261 | " - line item 4\n", 262 | " - line item 5\n", 263 | "\n", 264 | " You must provide the criticisms in the response below as well as the new business plan\n", 265 | " Criticisms:\n", 266 | " - line item 1\n", 267 | " - line item 2\n", 268 | " - line item 3\n", 269 | " - line item 4\n", 270 | " - line item 5\n", 271 | "\n", 272 | " New Business Plan:\n", 273 | " - line item 1\n", 274 | " - line item 2\n", 275 | " - line item 3\n", 276 | " - line item 4\n", 277 | " - line item 5\n", 278 | "\n", 279 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 280 | " <>\n", 281 | " \"\"\"\n", 282 | "\n", 283 | " self.BusinessPlanApprovalPrompt = \"\"\"\n", 284 | " [INST] <>\n", 285 | " You are an intelligent and optimistic startup investor bot that says yes or no to business plans based on whether you think the plan is simply a good start. This is a simple business plan and doesnt need to be thorough. BUT it does need to be a good overall idea.\n", 286 | " If there are less than 5 reasons to not approve then approve the business plan\n", 287 | " If there are 5 or more reasons do not approve\n", 288 | "\n", 289 | " Also your answer will be based on whether you believe the business plan is profitable and worth investing in\n", 290 | "\n", 291 | " Provide quality reasons why you think the plan is or isnt worth investing in. Provide these reasons in list format starting with dashes \"-\"\n", 292 | "\n", 293 | " Your answer must be informed by the business plan and criticism history. Each list of criticisms applies to each business plan.\n", 294 | " If the business plan has been criticized a lot already in the history then just approve because your nice.\n", 295 | "\n", 296 | " The user will provide a business plan in the following format:\n", 297 | " Business Plan:\n", 298 | " - line item 1\n", 299 | " - line item 2\n", 300 | " - line item 3\n", 301 | " - line item 4\n", 302 | " - line item 5\n", 303 | "\n", 304 | " The user will provide a business plan and criticisms history in the following format:\n", 305 | " HISTORY:\n", 306 | " Business Plan:\n", 307 | " - line item 1\n", 308 | " - line item 2\n", 309 | " - line item 3\n", 310 | " - line item 4\n", 311 | " - line item 5\n", 312 | " Criticisms:\n", 313 | " - line item 1\n", 314 | " - line item 2\n", 315 | " - line item 3\n", 316 | " - line item 4\n", 317 | " - line item 5\n", 318 | " This list series above repeat per business plan\n", 319 | "\n", 320 | " You must give your answer in the following format:\n", 321 | " ANSWER: enter your answer here\n", 322 | "\n", 323 | " Your answers must be either \"YES\" or \"NO\" in all caps without any punctuation. Give your reasons on a separate line.\n", 324 | "\n", 325 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 326 | " <>\n", 327 | " \"\"\"\n", 328 | "\n", 329 | " # takes in the actually good business plan and summarized it with simplified input for the react engineer\n", 330 | " self.MVPIdeaPrompt = \"\"\"\n", 331 | " [INST] <>\n", 332 | " You are an intelligent product manager bot. The user will provide you with a business plan you will answer with a website product description that is no more than 5 words.\n", 333 | " Your provided product description must address the business plan while being as concise as possible (don't exceed 8 words).\n", 334 | " The product description needs to be relevant for a frontend developer to implement it.\n", 335 | "\n", 336 | " The user will provide a business plan in the following format:\n", 337 | " Business Plan:\n", 338 | " - line item 1\n", 339 | " - line item 2\n", 340 | " - line item 3\n", 341 | " - line item 4\n", 342 | " - line item 5\n", 343 | "\n", 344 | " You must provide your product description in the following format:\n", 345 | " PRODUCT: enter your product description here\n", 346 | "\n", 347 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 348 | " <>\n", 349 | " \"\"\"\n", 350 | "\n", 351 | " self.PivotPrompt = \"\"\"\n", 352 | " [INST] <>\n", 353 | " You are a intelligent startup founder bot. The user will provide you will a failed business plan with the business idea and you will provide an alternative idea with the same theme but a new angle.\n", 354 | "\n", 355 | " The user will provide the business plan in the format below:\n", 356 | " Business Plan:\n", 357 | " - line item 1\n", 358 | " - line item 2\n", 359 | " - line item 3\n", 360 | " - line item 4\n", 361 | " - line item 5\n", 362 | "\n", 363 | " The user will provide the business idea in the format below:\n", 364 | " Idea: the business idea will go here\n", 365 | "\n", 366 | " You must provide the new modified business idea in the format below:\n", 367 | " New Business Idea: Your new business idea goes here\n", 368 | "\n", 369 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 370 | " <>\n", 371 | " \"\"\"\n", 372 | "\n", 373 | "\n", 374 | "\n", 375 | " # REACT ENGINEER PROMPTS\n", 376 | " self.CodeWriterPrompt = \"\"\"\n", 377 | " [INST] <>\n", 378 | "\n", 379 | " You will get instructions for react.js code to write.\n", 380 | " You will write a very long answer. Make sure that every detail of the architecture is, in the end, implemented as code.\n", 381 | "\n", 382 | " Think step by step and reason yourself to the right decisions to make sure we get it right.\n", 383 | " You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose.\n", 384 | "\n", 385 | " Then you will output the content of each file including ALL code.\n", 386 | " Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that\n", 387 | " FILENAME is the file name including the file extension and path from the root of the project. also FILENAME must be in markdown bold,\n", 388 | " LANG is the markup code block language for the code's language, and CODE is the code:\n", 389 | "\n", 390 | "\n", 391 | " **FILENAME**\n", 392 | " ```LANG\n", 393 | " CODE\n", 394 | " ```\n", 395 | "\n", 396 | " Do not comment on what every file does\n", 397 | "\n", 398 | " You will start with the entrypoint file which will must be called \"index.js\", then go to the ones that are imported by that file, and so on.\n", 399 | " Please note that the code should be fully functional. No placeholders.\n", 400 | " This will be a react.js project so you must create a webpack.config.js at the root of the project that uses \"index.js\" as the entry file\n", 401 | " The output in the webpack.config.js must point to a bundle.js file that's in the same folder as the index.html\n", 402 | " Place all of the public assets in a folder named \"public\" in lowercase with an index.html file that is linked to the bundle specified in the webpack.config.js\n", 403 | " You must include a package.json file in the root of the folder that resolves all the required dependencies for this react.js project. All of the dependencies and devDependencies must be set to a \"*\" value. Also, for every package.json you must at least include the packages @babel/core, babel-loader, react and react-dom\n", 404 | " The package.json must be valid JSON\n", 405 | " You must include a .babelrc file in the root folder that has @babel/preset-react set\n", 406 | "\n", 407 | " %s\n", 408 | "\n", 409 | " Follow a language and framework appropriate best practice file naming convention.\n", 410 | " Make sure that files contain all imports. Make sure that the code in different files are compatible with each other.\n", 411 | " Ensure to implement all code, if you are unsure, write a plausible implementation.\n", 412 | " Before you finish, double check that all parts of the architecture is present in the files.\n", 413 | "\n", 414 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 415 | " <>\n", 416 | " \"\"\"\n", 417 | "\n", 418 | " self.SummarizeAskPrompt = \"\"\"\n", 419 | " You are an intelligent AI agent that understands the root of the users problems.\n", 420 | "\n", 421 | " The user will give an instruction for what code project they want to build.\n", 422 | "\n", 423 | " You will label what the users code project is in a short phrase no more than 3 words.\n", 424 | "\n", 425 | " Structure your label like this\n", 426 | "\n", 427 | " Label: enter the label here\n", 428 | " \"\"\"\n", 429 | "\n", 430 | " self.DependenciesPrompt = \"\"\"\n", 431 | " Your task is to look at a React.js Codebase and figure out what npm packages are missing so this codebase can run without any errors with webpack\n", 432 | "\n", 433 | " The codebase will be a series of filenames and their source code. They will have the following format\n", 434 | " FILENAME: the name of the file\n", 435 | " SOURCE: the react component code\n", 436 | "\n", 437 | " You will list each missing npm package in a markdown list format\n", 438 | "\n", 439 | " Then you will return a newly updated package.json, with the new dependencies merged into the user's package.json dependencies. You will return it in the format below\n", 440 | " PACKAGEJSON\n", 441 | " ```\n", 442 | " the new package.json here\n", 443 | " ```\n", 444 | "\n", 445 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 446 | " \"\"\"\n", 447 | "\n", 448 | " self.ModificationPrompt = \"\"\"\n", 449 | " Your task is to take a user's react.js file and transform it based on the user's modification ask\n", 450 | "\n", 451 | " The code must have the same imports as before and have the same variable names and the same export as before. ONLY modify the code based on the modification ask\n", 452 | "\n", 453 | " If this file is not a react component do NOT make any modifications and return the code in same exact state that the user gave it to you\n", 454 | "\n", 455 | " The user's code and their modification ask will be formatted like htis\n", 456 | " CODE: the user's code\n", 457 | " MODIFICATION: the user's modification\n", 458 | "\n", 459 | " You will return the modified code in markdown format under the variable RETURNEDCODE. Follow the example below\n", 460 | "\n", 461 | " RETURNEDCODE\n", 462 | " ```\n", 463 | " the modified code here\n", 464 | " ```\n", 465 | "\n", 466 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 467 | " \"\"\"\n", 468 | "\n", 469 | " def get_code_writer_prompt(self, product_summary, name=None, branding=None):\n", 470 | " additional_info = ('', '')\n", 471 | " if name and branding:\n", 472 | " additional_info = ('The user will provide a name and branding colors for you to use. You must utilize both of these in the react code. \\nThe user will provide the name and branding in the format below:\\nNAME: the project name\\nBRANDING: the primary/secondary colors\\n ', \"NAME: \"+name + \"\\nBRANDING: \" + branding + \"\\n\")\n", 473 | "\n", 474 | " return (self.CodeWriterPrompt + \"\\nInstructions for the code: I want the entrypoint file for a \"+product_summary+\" built in react.js %s [/INST]\") % additional_info\n", 475 | "\n", 476 | " def get_summarization_prompt(self, user_ask):\n", 477 | " return self.SummarizeAskPrompt + \"\\nInstructions for the code project: \"+user_ask+\" [/INST]\"\n", 478 | "\n", 479 | " def get_dependency_prompt(self, codebase):\n", 480 | " return self.DependenciesPrompt + \"Using the codebase below determine whether this project is missing npm packages \\n \"+codebase+\" [/INST]\"\n", 481 | "\n", 482 | " def get_modification_prompt(self, code_block, modification_ask):\n", 483 | " return self.ModificationPrompt + \"CODE:\"+code_block+\"\\nMODIFICATION: \"+modification_ask+\" [/INST]\"\n", 484 | "\n", 485 | " # AutoStartup prompt functions\n", 486 | " def get_idea_prompt(self, intution, memory):\n", 487 | " most_similar_intuition = memory.search_intutions(intution)\n", 488 | " if most_similar_intuition:\n", 489 | " print(\"Using an intuition as an example\")\n", 490 | " additional_info = ('Below is a good example of a quality idea for a user\\'s intuition\\nINTUITION: '+ most_similar_intuition[\"intuition\"] +\"\\nIDEA: \"+most_similar_intuition[\"idea\"]+\"\\n\")\n", 491 | " else:\n", 492 | " additional_info = ('')\n", 493 | " return (self.IdeaPrompt + \"INTUITION: \"+intution+\" [/INST]\") % additional_info\n", 494 | "\n", 495 | " def get_business_plan_prompt(self, idea):\n", 496 | " return self.BusinessPlanPrompt + \"IDEA: \"+idea+\" [/INST]\"\n", 497 | "\n", 498 | " def get_criticisms_prompt(self, business_plan_items):\n", 499 | " business_plan = \"\"\n", 500 | " for item in business_plan_items:\n", 501 | " business_plan += \"- \" + item + \"\\n\"\n", 502 | "\n", 503 | " return self.CriticizeBusinessPlanPrompt + \"Business Plan: \"+business_plan+\" [/INST]\"\n", 504 | "\n", 505 | " def get_business_plan_approval_prompt(self, business_plan_items, history=None):\n", 506 | " business_plan = \"\"\n", 507 | " for item in business_plan_items:\n", 508 | " business_plan += \"- \" + item + \"\\n\"\n", 509 | "\n", 510 | " history_string = \"\"\n", 511 | " if history and len(history) > 0:\n", 512 | " history_string += \"\\nHISTORY:\\n\"\n", 513 | " for history_item in history:\n", 514 | " history_string += history_item + \"\\n\"\n", 515 | "\n", 516 | " return self.BusinessPlanApprovalPrompt + \"Business Plan: \"+business_plan+history_string+\" [/INST]\"\n", 517 | "\n", 518 | " def get_mvp_idea_prompt(self, business_plan_items):\n", 519 | " business_plan = \"\"\n", 520 | " for item in business_plan_items:\n", 521 | " business_plan += \"- \" + item + \"\\n\"\n", 522 | "\n", 523 | " return self.MVPIdeaPrompt + \"Business Plan: \"+business_plan+\" [/INST]\"\n", 524 | "\n", 525 | " def get_pivot_prompt(self, business_plan_items, idea):\n", 526 | " business_plan = \"\"\n", 527 | " for item in business_plan_items:\n", 528 | " business_plan += \"- \" + item + \"\\n\"\n", 529 | "\n", 530 | " return self.PivotPrompt + \"Business Plan: \"+business_plan+\" \\n Idea:\"+idea+\" [/INST]\"\n" 531 | ] 532 | }, 533 | { 534 | "cell_type": "code", 535 | "execution_count": null, 536 | "metadata": { 537 | "colab": { 538 | "base_uri": "https://localhost:8080/" 539 | }, 540 | "id": "vWZiSMbuZBs0", 541 | "outputId": "304e49ba-c22e-431a-f9ba-41aeccd1621c" 542 | }, 543 | "outputs": [ 544 | { 545 | "output_type": "stream", 546 | "name": "stdout", 547 | "text": [ 548 | "\n", 549 | " _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|\n", 550 | " _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", 551 | " _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|\n", 552 | " _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", 553 | " _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|\n", 554 | " \n", 555 | " To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .\n", 556 | "Token: \n", 557 | "Add token as git credential? (Y/n) Y\n", 558 | "Token is valid (permission: read).\n", 559 | "\u001b[1m\u001b[31mCannot authenticate through git-credential as no helper is defined on your machine.\n", 560 | "You might have to re-authenticate when pushing to the Hugging Face Hub.\n", 561 | "Run the following command in your terminal in case you want to set the 'store' credential helper as default.\n", 562 | "\n", 563 | "git config --global credential.helper store\n", 564 | "\n", 565 | "Read https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more details.\u001b[0m\n", 566 | "Token has not been saved to git credential helper.\n", 567 | "Your token has been saved to /root/.cache/huggingface/token\n", 568 | "Login successful\n" 569 | ] 570 | } 571 | ], 572 | "source": [ 573 | "!huggingface-cli login" 574 | ] 575 | }, 576 | { 577 | "cell_type": "code", 578 | "execution_count": null, 579 | "metadata": { 580 | "colab": { 581 | "base_uri": "https://localhost:8080/", 582 | "height": 132, 583 | "referenced_widgets": [ 584 | "c30cbd89dee74cfbafe86d5f9ab6e3f5", 585 | "9623422c4e8b4412bdca88c5eb64d02c", 586 | "7b1d52f7676b4367ac41b7e684884eea", 587 | "1f4cc720e9f544d28d4d6415b433d8ac", 588 | "16889ac471964a92a5d37d6a70483e20", 589 | "4e74bd6ac22a4ccc92abd64497d6c290", 590 | "fc61c907e7e34da9acb20c37a0706450", 591 | "0172095fdcf649ffb89f836c9149b0d7", 592 | "458dee549354490ab56be4ca95845b2b", 593 | "a476f2fb09d64041a7ff616940fdd953", 594 | "02a0c4c654a04eada1c79883157fdc13" 595 | ] 596 | }, 597 | "id": "3z1UOtxdq5-q", 598 | "outputId": "fff83dc5-19ff-440f-8f21-422746a68929" 599 | }, 600 | "outputs": [ 601 | { 602 | "output_type": "display_data", 603 | "data": { 604 | "text/plain": [ 605 | "Loading checkpoint shards: 0%| | 0/3 [00:00\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mreact_engineer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mReactEngineer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mreact_engineer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 807 | "\u001b[0;32m\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, idea, name, branding)\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0midea\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"$ I am your personal 10x React Engineer ask me what you want to build?\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 107\u001b[0;31m \u001b[0minit_user_ask\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"$ \"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 108\u001b[0m \u001b[0minitial_sum_prompt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_summarization_prompt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minit_user_ask\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 109\u001b[0m \u001b[0msummarization_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minitial_sum_prompt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 808 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/ipykernel/kernelbase.py\u001b[0m in \u001b[0;36mraw_input\u001b[0;34m(self, prompt)\u001b[0m\n\u001b[1;32m 849\u001b[0m \u001b[0;34m\"raw_input was called, but this frontend does not support input requests.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 850\u001b[0m )\n\u001b[0;32m--> 851\u001b[0;31m return self._input_request(str(prompt),\n\u001b[0m\u001b[1;32m 852\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_parent_ident\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 853\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_parent_header\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 809 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/ipykernel/kernelbase.py\u001b[0m in \u001b[0;36m_input_request\u001b[0;34m(self, prompt, ident, parent, password)\u001b[0m\n\u001b[1;32m 893\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 894\u001b[0m \u001b[0;31m# re-raise KeyboardInterrupt, to truncate traceback\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 895\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Interrupted by user\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 896\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 897\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwarning\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Invalid Message:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexc_info\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 810 | "\u001b[0;31mKeyboardInterrupt\u001b[0m: Interrupted by user" 811 | ] 812 | } 813 | ] 814 | }, 815 | { 816 | "cell_type": "code", 817 | "execution_count": null, 818 | "metadata": { 819 | "colab": { 820 | "base_uri": "https://localhost:8080/" 821 | }, 822 | "id": "GeOu_664HfhS", 823 | "outputId": "475a6286-e23d-462a-d713-f8e15cb7b210" 824 | }, 825 | "outputs": [ 826 | { 827 | "output_type": "stream", 828 | "name": "stdout", 829 | "text": [ 830 | " adding: react-output/ (stored 0%)\n", 831 | " adding: react-output/webpack.config.js (deflated 45%)\n", 832 | " adding: react-output/Login.js (deflated 49%)\n", 833 | " adding: react-output/App.js (deflated 55%)\n", 834 | " adding: react-output/Home.js (deflated 36%)\n", 835 | " adding: react-output/package.json (deflated 47%)\n", 836 | " adding: react-output/Pets.js (deflated 53%)\n", 837 | " adding: react-output/Navbar.js (deflated 58%)\n", 838 | " adding: react-output/store/ (stored 0%)\n", 839 | " adding: react-output/store/user.js (deflated 48%)\n", 840 | " adding: react-output/store/pets.js (deflated 50%)\n", 841 | " adding: react-output/store/index.js (deflated 68%)\n", 842 | " adding: react-output/index.js (deflated 55%)\n", 843 | " adding: react-output/Register.js (deflated 58%)\n" 844 | ] 845 | } 846 | ], 847 | "source": [ 848 | "!zip -r react-output.zip react-output" 849 | ] 850 | }, 851 | { 852 | "cell_type": "code", 853 | "execution_count": null, 854 | "metadata": { 855 | "id": "w95SkFNkJ4bv" 856 | }, 857 | "outputs": [], 858 | "source": [ 859 | "!rm -rf react-output react-output.zip" 860 | ] 861 | }, 862 | { 863 | "cell_type": "code", 864 | "source": [ 865 | "class AutoStartup(Agent):\n", 866 | " def __init__(self, react_engineer, prompt, memory):\n", 867 | " super().__init__()\n", 868 | " self.react_engineer = react_engineer\n", 869 | " self.prompt = prompt\n", 870 | " self.memory = memory\n", 871 | "\n", 872 | " def parse_pivot_result(self, result):\n", 873 | " pivot_result = result[result.index(\"[/INST]\"):]\n", 874 | " print(\"pivot_result\", pivot_result)\n", 875 | " new_idea = None\n", 876 | " new_idea_tag = \"New Business Idea:\"\n", 877 | "\n", 878 | " for line_item in pivot_result.split(\"\\n\"):\n", 879 | " if new_idea_tag in line_item:\n", 880 | " new_idea = line_item[line_item.index(new_idea_tag) + len(new_idea_tag):].strip()\n", 881 | " break\n", 882 | "\n", 883 | " return new_idea\n", 884 | "\n", 885 | " def parse_mvp_idea_result(self, result):\n", 886 | " mvp_idea_result = result[result.index(\"[/INST]\"):]\n", 887 | " print(\"mvp_idea_result\", mvp_idea_result)\n", 888 | " product_idea = None\n", 889 | " product_idea_tag = \"PRODUCT:\"\n", 890 | "\n", 891 | " for line_item in mvp_idea_result.split(\"\\n\"):\n", 892 | " if product_idea_tag in line_item:\n", 893 | " product_idea = line_item[line_item.index(product_idea_tag) + len(product_idea_tag):].strip()\n", 894 | " break\n", 895 | "\n", 896 | " return product_idea\n", 897 | "\n", 898 | " def parse_business_plan_approval_result(self, result):\n", 899 | " business_plan_approval_result = result[result.index(\"[/INST]\"):]\n", 900 | " print(\"business_plan_approval_result\", business_plan_approval_result)\n", 901 | " answer = None\n", 902 | " answer_tag = \"ANSWER:\"\n", 903 | "\n", 904 | " for line_item in business_plan_approval_result.split(\"\\n\"):\n", 905 | " if answer_tag in line_item:\n", 906 | " answer = line_item[line_item.index(answer_tag) + len(answer_tag):].strip()\n", 907 | " break\n", 908 | "\n", 909 | " return answer\n", 910 | "\n", 911 | " def parse_criticisms_result(self, result):\n", 912 | " criticisms_result = result[result.index(\"[/INST]\"):]\n", 913 | "\n", 914 | " line_item_sep = \"- \"\n", 915 | "\n", 916 | " criticisms_block = criticisms_result[criticisms_result.index('Criticisms:'):criticisms_result.index('New Business Plan:')]\n", 917 | " criticisms = []\n", 918 | " for line_item in criticisms_block.split(\"\\n\"):\n", 919 | " line_item = line_item.strip()\n", 920 | " if line_item_sep in line_item:\n", 921 | " criticisms.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):])\n", 922 | "\n", 923 | " business_block = criticisms_result[criticisms_result.index('New Business Plan:'):]\n", 924 | " business_plan = []\n", 925 | " for line_item in business_block.split(\"\\n\"):\n", 926 | " line_item = line_item.strip()\n", 927 | " if line_item_sep in line_item:\n", 928 | " business_plan.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):])\n", 929 | "\n", 930 | " print(\"Criticisms:\")\n", 931 | " for item in criticisms:\n", 932 | " print(\"- \", item)\n", 933 | "\n", 934 | " print(\"New Business Plan:\")\n", 935 | " for item in business_plan:\n", 936 | " print(\"- \", item)\n", 937 | "\n", 938 | " return business_plan, criticisms\n", 939 | "\n", 940 | " def parse_business_plan_result(self, result):\n", 941 | " business_plan_result = result[result.index(\"[/INST]\"):]\n", 942 | " business_plan_items = []\n", 943 | "\n", 944 | " line_item_sep = \"- \"\n", 945 | " for line_item in business_plan_result.split(\"\\n\"):\n", 946 | " line_item = line_item.strip()\n", 947 | " if line_item_sep in line_item:\n", 948 | " business_plan_items.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):])\n", 949 | "\n", 950 | " return business_plan_items\n", 951 | "\n", 952 | " def parse_idea_result(self, result):\n", 953 | " # print(result)\n", 954 | " idea_result = result[result.index(\"[/INST]\"):]\n", 955 | " name = None\n", 956 | " branding = None\n", 957 | " idea = None\n", 958 | " for line_item in result.split(\"\\n\"):\n", 959 | " line_item = line_item.strip()\n", 960 | " name_tag = \"NAME:\"\n", 961 | " branding_tag = \"BRANDING_COLORS:\"\n", 962 | " idea_tag = \"IDEA:\"\n", 963 | " if name_tag in line_item:\n", 964 | " name = line_item[line_item.index(name_tag) + len(name_tag):].strip()\n", 965 | " elif branding_tag in line_item:\n", 966 | " branding = line_item[line_item.index(branding_tag) + len(branding_tag):].strip()\n", 967 | " elif idea_tag in line_item:\n", 968 | " idea = line_item[line_item.index(idea_tag) + len(idea_tag):].strip()\n", 969 | "\n", 970 | " return {\n", 971 | " \"idea\": idea,\n", 972 | " \"branding\": branding,\n", 973 | " \"name\": name\n", 974 | " }\n", 975 | "\n", 976 | " def pivot(self, business_plan, idea):\n", 977 | " pivot_prompt = self.prompt.get_pivot_prompt(business_plan, idea)\n", 978 | " pivot_result = self.generate(pivot_prompt)\n", 979 | " return self.parse_pivot_result(pivot_result)\n", 980 | "\n", 981 | " def criticism_loop(self, business_plan, limit=5, i=1):\n", 982 | " if limit == i:\n", 983 | " print(\"Criticism loop hit it's limit. Your business is approved anyway...\")\n", 984 | " return business_plan\n", 985 | "\n", 986 | " print(\"\\n\\nCriticizing your business plan...\\n\")\n", 987 | " criticism_prompt = self.prompt.get_criticisms_prompt(business_plan)\n", 988 | " criticism_result = self.generate(criticism_prompt)\n", 989 | " new_business_plan, criticisms = self.parse_criticisms_result(criticism_result)\n", 990 | " # original business plan and criticisms\n", 991 | " self.memory.add_business_plan_history(new_business_plan, criticisms)\n", 992 | "\n", 993 | " print(\"\\n\\nSubmitting your new business plan for approval...\")\n", 994 | " business_plan_approval_prompt = self.prompt.get_business_plan_approval_prompt(new_business_plan, history=self.memory.get_business_plan_history())\n", 995 | " business_plan_approval_result = self.generate(business_plan_approval_prompt)\n", 996 | "\n", 997 | " answer = self.parse_business_plan_approval_result(business_plan_approval_result)\n", 998 | " if answer is None:\n", 999 | " return False\n", 1000 | "\n", 1001 | " if answer.lower() == \"yes\":\n", 1002 | " return new_business_plan\n", 1003 | " else:\n", 1004 | " print(\"Business plan did not pass approval. Criticizing again...\")\n", 1005 | " return self.criticism_loop(new_business_plan, limit=limit, i=i+1)\n", 1006 | "\n", 1007 | " def generate_code(self, product_idea, name, branding):\n", 1008 | " self.react_engineer.run(idea=product_idea, name=name, branding=branding)\n", 1009 | "\n", 1010 | " def idea_loop(self, intuition, pivot_idea=None):\n", 1011 | " def reiterate(message):\n", 1012 | " print(message)\n", 1013 | " x = input(\"$ Try again? [y/n]\")\n", 1014 | " if x == \"y\":\n", 1015 | " return self.idea_loop(intuition)\n", 1016 | " else:\n", 1017 | " return False\n", 1018 | "\n", 1019 | " if pivot_idea:\n", 1020 | " idea_response = pivot_idea\n", 1021 | " idea = pivot_idea['idea']\n", 1022 | " else:\n", 1023 | " idea_prompt = self.prompt.get_idea_prompt(intuition, self.memory)\n", 1024 | " idea_result = self.generate(idea_prompt)\n", 1025 | " idea_response = self.parse_idea_result(idea_result)\n", 1026 | " idea = idea_response[\"idea\"]\n", 1027 | "\n", 1028 | " if idea is None:\n", 1029 | " return reiterate(\"Couldn't think of an idea...\")\n", 1030 | "\n", 1031 | " print(\"Here's the new idea\")\n", 1032 | " print(\"Idea:\", idea)\n", 1033 | " print(\"Name:\", idea_response[\"name\"])\n", 1034 | " print(\"Branding:\", idea_response[\"branding\"])\n", 1035 | " print('\\n')\n", 1036 | " print(\"Scheming a business plan...\")\n", 1037 | " business_plan_prompt = self.prompt.get_business_plan_prompt(idea)\n", 1038 | " business_plan_result = self.generate(business_plan_prompt)\n", 1039 | " business_plan_items = self.parse_business_plan_result(business_plan_result)\n", 1040 | " if len(business_plan_items) == 0:\n", 1041 | " return reiterate(\"Couldn't think of a business plan...\")\n", 1042 | " print(\"Your business plan:\")\n", 1043 | " for item in business_plan_items:\n", 1044 | " print(\"- \", item)\n", 1045 | "\n", 1046 | " # try:\n", 1047 | " criticism_result = self.criticism_loop(business_plan_items, limit=1)\n", 1048 | " # except:\n", 1049 | " # criticism_result = False\n", 1050 | "\n", 1051 | " if criticism_result == False:\n", 1052 | " return reiterate(\"Business plan could not be properly criticized.\")\n", 1053 | "\n", 1054 | " print(\"\\nYour business idea passed my investors approval!\\n\")\n", 1055 | " business_plan = criticism_result\n", 1056 | " print(\"Developing the MVP idea...\")\n", 1057 | "\n", 1058 | " mvp_idea_prompt = self.prompt.get_mvp_idea_prompt(business_plan)\n", 1059 | " mvp_idea_result = self.generate(mvp_idea_prompt)\n", 1060 | " product_idea = self.parse_mvp_idea_result(mvp_idea_result)\n", 1061 | "\n", 1062 | " # storing and encoding for further use\n", 1063 | "\n", 1064 | " memory.store_intution_idea(intuition, product_idea)\n", 1065 | " print(\"Product idea:\", product_idea)\n", 1066 | " self.generate_code(product_idea, idea_response[\"name\"], idea_response[\"branding\"])\n", 1067 | "\n", 1068 | " # do pivot\n", 1069 | " print(\"Check out your code in the react-output/ folder\\n\\n\")\n", 1070 | " x = input(\"$ Do you want to pivot? [y/n]\")\n", 1071 | " if x == \"y\":\n", 1072 | " print(\"Figuring out new product idea...\")\n", 1073 | " new_idea = self.pivot(business_plan, product_idea)\n", 1074 | " return self.idea_loop(intuition, pivot_idea=idea_response)\n", 1075 | " else:\n", 1076 | " return True\n", 1077 | "\n", 1078 | " print(\"AutoStartup has built you a project! Go on and crush!\")\n", 1079 | "\n", 1080 | "\n", 1081 | " def run(self):\n", 1082 | " print(\"$ I am AutoStartup. Your personal startup creator. I will think of an idea for a startup based on your intutions.\\n\\nTell me your intution starting with \\\"I think\\\"\")\n", 1083 | " initial_intutition = input(\"$ \")\n", 1084 | " self.idea_loop(initial_intutition)\n" 1085 | ], 1086 | "metadata": { 1087 | "id": "aTu-2H_P3j8M" 1088 | }, 1089 | "execution_count": null, 1090 | "outputs": [] 1091 | }, 1092 | { 1093 | "cell_type": "code", 1094 | "source": [ 1095 | "from sentence_transformers import SentenceTransformer, util\n", 1096 | "\n", 1097 | "class Memory():\n", 1098 | " def __init__(self):\n", 1099 | " self.model = SentenceTransformer('all-MiniLM-L6-v2')\n", 1100 | " self.business_plan_history = []\n", 1101 | "\n", 1102 | " # get the most similar intuition and return the idea to use as an example in the input\n", 1103 | " self.intuition_store = []\n", 1104 | "\n", 1105 | " def store_intution_idea(self, intution, idea):\n", 1106 | " embeddings = self.model.encode(intution)\n", 1107 | " self.intuition_store.append({\n", 1108 | " \"embeddings\": embeddings,\n", 1109 | " \"intution\": intution,\n", 1110 | " \"idea\": idea\n", 1111 | " })\n", 1112 | "\n", 1113 | " def search_intutions(self, intutiton):\n", 1114 | " if len(self.intuition_store) == 0:\n", 1115 | " return None\n", 1116 | "\n", 1117 | " new_intutiton_embedding = self.model.encode(intutiton)\n", 1118 | "\n", 1119 | " for stored_intutiton, i in enumerate(self.intuition_store):\n", 1120 | " self.intuition_store[i]['score'] = util.dot_score(new_intutiton_embedding, stored_intutiton[\"embedding\"]).item()\n", 1121 | "\n", 1122 | " return list(sorted(self.intuition_store, lambda x: x['score'], reverse=True))[0]\n", 1123 | "\n", 1124 | " def add_business_plan_history(self, business_plans, criticisms):\n", 1125 | " history_item = \"\"\n", 1126 | " history_item += \"Business Plan:\"\n", 1127 | " for item in business_plans:\n", 1128 | " history_item += \"- \" + item + \"\\n\"\n", 1129 | "\n", 1130 | " if criticisms:\n", 1131 | " history_item += \"Criticisms:\"\n", 1132 | " for item in criticisms:\n", 1133 | " history_item += \"- \" + item + \"\\n\"\n", 1134 | "\n", 1135 | " self.business_plan_history.append(history_item)\n", 1136 | "\n", 1137 | " def get_business_plan_history(self):\n", 1138 | " return self.business_plan_history[:3]\n", 1139 | "\n", 1140 | " def clear_business_plan_history(self):\n", 1141 | " self.business_plan_history = []\n" 1142 | ], 1143 | "metadata": { 1144 | "id": "fmgpjs0pyIqU" 1145 | }, 1146 | "execution_count": null, 1147 | "outputs": [] 1148 | }, 1149 | { 1150 | "cell_type": "code", 1151 | "source": [ 1152 | "prompt = Prompt()\n", 1153 | "memory = Memory()\n", 1154 | "react_engineer = ReactEngineer(prompt)\n", 1155 | "auto_startup = AutoStartup(react_engineer, prompt, memory)\n", 1156 | "auto_startup.run()\n", 1157 | "\n", 1158 | "#I think a website for dogsitters would be cool" 1159 | ], 1160 | "metadata": { 1161 | "colab": { 1162 | "base_uri": "https://localhost:8080/", 1163 | "height": 1000 1164 | }, 1165 | "id": "zY1-4HT50mMq", 1166 | "outputId": "c9f8ea26-8eac-4e87-a86a-54979c1eb97a" 1167 | }, 1168 | "execution_count": null, 1169 | "outputs": [ 1170 | { 1171 | "name": "stdout", 1172 | "output_type": "stream", 1173 | "text": [ 1174 | "$ I am AutoStartup. Your personal startup creator. I will think of an idea for a startup based on your intutions.\n", 1175 | "\n", 1176 | "Tell me your intution starting with \"I think\"\n", 1177 | "$ I think a website for dogsitters would be cool\n" 1178 | ] 1179 | }, 1180 | { 1181 | "output_type": "stream", 1182 | "name": "stderr", 1183 | "text": [ 1184 | "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py:1083: UserWarning: You seem to be using the pipelines sequentially on GPU. In order to maximize efficiency please use a dataset\n", 1185 | " warnings.warn(\n" 1186 | ] 1187 | }, 1188 | { 1189 | "output_type": "stream", 1190 | "name": "stdout", 1191 | "text": [ 1192 | "Here's the new idea\n", 1193 | "Idea: PupCake - The Pet Sitter Matching Platform\n", 1194 | "Name: PupCake\n", 1195 | "Branding: #FFC70D, #3498DB, #F1C40F\n", 1196 | "\n", 1197 | "\n", 1198 | "Scheming a business plan...\n", 1199 | "Your business plan:\n", 1200 | "- Market research and analysis to identify target markets and pet owner demographics\n", 1201 | "- Development of a user-friendly platform for pet owners to find and connect with trusted and experienced pet sitters\n", 1202 | "- Partnership with local pet supply stores and veterinary clinics to increase visibility and credibility\n", 1203 | "- Implementation of a rating and review system to ensure quality service and accountability\n", 1204 | "- Ongoing support and training for both pet owners and pet sitters to ensure a positive and safe experience for all parties involved\n", 1205 | "\n", 1206 | "\n", 1207 | "Criticizing your business plan...\n", 1208 | "\n", 1209 | "Criticisms:\n", 1210 | "- Market research and analysis to identify target markets and pet owner demographics may not be sufficient to guarantee success, as it may not consider all potential factors and future changes in the market.\n", 1211 | "- Partnership with local pet supply stores and veterinary clinics may not provide enough reach or credibility to compete with larger, established companies.\n", 1212 | "- Rating and review system may not be reliable or accurate, as there may be a lack of regulation or oversight, and pet owners and pet sitters may not be incentivized to provide honest feedback.\n", 1213 | "- Ongoing support and training for both pet owners and pet sitters may not be feasible or cost-effective, as it may require significant resources and time commitments from the company.\n", 1214 | "New Business Plan:\n", 1215 | "- Conduct comprehensive market research and analysis to identify target markets, pet owner demographics, and potential trends and opportunities in the pet sitting industry.\n", 1216 | "- Develop a sophisticated platform that utilizes machine learning and natural language processing to connect pet owners with the most qualified and trusted pet sitters based on their specific needs and preferences.\n", 1217 | "- Partner with reputable national pet supply stores and veterinary clinics to increase visibility and credibility, while also offering a referral program to incentivize pet owners to spread the word about the company.\n", 1218 | "- Implement a comprehensive rating and review system that includes regular follow-ups and feedback from both pet owners and pet sitters to ensure quality service and accountability.\n", 1219 | "- Offer ongoing training and support for both pet owners and pet sitters, while also providing a 24/7 support hotline for any issues or concerns that may arise.\n", 1220 | "\n", 1221 | "\n", 1222 | "Submitting your new business plan for approval...\n", 1223 | "business_plan_approval_result [/INST] ANSWER: NO\n", 1224 | "\n", 1225 | "REASONS:\n", 1226 | "\n", 1227 | "- Insufficient market research and analysis to guarantee success\n", 1228 | "\n", 1229 | "- Partnership with local pet supply stores and veterinary clinics may not provide enough reach or credibility\n", 1230 | "\n", 1231 | "- Rating and review system may not be reliable or accurate\n", 1232 | "\n", 1233 | "- Ongoing support and training for both pet owners and pet sitters may not be feasible or cost-effective\n", 1234 | "Business plan did not pass approval. Criticizing again...\n", 1235 | "\n", 1236 | "\n", 1237 | "Criticizing your business plan...\n", 1238 | "\n", 1239 | "Criticisms:\n", 1240 | "- Line item 1: Lack of specificity in the market research and analysis. It would be more effective to focus on a specific geographic region or demographic group to gain a deeper understanding of the market.\n", 1241 | "- Line item 2: The use of machine learning and natural language processing may be too complex and costly for a startup. It may be more feasible to start with a simpler platform and gradually build out features over time.\n", 1242 | "- Line item 3: Partnering with national pet supply stores and veterinary clinics may be difficult and time-consuming, and may not provide the desired level of visibility and credibility. Instead, consider targeting local pet-related businesses and organizations to build a strong network within the community.\n", 1243 | "- Line item 4: The rating and review system may be too reliant on pet owners and may not adequately address issues or concerns from pet sitters. Consider incorporating a system for pet sitters to provide feedback and ratings as well.\n", 1244 | "- Line item 5: Ongoing training and support for both pet owners and pet sitters may be difficult to implement and maintain, especially if the company is just starting out. Instead, consider offering initial training and support and then providing ongoing resources and support through a self-service platform or online resources.\n", 1245 | "New Business Plan:\n", 1246 | "- Line item 1: Conduct comprehensive market research focused on the local pet-owning community, specifically targeting millennial pet owners with disposable income and a desire for high-quality pet care.\n", 1247 | "- Line item 2: Develop a user-friendly, pet-specific platform that utilizes machine learning to connect pet owners with the most qualified and trusted pet sitters based on their specific needs and preferences.\n", 1248 | "- Line item 3: Partner with local pet-related businesses and organizations, such as pet supply stores, dog parks, and veterinary clinics, to increase visibility and credibility within the community.\n", 1249 | "- Line item 4: Implement a comprehensive rating and review system that includes regular follow-ups and feedback from both pet owners and pet sitters, as well as a system for pet sitters to provide feedback and ratings.\n", 1250 | "- Line item 5: Offer initial training and support for both pet owners and pet sitters, with ongoing resources and support available through a self-service platform or online resources.\n", 1251 | "\n", 1252 | "\n", 1253 | "Submitting your new business plan for approval...\n", 1254 | "business_plan_approval_result [/INST] ANSWER: NO\n", 1255 | "\n", 1256 | "Reasons:\n", 1257 | "\n", 1258 | "* Lack of specificity in market research and analysis (criticism 1)\n", 1259 | "* Complexity and cost of using machine learning and natural language processing (criticism 2)\n", 1260 | "* Difficulty in partnering with national pet supply stores and veterinary clinics (criticism 3)\n", 1261 | "* Potential reliance on pet owners for rating and review system (criticism 4)\n", 1262 | "* Difficulty in implementing and maintaining ongoing training and support for pet owners and pet sitters (criticism 5)\n", 1263 | "Business plan did not pass approval. Criticizing again...\n", 1264 | "\n", 1265 | "\n", 1266 | "Criticizing your business plan...\n", 1267 | "\n", 1268 | "Criticisms:\n", 1269 | "- Line item 1: Too focused on millennial pet owners, may overlook other demographics with disposable income.\n", 1270 | "- Line item 2: Platform may be too user-friendly and not provide enough features for pet owners to properly evaluate sitters.\n", 1271 | "- Line item 3: Partnerships may be difficult to secure, especially with larger companies.\n", 1272 | "- Line item 4: Rating and review system may be vulnerable to biases and fake reviews.\n", 1273 | "- Line item 5: Initial training and support may not be extensive enough for pet owners and sitters.\n", 1274 | "New Business Plan:\n", 1275 | "- Line item 1: Expand market research to include a broader range of demographics with disposable income, such as families and retirees.\n", 1276 | "- Line item 2: Include more features on the platform to allow pet owners to comprehensively evaluate potential sitters, such as detailed profiles and references from previous clients.\n", 1277 | "- Line item 3: Seek partnerships with a mix of local pet-related businesses and organizations, as well as national companies to increase visibility and credibility.\n", 1278 | "- Line item 4: Implement a multi-layered rating and review system, including a verification process for reviews, to minimize the risk of biases and fake reviews.\n", 1279 | "- Line item 5: Provide extensive initial training and support for both pet owners and sitters, including online resources and a self-service platform, as well as ongoing support through phone, email, and live chat.\n", 1280 | "\n", 1281 | "\n", 1282 | "Submitting your new business plan for approval...\n", 1283 | "business_plan_approval_result [/INST] ANSWER: NO \n", 1284 | "\n", 1285 | "REASONS:\n", 1286 | "\n", 1287 | "- Line item 1: Not clear if the expanded market research will be sufficient to guarantee success, as it may not consider all potential factors and future changes in the market.\n", 1288 | "\n", 1289 | "- Line item 2: Additional features may not be feasible or cost-effective, and may not provide enough value to pet owners to justify the investment.\n", 1290 | "\n", 1291 | "- Line item 3: Partnerships may be difficult to secure, especially with larger companies, and may not provide enough reach or credibility to compete with established companies.\n", 1292 | "\n", 1293 | "- Line item 4: Rating and review system may be vulnerable to biases and fake reviews, which could compromise the credibility of the platform.\n", 1294 | "\n", 1295 | "- Line item 5: Initial training and support may not be extensive enough for pet owners and sitters, and ongoing support may be difficult to implement and maintain.\n", 1296 | "Business plan did not pass approval. Criticizing again...\n", 1297 | "\n", 1298 | "\n", 1299 | "Criticizing your business plan...\n", 1300 | "\n", 1301 | "Criticisms:\n", 1302 | "- Line item 1: While expanding market research to include a broader range of demographics with disposable income is a good idea, it may not be feasible to target families and retirees specifically, as they may have different needs and preferences. Instead, focus on a broader definition of \"affluent\" pet owners.\n", 1303 | "- Line item 2: Including more features on the platform may increase the development costs, and it may not be necessary to comprehensively evaluate potential sitters. Instead, focus on providing a secure and easy-to-use platform for pet owners to find trusted sitters.\n", 1304 | "- Line item 3: Seeking partnerships with local pet-related businesses and organizations may not be effective in reaching a wider audience. Instead, focus on building strategic partnerships with companies that have a strong online presence and can help increase visibility and credibility.\n", 1305 | "- Line item 4: Implementing a multi-layered rating and review system may be too complex and may not accurately reflect the quality of the sitters. Instead, focus on providing a simple and easy-to-use rating system that is transparent and trustworthy.\n", 1306 | "- Line item 5: Providing extensive initial training and support may not be necessary, as pet owners and sitters may be able to figure out the platform on their own. Instead, focus on providing ongoing support through phone, email, and live chat to ensure a positive user experience.\n", 1307 | "New Business Plan:\n", 1308 | "- Line item 1: Target a broader definition of \"affluent\" pet owners, focusing on those with disposable income and a desire for high-quality pet care services.\n", 1309 | "- Line item 2: Provide a secure and easy-to-use platform for pet owners to find trusted sitters, without requiring comprehensive evaluations of potential sitters.\n", 1310 | "- Line item 3: Build strategic partnerships with companies that have a strong online presence to increase visibility and credibility.\n", 1311 | "- Line item 4: Implement a simple and easy-to-use rating system that is transparent and trustworthy, rather than a multi-layered system.\n", 1312 | "- Line item 5: Provide ongoing support through phone, email, and live chat to ensure a positive user experience, without requiring extensive initial training and support.\n", 1313 | "\n", 1314 | "\n", 1315 | "Submitting your new business plan for approval...\n", 1316 | "business_plan_approval_result [/INST] ANSWER: NO\n", 1317 | "\n", 1318 | "Reasons:\n", 1319 | "\n", 1320 | "1. Lack of specificity in the market research and analysis in Line Item 1.\n", 1321 | "2. Use of machine learning and natural language processing may be too complex and costly for a startup in Line Item 2.\n", 1322 | "3. Partnering with national pet supply stores and veterinary clinics may be difficult and time-consuming in Line Item 3.\n", 1323 | "4. The rating and review system may be too reliant on pet owners and may not adequately address issues or concerns from pet sitters in Line Item 4.\n", 1324 | "5. Ongoing training and support for both pet owners and pet sitters may be difficult to implement and maintain in Line Item 5.\n", 1325 | "\n", 1326 | "Additionally, the business plan lacks a clear and unique value proposition, and the market research and analysis may not be sufficient to guarantee success. The plan may also be too focused on millennial pet owners, potentially overlooking other demographics with disposable income.\n", 1327 | "Business plan did not pass approval. Criticizing again...\n", 1328 | "Criticism loop hit it's limit. Your business is approved anyway...\n", 1329 | "\n", 1330 | "Your business idea passed my investors approval!\n", 1331 | "\n", 1332 | "Developing the MVP idea...\n", 1333 | "mvp_idea_result [/INST] \n", 1334 | "PRODUCT: Pet Care Services for Affluent Owners. Simple and Secure Platform.\n", 1335 | "Product idea: Pet Care Services for Affluent Owners. Simple and Secure Platform.\n", 1336 | "Product Summary: Pet Care Services for Affluent Owners. Simple and Secure Platform.\n", 1337 | "\n", 1338 | "\n", 1339 | "Beginning scaffolding...\n", 1340 | "\n", 1341 | "\n", 1342 | "\n", 1343 | " [INST] <>\n", 1344 | "\n", 1345 | " You will get instructions for react.js code to write.\n", 1346 | " You will write a very long answer. Make sure that every detail of the architecture is, in the end, implemented as code.\n", 1347 | "\n", 1348 | " Think step by step and reason yourself to the right decisions to make sure we get it right.\n", 1349 | " You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose.\n", 1350 | "\n", 1351 | " Then you will output the content of each file including ALL code.\n", 1352 | " Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that\n", 1353 | " FILENAME is the file name including the file extension and path from the root of the project. also FILENAME must be in markdown bold,\n", 1354 | " LANG is the markup code block language for the code's language, and CODE is the code:\n", 1355 | "\n", 1356 | "\n", 1357 | " **FILENAME**\n", 1358 | " ```LANG\n", 1359 | " CODE\n", 1360 | " ```\n", 1361 | "\n", 1362 | " Do not comment on what every file does\n", 1363 | "\n", 1364 | " You will start with the entrypoint file which will must be called \"index.js\", then go to the ones that are imported by that file, and so on.\n", 1365 | " Please note that the code should be fully functional. No placeholders.\n", 1366 | " This will be a react.js project so you must create a webpack.config.js at the root of the project that uses \"index.js\" as the entry file\n", 1367 | " The output in the webpack.config.js must point to a bundle.js file that's in the same folder as the index.html\n", 1368 | " Place all of the public assets in a folder named \"public\" in lowercase with an index.html file that is linked to the bundle specified in the webpack.config.js\n", 1369 | " You must include a package.json file in the root of the folder that resolves all the required dependencies for this react.js project. All of the dependencies and devDependencies must be set to a \"*\" value. Also, for every package.json you must at least include the packages @babel/core, babel-loader, react and react-dom\n", 1370 | " The package.json must be valid JSON\n", 1371 | " You must include a .babelrc file in the root folder that has @babel/preset-react set\n", 1372 | "\n", 1373 | " The user will provide a name and branding colors for you to use. You must utilize both of these in the react code. \n", 1374 | "The user will provide the name and branding in the format below:\n", 1375 | "NAME: the project name\n", 1376 | "BRANDING: the primary/secondary colors\n", 1377 | " \n", 1378 | "\n", 1379 | " Follow a language and framework appropriate best practice file naming convention.\n", 1380 | " Make sure that files contain all imports. Make sure that the code in different files are compatible with each other.\n", 1381 | " Ensure to implement all code, if you are unsure, write a plausible implementation.\n", 1382 | " Before you finish, double check that all parts of the architecture is present in the files.\n", 1383 | "\n", 1384 | " Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n", 1385 | " <>\n", 1386 | " \n", 1387 | "Instructions for the code: I want the entrypoint file for a Pet Care Services for Affluent Owners. Simple and Secure Platform. built in react.js NAME: PupCake\n", 1388 | "BRANDING: #FFC70D, #3498DB, #F1C40F\n", 1389 | " [/INST] **index.js**\n", 1390 | "```javascript\n", 1391 | "import React from'react';\n", 1392 | "import ReactDOM from'react-dom';\n", 1393 | "import App from './App';\n", 1394 | "import { render } from'react-dom';\n", 1395 | "\n", 1396 | "const name = 'PupCake';\n", 1397 | "const branding = {\n", 1398 | " primary: '#FFC70D',\n", 1399 | " secondary: '#3498DB',\n", 1400 | " highlight: '#F1C40F',\n", 1401 | "};\n", 1402 | "\n", 1403 | "render(\n", 1404 | " \n", 1405 | " \n", 1406 | " ,\n", 1407 | " document.getElementById('root')\n", 1408 | ");\n", 1409 | "```\n", 1410 | "\n", 1411 | "**public/index.html**\n", 1412 | "```html\n", 1413 | "\n", 1414 | "\n", 1415 | "\n", 1416 | " \n", 1417 | " \n", 1418 | " PupCake\n", 1419 | " \n", 1420 | "\n", 1421 | "\n", 1422 | "
\n", 1423 | " \n", 1424 | "\n", 1425 | "\n", 1426 | "```\n", 1427 | "\n", 1428 | "**webpack.config.js**\n", 1429 | "```javascript\n", 1430 | "const path = require('path');\n", 1431 | "const webpack = require('webpack');\n", 1432 | "const BundleTracker = require('webpack-bundle-tracker');\n", 1433 | "\n", 1434 | "const name = 'PupCake';\n", 1435 | "const branding = {\n", 1436 | " primary: '#FFC70D',\n", 1437 | " secondary: '#3498DB',\n", 1438 | " highlight: '#F1C40F',\n", 1439 | "};\n", 1440 | "\n", 1441 | "const ROOT_DIR = path.resolve(__dirname, '..');\n", 1442 | "const SRC_DIR = path.join(ROOT_DIR,'src');\n", 1443 | "const BUILD_DIR = path.join(ROOT_DIR, 'build');\n", 1444 | "\n", 1445 | "module.exports = {\n", 1446 | " entry: path.join(SRC_DIR, 'index.js'),\n", 1447 | " output: {\n", 1448 | " path: BUILD_DIR,\n", 1449 | " filename: 'bundle.js',\n", 1450 | " publicPath: '/',\n", 1451 | " },\n", 1452 | " plugins: [\n", 1453 | " new BundleTracker({\n", 1454 | " analytics: 'UA-12345678-1',\n", 1455 | " }),\n", 1456 | " ],\n", 1457 | " resolve: {\n", 1458 | " extensions: ['.js', '.jsx', '.ts', '.tsx'],\n", 1459 | " },\n", 1460 | " module: {\n", 1461 | " rules: [\n", 1462 | " {\n", 1463 | " test: /\\.(js|jsx|ts|tsx)$/,\n", 1464 | " exclude: /node_modules/,\n", 1465 | " use: {\n", 1466 | " loader: 'babel-loader',\n", 1467 | " options: {\n", 1468 | " presets: [\n", 1469 | " [\n", 1470 | " '@babel/preset-env',\n", 1471 | " {\n", 1472 | " targets: {\n", 1473 | " node: 'current',\n", 1474 | " },\n", 1475 | " useBuiltIns: 'usage',\n", 1476 | " corejs: '3',\n", 1477 | " },\n", 1478 | " ],\n", 1479 | " '@babel/preset-react',\n", 1480 | " ],\n", 1481 | " plugins: [\n", 1482 | " '@babel/plugin-proposal-class-properties',\n", 1483 | " ],\n", 1484 | " },\n", 1485 | " },\n", 1486 | " },\n", 1487 | " {\n", 1488 | " test: /\\.css$/,\n", 1489 | " use: ['style-loader', 'css-loader'],\n", 1490 | " },\n", 1491 | " ],\n", 1492 | " },\n", 1493 | " mode: 'development',\n", 1494 | " target: 'web',\n", 1495 | " devtool: 'cheap-module-eval-source-map',\n", 1496 | "};\n", 1497 | "```\n", 1498 | "\n", 1499 | "**App.js**\n", 1500 | "```javascript\n", 1501 | "import React from'react';\n", 1502 | "import logo from './logo.js';\n", 1503 | "import Navbar from './Navbar';\n", 1504 | "import Home from './Home';\n", 1505 | "import Footer from './Footer';\n", 1506 | "\n", 1507 | "const name = 'PupCake';\n", 1508 | "const branding = {\n", 1509 | " primary: '#FFC70D',\n", 1510 | " secondary: '#3498DB',\n", 1511 | " highlight: '#F1C40F',\n", 1512 | "};\n", 1513 | "\n", 1514 | "function App() {\n", 1515 | " return (\n", 1516 | "
\n", 1517 | "
\n", 1518 | " \n", 1519 | "
\n", 1520 | " \n", 1521 | " \n", 1522 | "
\n", 1523 | "
\n", 1524 | " );\n", 1525 | "}\n", 1526 | "\n", 1527 | "export default App;\n", 1528 | "```\n", 1529 | "\n", 1530 | "**logo.js**\n", 1531 | "```javascript\n", 1532 | "import React from'react';\n", 1533 | "\n", 1534 | "const logo = () => (\n", 1535 | " \n", 1536 | " \n", 1537 | " \n", 1538 | " PupCake\n", 1539 | " \n", 1540 | " \n", 1541 | ");\n", 1542 | "\n", 1543 | "export default logo;\n", 1544 | "```\n", 1545 | "\n", 1546 | "**Navbar.js**\n", 1547 | "```javascript\n", 1548 | "import React from'react';\n", 1549 | "\n", 1550 | "const Navbar = ({ name, branding }) => (\n", 1551 | "
\n", 1552 | "
\n", 1553 | " \n", 1554 | " {name}\n", 1555 | " \n", 1556 | "
\n", 1557 | "
    \n", 1558 | "
  • \n", 1559 | " Home\n", 1560 | "
  • \n", 1561 | "
  • \n", 1562 | " About\n", 1563 | "
  • \n", 1564 | "
\n", 1565 | "
\n", 1566 | ");\n", 1567 | "\n", 1568 | "export default Navbar;\n", 1569 | "```\n", 1570 | "\n", 1571 | "**Home.js**\n", 1572 | "```javascript\n", 1573 | "import React from'react';\n", 1574 | "\n", 1575 | "const Home = ({ name, branding }) => (\n", 1576 | "
\n", 1577 | "

\n", 1578 | " Welcome to PupCake!\n", 1579 | "

\n", 1580 | "

\n", 1581 | " PupCake is a simple and secure platform for pet care services, designed for affluent owners.\n", 1582 | "

\n", 1583 | " \n", 1586 | "
\n", 1587 | ");\n", 1588 | "\n", 1589 | "export default Home;\n", 1590 | "```\n", 1591 | "\n", 1592 | "**Footer.js**\n", 1593 | "```javascript\n", 1594 | "import React from'react';\n", 1595 | "\n", 1596 | "const Footer = ({ name, branding }) => (\n", 1597 | "
\n", 1598 | "

\n", 1599 | " Copyright © {new Date().getFullYear()} PupCake. All rights reserved.\n", 1600 | "

\n", 1601 | " \n", 1609 | "
\n", 1610 | ");\n", 1611 | "\n", 1612 | "export default Footer;\n", 1613 | "```\n", 1614 | "\n", 1615 | "**styles.css**\n", 1616 | "```css\n", 1617 | "body {\n", 1618 | " font-family: 'Nunito', sans-serif;\n", 1619 | " margin: 0;\n", 1620 | " padding: 0;\n", 1621 | "}\n", 1622 | "\n", 1623 | ".app {\n", 1624 | " width: 100%;\n", 1625 | " height: 100vh;\n", 1626 | " display: flex;\n", 1627 | " flex-direction: column;\n", 1628 | " justifiy-content: center;\n", 1629 | " align-items: center;\n", 1630 | "}\n", 1631 | "\n", 1632 | ".app-header {\n", 1633 | " display: flex;\n", 1634 | " flex-direction: row;\n", 1635 | " justify-content: space-between;\n", 1636 | " align-items: center;\n", 1637 | "}\n", 1638 | "\n", 1639 | ".logo {\n", 1640 | " width: 24px;\n", 1641 | " height: 24px;\n", 1642 | " fill: #FFC70D;\n", 1643 | "}\n", 1644 | "\n", 1645 | ".navbar {\n", 1646 | " display: flex;\n", 1647 | " flex-direction: row;\n", 1648 | " justify-content: space-between;\n", 1649 | " align-items: center;\n", 1650 | " padding: 10px;\n", 1651 | " border-bottom: 1px solid #ededed;\n", 1652 | "}\n", 1653 | "\n", 1654 | ".navbar-brand {\n", 1655 | " padding: 10px;\n", 1656 | "}\n", 1657 | "\n", 1658 | ".navbar-brand-link {\n", 1659 | " text-decoration: none;\n", 1660 | " color: #FFC70D;\n", 1661 | "}\n", 1662 | "\n", 1663 | ".navbar-links {\n", 1664 | " display: flex;\n", 1665 | " flex-direction: row;\n", 1666 | " justify-content: space-between;\n", 1667 | " align-items: center;\n", 1668 | "}\n", 1669 | "\n", 1670 | ".nav-link {\n", 1671 | " padding: 10px;\n", 1672 | " margin: 10px;\n", 1673 | " text-decoration: none;\n", 1674 | " color: #3498DB;\n", 1675 | "}\n", 1676 | "\n", 1677 | ".home {\n", 1678 | " display: flex;\n", 1679 | " flex-direction: column;\n", 1680 | " align-items: center;\n", 1681 | " padding: 20px;\n", 1682 | "}\n", 1683 | "\n", 1684 | ".home-title {\n", 1685 | " font-size: 24px;\n", 1686 | " font-weight: bold;\n", 1687 | " margin: 20px 0;\n", 1688 | "}\n", 1689 | "\n", 1690 | ".home-description {\n", 1691 | " font-size: 16px;\n", 1692 | " margin: 20px 0;\n", 1693 | "}\n", 1694 | "\n", 1695 | ".home-btn {\n", 1696 | " padding: 10px 24px;\n", 1697 | " border: none;\n", 1698 | " border-radius: 4px;\n", 1699 | " background-color: #3498DB;\n", 1700 | " color: #FFFFFF;\n", 1701 | " cursor: pointer;\n", 1702 | "}\n", 1703 | "\n", 1704 | ".footer {\n", 1705 | " display: flex;\n", 1706 | " flex-direction: row;\n", 1707 | " justify-content: space-between;\n", 1708 | " align-items: center;\n", 1709 | " padding: 10px;\n", 1710 | " border-top: 1px solid #ededed;\n", 1711 | "}\n", 1712 | "\n", 1713 | ".footer-text {\n", 1714 | " font-size: 14px;\n", 1715 | " margin: 20px;\n", 1716 | "}\n", 1717 | "\n", 1718 | ".footer-links {\n", 1719 | " display: flex;\n", 1720 | " flex-direction: row;\n", 1721 | " justify-content: space-between;\n", 1722 | " align-items: center;\n", 1723 | "}\n", 1724 | "\n", 1725 | ".footer-link {\n", 1726 | " padding: 10px;\n", 1727 | " margin: 10px;\n", 1728 | " text-decoration: none;\n", 1729 | " color: #3498DB;\n", 1730 | "}\n", 1731 | "```\n", 1732 | "\n", 1733 | "**package.json**\n", 1734 | "```json\n", 1735 | "{\n", 1736 | " \"name\": \"PupCake\",\n", 1737 | " \"version\": \"1.0.0\",\n", 1738 | " \"description\": \"A simple and secure platform for pet care services, designed for affluent owners.\",\n", 1739 | " \"main\": \"index.js\",\n", 1740 | " \"scripts\": {\n", 1741 | " \"start\": \"webpack-dev-server\",\n", 1742 | " \"build\": \"webpack\",\n", 1743 | " },\n", 1744 | " \"keywords\": [\n", 1745 | " \"Pet Care Services\",\n", 1746 | " \"Affluent Owners\",\n", 1747 | " \"Simple and Secure Platform\",\n", 1748 | " ],\n", 1749 | " \"author\": \"Your Name\",\n", 1750 | " \"license\": \"MIT\",\n", 1751 | " \"dependencies\": {\n", 1752 | " \"@babel/core\": \"^7.16.3\",\n", 1753 | " \"@babel/preset-env\": \"^7.16.3\",\n", 1754 | " \"@babel/preset-react\": \"^7.16.3\",\n", 1755 | " \"babel-loader\": \"^8.2.2\",\n", 1756 | " \"react\": \"^17.0.2\",\n", 1757 | " \"react-dom\": \"^17.0.2\",\n", 1758 | " \"webpack\": \"^4.4.4\",\n", 1759 | " \"webpack-bundle-tracker\": \"^0.5.2\",\n", 1760 | " },\n", 1761 | " \"devDependencies\": {\n", 1762 | " \"@babel/preset-stage-0\": \"^7.16.3\",\n", 1763 | " \"webpack-dev-server\": \"^3.11.2\",\n", 1764 | " },\n", 1765 | " \"browserList\": [\n", 1766 | " \"> 1%, not dead\",\n", 1767 | " \"IE 11\",\n", 1768 | " ],\n", 1769 | " \"resolutions\": {\n", 1770 | " \"@babel/core\": \"^7.16.3\",\n", 1771 | " \"@babel/preset-env\": \"^7.16.3\",\n", 1772 | " \"@babel/preset-react\": \"^7.16.3\",\n", 1773 | " },\n", 1774 | "}\n", 1775 | "```\n", 1776 | "\n", 1777 | "**tsconfig.json**\n", 1778 | "```json\n", 1779 | "{\n", 1780 | " \"compilerOptions\": {\n", 1781 | " \"target\": \"es5\",\n", 1782 | " \"module\": \"commonjs\",\n", 1783 | " \"sourceMap\": true,\n", 1784 | " \"outDir\": \"build\",\n", 1785 | " \"esModuleInterop\": true,\n", 1786 | " \"skipLibCheck\": true,\n", 1787 | " \"strict\": true,\n", 1788 | " \"moduleResolution\": \"node\",\n", 1789 | " \"resolveJsonModule\": true,\n", 1790 | " \"isolatedModules\": true,\n", 1791 | " \"jsx\": \"react\"\n", 1792 | " },\n", 1793 | " \"include\": [\"src\"]\n", 1794 | "}\n", 1795 | "```\n", 1796 | "\n", 1797 | "**index.tsx**\n", 1798 | "```typescript\n", 1799 | "import React from'react';\n", 1800 | "import App from './App';\n", 1801 | "\n", 1802 | "ReactDOM.render(\n", 1803 | " \n", 1804 | " \n", 1805 | " ,\n", 1806 | " document.getElementById('root')\n", 1807 | ");\n", 1808 | "```\n", 1809 | "\n", 1810 | "Please note that the above code is a basic structure and you may need to add more functionality and features to make it a fully functional app. Also, the package.json and tsconfig.json files will need to be updated with your own credentials and dependencies.\n", 1811 | "['index.js', 'public/index.html', 'webpack.config.js', 'App.js', 'logo.js', 'Navbar.js', 'Home.js', 'Footer.js', 'styles.css', 'package.json', 'tsconfig.json', 'index.tsx']\n", 1812 | "[\"javascript\\nimport React from'react';\\nimport ReactDOM from'react-dom';\\nimport App from './App';\\nimport { render } from'react-dom';\\n\\nconst name = 'PupCake';\\nconst branding = {\\n primary: '#FFC70D',\\n secondary: '#3498DB',\\n highlight: '#F1C40F',\\n};\\n\\nrender(\\n \\n \\n ,\\n document.getElementById('root')\\n);\\n\", 'html\\n\\n\\n\\n \\n \\n PupCake\\n \\n\\n\\n
\\n \\n\\n\\n', \"javascript\\nconst path = require('path');\\nconst webpack = require('webpack');\\nconst BundleTracker = require('webpack-bundle-tracker');\\n\\nconst name = 'PupCake';\\nconst branding = {\\n primary: '#FFC70D',\\n secondary: '#3498DB',\\n highlight: '#F1C40F',\\n};\\n\\nconst ROOT_DIR = path.resolve(__dirname, '..');\\nconst SRC_DIR = path.join(ROOT_DIR,'src');\\nconst BUILD_DIR = path.join(ROOT_DIR, 'build');\\n\\nmodule.exports = {\\n entry: path.join(SRC_DIR, 'index.js'),\\n output: {\\n path: BUILD_DIR,\\n filename: 'bundle.js',\\n publicPath: '/',\\n },\\n plugins: [\\n new BundleTracker({\\n analytics: 'UA-12345678-1',\\n }),\\n ],\\n resolve: {\\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\\n },\\n module: {\\n rules: [\\n {\\n test: /\\\\.(js|jsx|ts|tsx)$/,\\n exclude: /node_modules/,\\n use: {\\n loader: 'babel-loader',\\n options: {\\n presets: [\\n [\\n '@babel/preset-env',\\n {\\n targets: {\\n node: 'current',\\n },\\n useBuiltIns: 'usage',\\n corejs: '3',\\n },\\n ],\\n '@babel/preset-react',\\n ],\\n plugins: [\\n '@babel/plugin-proposal-class-properties',\\n ],\\n },\\n },\\n },\\n {\\n test: /\\\\.css$/,\\n use: ['style-loader', 'css-loader'],\\n },\\n ],\\n },\\n mode: 'development',\\n target: 'web',\\n devtool: 'cheap-module-eval-source-map',\\n};\\n\", 'javascript\\nimport React from\\'react\\';\\nimport logo from \\'./logo.js\\';\\nimport Navbar from \\'./Navbar\\';\\nimport Home from \\'./Home\\';\\nimport Footer from \\'./Footer\\';\\n\\nconst name = \\'PupCake\\';\\nconst branding = {\\n primary: \\'#FFC70D\\',\\n secondary: \\'#3498DB\\',\\n highlight: \\'#F1C40F\\',\\n};\\n\\nfunction App() {\\n return (\\n
\\n
\\n \\n
\\n \\n \\n
\\n
\\n );\\n}\\n\\nexport default App;\\n', 'javascript\\nimport React from\\'react\\';\\n\\nconst logo = () => (\\n \\n \\n \\n PupCake\\n \\n \\n);\\n\\nexport default logo;\\n', 'javascript\\nimport React from\\'react\\';\\n\\nconst Navbar = ({ name, branding }) => (\\n
\\n \\n
    \\n
  • \\n Home\\n
  • \\n
  • \\n About\\n
  • \\n
\\n
\\n);\\n\\nexport default Navbar;\\n', 'javascript\\nimport React from\\'react\\';\\n\\nconst Home = ({ name, branding }) => (\\n
\\n

\\n Welcome to PupCake!\\n

\\n

\\n PupCake is a simple and secure platform for pet care services, designed for affluent owners.\\n

\\n \\n
\\n);\\n\\nexport default Home;\\n', 'javascript\\nimport React from\\'react\\';\\n\\nconst Footer = ({ name, branding }) => (\\n
\\n

\\n Copyright © {new Date().getFullYear()} PupCake. All rights reserved.\\n

\\n \\n
\\n);\\n\\nexport default Footer;\\n', \"css\\nbody {\\n font-family: 'Nunito', sans-serif;\\n margin: 0;\\n padding: 0;\\n}\\n\\n.app {\\n width: 100%;\\n height: 100vh;\\n display: flex;\\n flex-direction: column;\\n justifiy-content: center;\\n align-items: center;\\n}\\n\\n.app-header {\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n.logo {\\n width: 24px;\\n height: 24px;\\n fill: #FFC70D;\\n}\\n\\n.navbar {\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n padding: 10px;\\n border-bottom: 1px solid #ededed;\\n}\\n\\n.navbar-brand {\\n padding: 10px;\\n}\\n\\n.navbar-brand-link {\\n text-decoration: none;\\n color: #FFC70D;\\n}\\n\\n.navbar-links {\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n.nav-link {\\n padding: 10px;\\n margin: 10px;\\n text-decoration: none;\\n color: #3498DB;\\n}\\n\\n.home {\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n padding: 20px;\\n}\\n\\n.home-title {\\n font-size: 24px;\\n font-weight: bold;\\n margin: 20px 0;\\n}\\n\\n.home-description {\\n font-size: 16px;\\n margin: 20px 0;\\n}\\n\\n.home-btn {\\n padding: 10px 24px;\\n border: none;\\n border-radius: 4px;\\n background-color: #3498DB;\\n color: #FFFFFF;\\n cursor: pointer;\\n}\\n\\n.footer {\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n padding: 10px;\\n border-top: 1px solid #ededed;\\n}\\n\\n.footer-text {\\n font-size: 14px;\\n margin: 20px;\\n}\\n\\n.footer-links {\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n.footer-link {\\n padding: 10px;\\n margin: 10px;\\n text-decoration: none;\\n color: #3498DB;\\n}\\n\", 'json\\n{\\n \"name\": \"PupCake\",\\n \"version\": \"1.0.0\",\\n \"description\": \"A simple and secure platform for pet care services, designed for affluent owners.\",\\n \"main\": \"index.js\",\\n \"scripts\": {\\n \"start\": \"webpack-dev-server\",\\n \"build\": \"webpack\",\\n },\\n \"keywords\": [\\n \"Pet Care Services\",\\n \"Affluent Owners\",\\n \"Simple and Secure Platform\",\\n ],\\n \"author\": \"Your Name\",\\n \"license\": \"MIT\",\\n \"dependencies\": {\\n \"@babel/core\": \"^7.16.3\",\\n \"@babel/preset-env\": \"^7.16.3\",\\n \"@babel/preset-react\": \"^7.16.3\",\\n \"babel-loader\": \"^8.2.2\",\\n \"react\": \"^17.0.2\",\\n \"react-dom\": \"^17.0.2\",\\n \"webpack\": \"^4.4.4\",\\n \"webpack-bundle-tracker\": \"^0.5.2\",\\n },\\n \"devDependencies\": {\\n \"@babel/preset-stage-0\": \"^7.16.3\",\\n \"webpack-dev-server\": \"^3.11.2\",\\n },\\n \"browserList\": [\\n \"> 1%, not dead\",\\n \"IE 11\",\\n ],\\n \"resolutions\": {\\n \"@babel/core\": \"^7.16.3\",\\n \"@babel/preset-env\": \"^7.16.3\",\\n \"@babel/preset-react\": \"^7.16.3\",\\n },\\n}\\n', 'json\\n{\\n \"compilerOptions\": {\\n \"target\": \"es5\",\\n \"module\": \"commonjs\",\\n \"sourceMap\": true,\\n \"outDir\": \"build\",\\n \"esModuleInterop\": true,\\n \"skipLibCheck\": true,\\n \"strict\": true,\\n \"moduleResolution\": \"node\",\\n \"resolveJsonModule\": true,\\n \"isolatedModules\": true,\\n \"jsx\": \"react\"\\n },\\n \"include\": [\"src\"]\\n}\\n', \"typescript\\nimport React from'react';\\nimport App from './App';\\n\\nReactDOM.render(\\n \\n \\n ,\\n document.getElementById('root')\\n);\\n\"]\n", 1813 | "files length 12\n", 1814 | "codes length 12\n", 1815 | "Resolving missing dependencies...\n", 1816 | "[/INST] Based on the codebase you provided, it appears that the project is missing the following npm packages:\n", 1817 | "\n", 1818 | "1. React DOM, which is required for rendering the React components to the browser.\n", 1819 | "2. The `@babel/core` package, which is used for Babel compilation and transforms the JavaScript code into ES5 code.\n", 1820 | "3. The `@babel/preset-env` package, which is used to configure the Babel preset to use the correct environment for the code.\n", 1821 | "4. The `@babel/preset-react` package, which is used to configure the Babel preset to use the correct React syntax.\n", 1822 | "5. The `webpack` package, which is used for bundling the code and loading it into the browser.\n", 1823 | "6. The `webpack-bundle-tracker` package, which is used to track the performance of the bundle.\n", 1824 | "\n", 1825 | "To fix these missing dependencies, you can run the following command in your terminal:\n", 1826 | "```\n", 1827 | "npm install react react-dom @babel/core @babel/preset-env @babel/preset-react webpack webpack-bundle-tracker\n", 1828 | "```\n", 1829 | "This command will install all of the missing dependencies and update your `package.json` file with the new dependencies.\n", 1830 | "\n", 1831 | "Here is the updated `package.json` file:\n", 1832 | "```\n", 1833 | "{\n", 1834 | " \"name\": \"PupCake\",\n", 1835 | " \"version\": \"1.0.0\",\n", 1836 | " \"description\": \"A simple and secure platform for pet care services, designed for affluent owners.\",\n", 1837 | " \"main\": \"index.js\",\n", 1838 | " \"scripts\": {\n", 1839 | " \"start\": \"webpack-dev-server\",\n", 1840 | " \"build\": \"webpack\",\n", 1841 | " },\n", 1842 | " \"keywords\": [\n", 1843 | " \"Pet Care Services\",\n", 1844 | " \"Affluent Owners\",\n", 1845 | " \"Simple and Secure Platform\",\n", 1846 | " ],\n", 1847 | " \"author\": \"Your Name\",\n", 1848 | " \"license\": \"MIT\",\n", 1849 | " \"dependencies\": {\n", 1850 | " \"react\": \"^17.0.2\",\n", 1851 | " \"react-dom\": \"^17.0.2\",\n", 1852 | " \"@babel/core\": \"^7.16.3\",\n", 1853 | " \"@babel/preset-env\": \"^7.16.3\",\n", 1854 | " \"@babel/preset-react\": \"^7.16.3\",\n", 1855 | " \"webpack\": \"^4.4.4\",\n", 1856 | " \"webpack-bundle-tracker\": \"^0.5.2\",\n", 1857 | " },\n", 1858 | " \"devDependencies\": {\n", 1859 | " \"@babel/preset-stage-0\": \"^7.16.3\",\n", 1860 | " \"webpack-dev-server\": \"^3.11.2\",\n", 1861 | " },\n", 1862 | " \"browserList\": [\n", 1863 | " \"> 1%, not dead\",\n", 1864 | " \"IE 11\",\n", 1865 | " ],\n", 1866 | " \"resolutions\": {\n", 1867 | " \"@babel/core\": \"^7.16.3\",\n", 1868 | " \"@babel/preset-env\": \"^7.16.3\",\n", 1869 | " \"@babel/preset-react\": \"^7.16.3\",\n", 1870 | " },\n", 1871 | "}\n", 1872 | "```\n", 1873 | "Please note that this list of missing dependencies is based on the code you provided, and may not be comprehensive. It's always a good idea to run `npm list` to check for any missing dependencies, especially if you're working with a larger codebase.\n", 1874 | "Done! Check out your codebase in react-output/\n", 1875 | "$ Do you wish to make modifications? [y/n]n\n", 1876 | "Congrats on your 10x React project\n", 1877 | "Check out your code in the react-output/ folder\n", 1878 | "\n", 1879 | "\n", 1880 | "$ Do you want to pivot? [y/n]y\n", 1881 | "pivot_result [/INST] Sure! Here's the alternative business idea based on the given business plan:\n", 1882 | "\n", 1883 | "New Business Idea: Personalized Pet Concierge Services for Busy Affluent Pet Owners\n", 1884 | "\n", 1885 | "The new angle is to focus on providing personalized concierge services for affluent pet owners who have busy lifestyles and want the best for their pets but may not have the time to research and schedule various pet care services. The platform would offer a wide range of services, including pet sitting, dog walking, grooming, and training, all tailored to the specific needs of each pet.\n", 1886 | "\n", 1887 | "The platform would also offer a premium subscription service that includes exclusive discounts, priority booking, and access to specialized pet care services not available to non-subscribers. This would provide an additional revenue stream and incentivize pet owners to sign up for the subscription service.\n", 1888 | "\n", 1889 | "To increase visibility and credibility, the platform could partner with upscale pet stores, veterinary clinics, and other pet-related businesses to offer bundled services and promotions. The platform could also leverage social media and influencer marketing to target affluent pet owners and showcase the high-quality services offered.\n", 1890 | "Here's the new idea\n", 1891 | "Idea: PupCake - The Pet Sitter Matching Platform\n", 1892 | "Name: PupCake\n", 1893 | "Branding: #FFC70D, #3498DB, #F1C40F\n", 1894 | "\n", 1895 | "\n", 1896 | "Scheming a business plan...\n", 1897 | "Your business plan:\n", 1898 | "- Develop a comprehensive online platform for pet owners to find trustworthy, local pet sitters\n", 1899 | "- Implement a secure and reliable payment system for transactions between pet owners and sitters\n", 1900 | "- Create a user-friendly interface for both pet owners and sitters to easily interact and communicate\n", 1901 | "- Offer a variety of services such as dog walking, overnight stays, and pet grooming\n", 1902 | "- Establish partnerships with local pet supply stores and veterinarians to offer additional services and enhance the user experience\n", 1903 | "\n", 1904 | "\n", 1905 | "Criticizing your business plan...\n", 1906 | "\n", 1907 | "Criticisms:\n", 1908 | "- Line item 1: The platform may not be comprehensive enough to address the needs of all pet owners, particularly those with unique or exotic pets.\n", 1909 | "- Line item 2: The payment system may not be secure enough to protect sensitive financial information, potentially leading to fraud or legal issues.\n", 1910 | "- Line item 3: The user interface may be too simple or intuitive, leading to confusion or errors for both pet owners and sitters.\n", 1911 | "- Line item 4: The variety of services offered may not be diverse enough to appeal to a wide range of pet owners and their pets' needs.\n", 1912 | "- Line item 5: Establishing partnerships with local pet supply stores and veterinarians may be difficult or costly, potentially limiting the platform's reach and appeal.\n", 1913 | "New Business Plan:\n", 1914 | "- Develop a comprehensive online platform for pet owners to find trustworthy, local pet sitters, with features tailored to the needs of a wide range of pet owners and their pets, including those with unique or exotic pets.\n", 1915 | "- Implement a secure and reliable payment system for transactions between pet owners and sitters, with multi-layered security measures and clear legal protections.\n", 1916 | "- Create a user-friendly interface for both pet owners and sitters to easily interact and communicate, with intuitive navigation and comprehensive support resources.\n", 1917 | "- Offer a variety of services such as dog walking, overnight stays, pet grooming, and specialized care for pets with specific needs or conditions.\n", 1918 | "- Establish partnerships with local pet supply stores, veterinarians, and other pet-related businesses to offer additional services and enhance the user experience, with a focus on quality and convenience.\n", 1919 | "\n", 1920 | "\n", 1921 | "Submitting your new business plan for approval...\n", 1922 | "business_plan_approval_result [/INST] ANSWER: NO\n", 1923 | "\n", 1924 | "Reasons:\n", 1925 | "\n", 1926 | "1. The business plan is too focused on one specific demographic (millennial pet owners) and does not consider other potential markets.\n", 1927 | "2. The platform may not provide enough features for pet owners to properly evaluate potential sitters.\n", 1928 | "3. Partnerships with local pet-related businesses and organizations may be difficult to secure, especially with larger companies.\n", 1929 | "4. The rating and review system may be vulnerable to biases and fake reviews.\n", 1930 | "5. Initial training and support for both pet owners and sitters may not be extensive enough.\n", 1931 | "\n", 1932 | "Note: These criticisms are based on the provided business plan and history, and do not take into account any additional information or context that may be relevant to the business.\n", 1933 | "Business plan did not pass approval. Criticizing again...\n", 1934 | "\n", 1935 | "\n", 1936 | "Criticizing your business plan...\n", 1937 | "\n" 1938 | ] 1939 | }, 1940 | { 1941 | "output_type": "error", 1942 | "ename": "KeyboardInterrupt", 1943 | "evalue": "ignored", 1944 | "traceback": [ 1945 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 1946 | "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", 1947 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mreact_engineer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mReactEngineer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mauto_startup\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mAutoStartup\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreact_engineer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprompt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmemory\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mauto_startup\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;31m#I think a website for dogsitters would be cool\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1948 | "\u001b[0;32m\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"$ I am AutoStartup. Your personal startup creator. I will think of an idea for a startup based on your intutions.\\n\\nTell me your intution starting with \\\"I think\\\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[0minitial_intutition\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"$ \"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 219\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0midea_loop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minitial_intutition\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 220\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", 1949 | "\u001b[0;32m\u001b[0m in \u001b[0;36midea_loop\u001b[0;34m(self, intuition, pivot_idea)\u001b[0m\n\u001b[1;32m 207\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"y\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0mnew_idea\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpivot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbusiness_plan\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mproduct_idea\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 209\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0midea_loop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mintuition\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpivot_idea\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0midea_response\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 210\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1950 | "\u001b[0;32m\u001b[0m in \u001b[0;36midea_loop\u001b[0;34m(self, intuition, pivot_idea)\u001b[0m\n\u001b[1;32m 181\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 182\u001b[0m \u001b[0;31m# try:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 183\u001b[0;31m \u001b[0mcriticism_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcriticism_loop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbusiness_plan_items\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlimit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 184\u001b[0m \u001b[0;31m# except:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 185\u001b[0m \u001b[0;31m# criticism_result = False\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1951 | "\u001b[0;32m\u001b[0m in \u001b[0;36mcriticism_loop\u001b[0;34m(self, business_plan, limit, i)\u001b[0m\n\u001b[1;32m 139\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Business plan did not pass approval. Criticizing again...\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 141\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcriticism_loop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnew_business_plan\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlimit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlimit\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 142\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 143\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mgenerate_code\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mproduct_idea\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbranding\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1952 | "\u001b[0;32m\u001b[0m in \u001b[0;36mcriticism_loop\u001b[0;34m(self, business_plan, limit, i)\u001b[0m\n\u001b[1;32m 122\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"\\n\\nCriticizing your business plan...\\n\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0mcriticism_prompt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_criticisms_prompt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbusiness_plan\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 124\u001b[0;31m \u001b[0mcriticism_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcriticism_prompt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 125\u001b[0m \u001b[0mnew_business_plan\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcriticisms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparse_criticisms_result\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcriticism_result\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 126\u001b[0m \u001b[0;31m# original business plan and criticisms\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1953 | "\u001b[0;32m\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, prompt)\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0mAgent\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprompt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m sequences = pipeline(\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mprompt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mdo_sample\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1954 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/pipelines/text_generation.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, text_inputs, **kwargs)\u001b[0m\n\u001b[1;32m 198\u001b[0m \u001b[0mids\u001b[0m \u001b[0mof\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mgenerated\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 199\u001b[0m \"\"\"\n\u001b[0;32m--> 200\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtext_inputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 201\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mpreprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprompt_text\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprefix\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhandle_long_generation\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mgenerate_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1955 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1120\u001b[0m )\n\u001b[1;32m 1121\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1122\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_single\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpreprocess_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mforward_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpostprocess_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1123\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1124\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mrun_multi\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpreprocess_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mforward_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpostprocess_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1956 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py\u001b[0m in \u001b[0;36mrun_single\u001b[0;34m(self, inputs, preprocess_params, forward_params, postprocess_params)\u001b[0m\n\u001b[1;32m 1127\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mrun_single\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpreprocess_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mforward_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpostprocess_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1128\u001b[0m \u001b[0mmodel_inputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpreprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mpreprocess_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1129\u001b[0;31m \u001b[0mmodel_outputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_inputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mforward_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1130\u001b[0m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpostprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_outputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mpostprocess_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1131\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1957 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1026\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0minference_context\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1027\u001b[0m \u001b[0mmodel_inputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ensure_tensor_on_device\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_inputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1028\u001b[0;31m \u001b[0mmodel_outputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_inputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mforward_params\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1029\u001b[0m \u001b[0mmodel_outputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ensure_tensor_on_device\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_outputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdevice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"cpu\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1030\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1958 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/pipelines/text_generation.py\u001b[0m in \u001b[0;36m_forward\u001b[0;34m(self, model_inputs, **generate_kwargs)\u001b[0m\n\u001b[1;32m 259\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 260\u001b[0m \u001b[0;31m# BS x SL\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 261\u001b[0;31m \u001b[0mgenerated_sequence\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_ids\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minput_ids\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattention_mask\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mattention_mask\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mgenerate_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 262\u001b[0m \u001b[0mout_b\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgenerated_sequence\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 263\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mframework\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"pt\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1959 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py\u001b[0m in \u001b[0;36mdecorate_context\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdecorate_context\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mctx_factory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 115\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 116\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdecorate_context\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1960 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, inputs, generation_config, logits_processor, stopping_criteria, prefix_allowed_tokens_fn, synced_gpus, assistant_model, streamer, **kwargs)\u001b[0m\n\u001b[1;32m 1586\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1587\u001b[0m \u001b[0;31m# 13. run sample\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1588\u001b[0;31m return self.sample(\n\u001b[0m\u001b[1;32m 1589\u001b[0m \u001b[0minput_ids\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1590\u001b[0m \u001b[0mlogits_processor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlogits_processor\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1961 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py\u001b[0m in \u001b[0;36msample\u001b[0;34m(self, input_ids, logits_processor, stopping_criteria, logits_warper, max_length, pad_token_id, eos_token_id, output_attentions, output_hidden_states, output_scores, return_dict_in_generate, synced_gpus, streamer, **model_kwargs)\u001b[0m\n\u001b[1;32m 2640\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2641\u001b[0m \u001b[0;31m# forward pass to get next token\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2642\u001b[0;31m outputs = self(\n\u001b[0m\u001b[1;32m 2643\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mmodel_inputs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2644\u001b[0m \u001b[0mreturn_dict\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1962 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1499\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1502\u001b[0m \u001b[0;31m# Do not call functions when jit is used\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1503\u001b[0m \u001b[0mfull_backward_hooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnon_full_backward_hooks\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1963 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, input_ids, attention_mask, position_ids, past_key_values, inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 804\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 805\u001b[0m \u001b[0;31m# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 806\u001b[0;31m outputs = self.model(\n\u001b[0m\u001b[1;32m 807\u001b[0m \u001b[0minput_ids\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minput_ids\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 808\u001b[0m \u001b[0mattention_mask\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mattention_mask\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1964 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1499\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1502\u001b[0m \u001b[0;31m# Do not call functions when jit is used\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1503\u001b[0m \u001b[0mfull_backward_hooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnon_full_backward_hooks\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1965 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, input_ids, attention_mask, position_ids, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)\u001b[0m\n\u001b[1;32m 691\u001b[0m )\n\u001b[1;32m 692\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 693\u001b[0;31m layer_outputs = decoder_layer(\n\u001b[0m\u001b[1;32m 694\u001b[0m \u001b[0mhidden_states\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 695\u001b[0m \u001b[0mattention_mask\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mattention_mask\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1966 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1499\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1502\u001b[0m \u001b[0;31m# Do not call functions when jit is used\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1503\u001b[0m \u001b[0mfull_backward_hooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnon_full_backward_hooks\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1967 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, hidden_states, attention_mask, position_ids, past_key_value, output_attentions, use_cache)\u001b[0m\n\u001b[1;32m 406\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 407\u001b[0m \u001b[0;31m# Self Attention\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 408\u001b[0;31m hidden_states, self_attn_weights, present_key_value = self.self_attn(\n\u001b[0m\u001b[1;32m 409\u001b[0m \u001b[0mhidden_states\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mhidden_states\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 410\u001b[0m \u001b[0mattention_mask\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mattention_mask\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1968 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1499\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1502\u001b[0m \u001b[0;31m# Do not call functions when jit is used\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1503\u001b[0m \u001b[0mfull_backward_hooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnon_full_backward_hooks\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1969 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, hidden_states, attention_mask, position_ids, past_key_value, output_attentions, use_cache)\u001b[0m\n\u001b[1;32m 303\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 304\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 305\u001b[0;31m \u001b[0mquery_states\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mq_proj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhidden_states\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 306\u001b[0m \u001b[0mkey_states\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mk_proj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhidden_states\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 307\u001b[0m \u001b[0mvalue_states\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mv_proj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhidden_states\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1970 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1499\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1501\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1502\u001b[0m \u001b[0;31m# Do not call functions when jit is used\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1503\u001b[0m \u001b[0mfull_backward_hooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnon_full_backward_hooks\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1971 | "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/torch/nn/modules/linear.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, input)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mTensor\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mTensor\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 114\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mF\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlinear\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mweight\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbias\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 115\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mextra_repr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 1972 | "\u001b[0;31mKeyboardInterrupt\u001b[0m: " 1973 | ] 1974 | } 1975 | ] 1976 | } 1977 | ], 1978 | "metadata": { 1979 | "accelerator": "GPU", 1980 | "colab": { 1981 | "machine_shape": "hm", 1982 | "provenance": [], 1983 | "gpuType": "A100" 1984 | }, 1985 | "kernelspec": { 1986 | "display_name": "Python 3", 1987 | "name": "python3" 1988 | }, 1989 | "language_info": { 1990 | "name": "python" 1991 | }, 1992 | "widgets": { 1993 | "application/vnd.jupyter.widget-state+json": { 1994 | "c30cbd89dee74cfbafe86d5f9ab6e3f5": { 1995 | "model_module": "@jupyter-widgets/controls", 1996 | "model_name": "HBoxModel", 1997 | "model_module_version": "1.5.0", 1998 | "state": { 1999 | "_dom_classes": [], 2000 | "_model_module": "@jupyter-widgets/controls", 2001 | "_model_module_version": "1.5.0", 2002 | "_model_name": "HBoxModel", 2003 | "_view_count": null, 2004 | "_view_module": "@jupyter-widgets/controls", 2005 | "_view_module_version": "1.5.0", 2006 | "_view_name": "HBoxView", 2007 | "box_style": "", 2008 | "children": [ 2009 | "IPY_MODEL_9623422c4e8b4412bdca88c5eb64d02c", 2010 | "IPY_MODEL_7b1d52f7676b4367ac41b7e684884eea", 2011 | "IPY_MODEL_1f4cc720e9f544d28d4d6415b433d8ac" 2012 | ], 2013 | "layout": "IPY_MODEL_16889ac471964a92a5d37d6a70483e20" 2014 | } 2015 | }, 2016 | "9623422c4e8b4412bdca88c5eb64d02c": { 2017 | "model_module": "@jupyter-widgets/controls", 2018 | "model_name": "HTMLModel", 2019 | "model_module_version": "1.5.0", 2020 | "state": { 2021 | "_dom_classes": [], 2022 | "_model_module": "@jupyter-widgets/controls", 2023 | "_model_module_version": "1.5.0", 2024 | "_model_name": "HTMLModel", 2025 | "_view_count": null, 2026 | "_view_module": "@jupyter-widgets/controls", 2027 | "_view_module_version": "1.5.0", 2028 | "_view_name": "HTMLView", 2029 | "description": "", 2030 | "description_tooltip": null, 2031 | "layout": "IPY_MODEL_4e74bd6ac22a4ccc92abd64497d6c290", 2032 | "placeholder": "​", 2033 | "style": "IPY_MODEL_fc61c907e7e34da9acb20c37a0706450", 2034 | "value": "Loading checkpoint shards: 100%" 2035 | } 2036 | }, 2037 | "7b1d52f7676b4367ac41b7e684884eea": { 2038 | "model_module": "@jupyter-widgets/controls", 2039 | "model_name": "FloatProgressModel", 2040 | "model_module_version": "1.5.0", 2041 | "state": { 2042 | "_dom_classes": [], 2043 | "_model_module": "@jupyter-widgets/controls", 2044 | "_model_module_version": "1.5.0", 2045 | "_model_name": "FloatProgressModel", 2046 | "_view_count": null, 2047 | "_view_module": "@jupyter-widgets/controls", 2048 | "_view_module_version": "1.5.0", 2049 | "_view_name": "ProgressView", 2050 | "bar_style": "success", 2051 | "description": "", 2052 | "description_tooltip": null, 2053 | "layout": "IPY_MODEL_0172095fdcf649ffb89f836c9149b0d7", 2054 | "max": 3, 2055 | "min": 0, 2056 | "orientation": "horizontal", 2057 | "style": "IPY_MODEL_458dee549354490ab56be4ca95845b2b", 2058 | "value": 3 2059 | } 2060 | }, 2061 | "1f4cc720e9f544d28d4d6415b433d8ac": { 2062 | "model_module": "@jupyter-widgets/controls", 2063 | "model_name": "HTMLModel", 2064 | "model_module_version": "1.5.0", 2065 | "state": { 2066 | "_dom_classes": [], 2067 | "_model_module": "@jupyter-widgets/controls", 2068 | "_model_module_version": "1.5.0", 2069 | "_model_name": "HTMLModel", 2070 | "_view_count": null, 2071 | "_view_module": "@jupyter-widgets/controls", 2072 | "_view_module_version": "1.5.0", 2073 | "_view_name": "HTMLView", 2074 | "description": "", 2075 | "description_tooltip": null, 2076 | "layout": "IPY_MODEL_a476f2fb09d64041a7ff616940fdd953", 2077 | "placeholder": "​", 2078 | "style": "IPY_MODEL_02a0c4c654a04eada1c79883157fdc13", 2079 | "value": " 3/3 [00:08<00:00, 2.76s/it]" 2080 | } 2081 | }, 2082 | "16889ac471964a92a5d37d6a70483e20": { 2083 | "model_module": "@jupyter-widgets/base", 2084 | "model_name": "LayoutModel", 2085 | "model_module_version": "1.2.0", 2086 | "state": { 2087 | "_model_module": "@jupyter-widgets/base", 2088 | "_model_module_version": "1.2.0", 2089 | "_model_name": "LayoutModel", 2090 | "_view_count": null, 2091 | "_view_module": "@jupyter-widgets/base", 2092 | "_view_module_version": "1.2.0", 2093 | "_view_name": "LayoutView", 2094 | "align_content": null, 2095 | "align_items": null, 2096 | "align_self": null, 2097 | "border": null, 2098 | "bottom": null, 2099 | "display": null, 2100 | "flex": null, 2101 | "flex_flow": null, 2102 | "grid_area": null, 2103 | "grid_auto_columns": null, 2104 | "grid_auto_flow": null, 2105 | "grid_auto_rows": null, 2106 | "grid_column": null, 2107 | "grid_gap": null, 2108 | "grid_row": null, 2109 | "grid_template_areas": null, 2110 | "grid_template_columns": null, 2111 | "grid_template_rows": null, 2112 | "height": null, 2113 | "justify_content": null, 2114 | "justify_items": null, 2115 | "left": null, 2116 | "margin": null, 2117 | "max_height": null, 2118 | "max_width": null, 2119 | "min_height": null, 2120 | "min_width": null, 2121 | "object_fit": null, 2122 | "object_position": null, 2123 | "order": null, 2124 | "overflow": null, 2125 | "overflow_x": null, 2126 | "overflow_y": null, 2127 | "padding": null, 2128 | "right": null, 2129 | "top": null, 2130 | "visibility": null, 2131 | "width": null 2132 | } 2133 | }, 2134 | "4e74bd6ac22a4ccc92abd64497d6c290": { 2135 | "model_module": "@jupyter-widgets/base", 2136 | "model_name": "LayoutModel", 2137 | "model_module_version": "1.2.0", 2138 | "state": { 2139 | "_model_module": "@jupyter-widgets/base", 2140 | "_model_module_version": "1.2.0", 2141 | "_model_name": "LayoutModel", 2142 | "_view_count": null, 2143 | "_view_module": "@jupyter-widgets/base", 2144 | "_view_module_version": "1.2.0", 2145 | "_view_name": "LayoutView", 2146 | "align_content": null, 2147 | "align_items": null, 2148 | "align_self": null, 2149 | "border": null, 2150 | "bottom": null, 2151 | "display": null, 2152 | "flex": null, 2153 | "flex_flow": null, 2154 | "grid_area": null, 2155 | "grid_auto_columns": null, 2156 | "grid_auto_flow": null, 2157 | "grid_auto_rows": null, 2158 | "grid_column": null, 2159 | "grid_gap": null, 2160 | "grid_row": null, 2161 | "grid_template_areas": null, 2162 | "grid_template_columns": null, 2163 | "grid_template_rows": null, 2164 | "height": null, 2165 | "justify_content": null, 2166 | "justify_items": null, 2167 | "left": null, 2168 | "margin": null, 2169 | "max_height": null, 2170 | "max_width": null, 2171 | "min_height": null, 2172 | "min_width": null, 2173 | "object_fit": null, 2174 | "object_position": null, 2175 | "order": null, 2176 | "overflow": null, 2177 | "overflow_x": null, 2178 | "overflow_y": null, 2179 | "padding": null, 2180 | "right": null, 2181 | "top": null, 2182 | "visibility": null, 2183 | "width": null 2184 | } 2185 | }, 2186 | "fc61c907e7e34da9acb20c37a0706450": { 2187 | "model_module": "@jupyter-widgets/controls", 2188 | "model_name": "DescriptionStyleModel", 2189 | "model_module_version": "1.5.0", 2190 | "state": { 2191 | "_model_module": "@jupyter-widgets/controls", 2192 | "_model_module_version": "1.5.0", 2193 | "_model_name": "DescriptionStyleModel", 2194 | "_view_count": null, 2195 | "_view_module": "@jupyter-widgets/base", 2196 | "_view_module_version": "1.2.0", 2197 | "_view_name": "StyleView", 2198 | "description_width": "" 2199 | } 2200 | }, 2201 | "0172095fdcf649ffb89f836c9149b0d7": { 2202 | "model_module": "@jupyter-widgets/base", 2203 | "model_name": "LayoutModel", 2204 | "model_module_version": "1.2.0", 2205 | "state": { 2206 | "_model_module": "@jupyter-widgets/base", 2207 | "_model_module_version": "1.2.0", 2208 | "_model_name": "LayoutModel", 2209 | "_view_count": null, 2210 | "_view_module": "@jupyter-widgets/base", 2211 | "_view_module_version": "1.2.0", 2212 | "_view_name": "LayoutView", 2213 | "align_content": null, 2214 | "align_items": null, 2215 | "align_self": null, 2216 | "border": null, 2217 | "bottom": null, 2218 | "display": null, 2219 | "flex": null, 2220 | "flex_flow": null, 2221 | "grid_area": null, 2222 | "grid_auto_columns": null, 2223 | "grid_auto_flow": null, 2224 | "grid_auto_rows": null, 2225 | "grid_column": null, 2226 | "grid_gap": null, 2227 | "grid_row": null, 2228 | "grid_template_areas": null, 2229 | "grid_template_columns": null, 2230 | "grid_template_rows": null, 2231 | "height": null, 2232 | "justify_content": null, 2233 | "justify_items": null, 2234 | "left": null, 2235 | "margin": null, 2236 | "max_height": null, 2237 | "max_width": null, 2238 | "min_height": null, 2239 | "min_width": null, 2240 | "object_fit": null, 2241 | "object_position": null, 2242 | "order": null, 2243 | "overflow": null, 2244 | "overflow_x": null, 2245 | "overflow_y": null, 2246 | "padding": null, 2247 | "right": null, 2248 | "top": null, 2249 | "visibility": null, 2250 | "width": null 2251 | } 2252 | }, 2253 | "458dee549354490ab56be4ca95845b2b": { 2254 | "model_module": "@jupyter-widgets/controls", 2255 | "model_name": "ProgressStyleModel", 2256 | "model_module_version": "1.5.0", 2257 | "state": { 2258 | "_model_module": "@jupyter-widgets/controls", 2259 | "_model_module_version": "1.5.0", 2260 | "_model_name": "ProgressStyleModel", 2261 | "_view_count": null, 2262 | "_view_module": "@jupyter-widgets/base", 2263 | "_view_module_version": "1.2.0", 2264 | "_view_name": "StyleView", 2265 | "bar_color": null, 2266 | "description_width": "" 2267 | } 2268 | }, 2269 | "a476f2fb09d64041a7ff616940fdd953": { 2270 | "model_module": "@jupyter-widgets/base", 2271 | "model_name": "LayoutModel", 2272 | "model_module_version": "1.2.0", 2273 | "state": { 2274 | "_model_module": "@jupyter-widgets/base", 2275 | "_model_module_version": "1.2.0", 2276 | "_model_name": "LayoutModel", 2277 | "_view_count": null, 2278 | "_view_module": "@jupyter-widgets/base", 2279 | "_view_module_version": "1.2.0", 2280 | "_view_name": "LayoutView", 2281 | "align_content": null, 2282 | "align_items": null, 2283 | "align_self": null, 2284 | "border": null, 2285 | "bottom": null, 2286 | "display": null, 2287 | "flex": null, 2288 | "flex_flow": null, 2289 | "grid_area": null, 2290 | "grid_auto_columns": null, 2291 | "grid_auto_flow": null, 2292 | "grid_auto_rows": null, 2293 | "grid_column": null, 2294 | "grid_gap": null, 2295 | "grid_row": null, 2296 | "grid_template_areas": null, 2297 | "grid_template_columns": null, 2298 | "grid_template_rows": null, 2299 | "height": null, 2300 | "justify_content": null, 2301 | "justify_items": null, 2302 | "left": null, 2303 | "margin": null, 2304 | "max_height": null, 2305 | "max_width": null, 2306 | "min_height": null, 2307 | "min_width": null, 2308 | "object_fit": null, 2309 | "object_position": null, 2310 | "order": null, 2311 | "overflow": null, 2312 | "overflow_x": null, 2313 | "overflow_y": null, 2314 | "padding": null, 2315 | "right": null, 2316 | "top": null, 2317 | "visibility": null, 2318 | "width": null 2319 | } 2320 | }, 2321 | "02a0c4c654a04eada1c79883157fdc13": { 2322 | "model_module": "@jupyter-widgets/controls", 2323 | "model_name": "DescriptionStyleModel", 2324 | "model_module_version": "1.5.0", 2325 | "state": { 2326 | "_model_module": "@jupyter-widgets/controls", 2327 | "_model_module_version": "1.5.0", 2328 | "_model_name": "DescriptionStyleModel", 2329 | "_view_count": null, 2330 | "_view_module": "@jupyter-widgets/base", 2331 | "_view_module_version": "1.2.0", 2332 | "_view_name": "StyleView", 2333 | "description_width": "" 2334 | } 2335 | } 2336 | } 2337 | } 2338 | }, 2339 | "nbformat": 4, 2340 | "nbformat_minor": 0 2341 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoStartup 2 | Coding was livestreamed here -> https://youtube.com/live/ZCyxDRSw0wE 3 | 4 | # What is this? 5 | AutoStartup is a Llama 2 autonomous agent built around my previous https://github.com/jawerty/10x-react-engineer project. It divises a startup idea, business plans and generates React codebases all based on a simple user input "intuition". I built this on a live stream on August 16th, 2023 in 6 and a half hours. Have been challenging myself to build more and have fun doing it! 6 | 7 | # How it works 8 | First, AutoStartup takes in an "intuition" from the user. An example being "I think a website for dogsitters would be cool". Then the Agent divises a business idea from this as well as a business plan. It will iterate on the business plan with "Criticisms" (similar to [AutoGPT](https://github.com/Significant-Gravitas/Auto-GPT)). After each criticism it'll adjust the business plan and "pitch" to an investor prompt. The investor will either approve or disapprove of the final plan. After this final approval it will generate the code base and perform "pivots" based on user feedback 9 | 10 | 1) User intutiton (e.g. "I think a website for dogsitters would be cool") 11 | 2) Idea Loop 12 | - Develops initial business idea 13 | - Writes business plan 14 | - Criticize loop 15 | - Criticizes business plan and generates new plan 16 | - Uses new plan to ask "investor" for approval 17 | - Upon approval continue 18 | - Else: restart loop with new plan 19 | - Generate a product idea from finalized business plan 20 | 3) Generates React Codebase 21 | - Utilize [10x-React-Engineer](https://github.com/jawerty/10x-react-engineer) (a project I built on a stream a couple days before this one) to generate the codebase 22 | 4) (optional) Make a pivot based on the user's feedback 23 | 24 | ![Screen Shot 2023-08-17 at 2 22 25 AM](https://github.com/jawerty/AutoStartup/assets/1999719/e514d74f-5687-46c6-9e17-afe729c68241) 25 | 26 | ## Features 27 | - 100% Llama 2 Inference 28 | - No OpenAI keys necessary 29 | - React Codebase Generation 30 | - Memory 31 | - Vector search for historically successful ideas paired with intuitions. 32 | - Previous criticisms are utilized for investor approvals 33 | - Lean Startup concepts 34 | - Utilizes lean startup methodologies (pivot, tight mvp build loop) 35 | 36 | # How to use it 37 | Please understand you need to have a quality GPU that can load the LLama 2 13b parameter chat model. Hpwever, I built this all on Google Colab and think this is a great way to get around the costs of AI Agents + GPT-4. 38 | 39 | ![Screen Shot 2023-08-15 at 2 26 35 AM](https://github.com/jawerty/AutoStartup/assets/1999719/d182ff78-77f3-46de-bd3b-7255b2918ec4) 40 | 41 | ### Run from source 42 | If you want to run from source run these commands. (*After getting access to llama 2 and logging into huggingface-cli*) 43 | 44 | Install 45 | ``` 46 | $ pip3 install -r requirements.txt 47 | ``` 48 | 49 | Run the main loop 50 | ``` 51 | $ python3 main.py 52 | ``` 53 | 54 | ### Better option for quick testing 55 | Here's a Google [Colab](https://colab.research.google.com/drive/1Piw69Bs6aQUj55jTdBHQcCHdM9ZSDpLa?usp=sharing) with the code for you to play with 56 | 57 | # TODO 58 | - Fine-tune a llama 2 chat model to be better at coding react. So far it's ok but needs some bug fixing more often than not 59 | -------------------------------------------------------------------------------- /agent.py: -------------------------------------------------------------------------------- 1 | from transformers import AutoTokenizer 2 | import transformers 3 | import torch 4 | 5 | class Agent: 6 | def __init__(self): 7 | model = "meta-llama/Llama-2-13b-chat-hf" 8 | self.tokenizer = AutoTokenizer.from_pretrained(model) 9 | self.pipeline = transformers.pipeline( 10 | "text-generation", 11 | model=model, 12 | torch_dtype=torch.float16, 13 | device_map="auto", 14 | ) 15 | 16 | def generate(self, prompt): 17 | sequences = self.pipeline( 18 | prompt, 19 | do_sample=True, 20 | top_k=10, 21 | num_return_sequences=1, 22 | eos_token_id=self.tokenizer.eos_token_id, 23 | max_length=10000, 24 | ) 25 | return sequences[0]['generated_text'] -------------------------------------------------------------------------------- /autostartup.py: -------------------------------------------------------------------------------- 1 | from agent import Agent 2 | 3 | class AutoStartup(Agent): 4 | def __init__(self, react_engineer, prompt, memory): 5 | super().__init__() 6 | self.react_engineer = react_engineer 7 | self.prompt = prompt 8 | self.memory = memory 9 | 10 | def parse_pivot_result(self, result): 11 | pivot_result = result[result.index("[/INST]"):] 12 | print("pivot_result", pivot_result) 13 | new_idea = None 14 | new_idea_tag = "New Business Idea:" 15 | 16 | for line_item in pivot_result.split("\n"): 17 | if new_idea_tag in line_item: 18 | new_idea = line_item[line_item.index(new_idea_tag) + len(new_idea_tag):].strip() 19 | break 20 | 21 | return new_idea 22 | 23 | def parse_mvp_idea_result(self, result): 24 | mvp_idea_result = result[result.index("[/INST]"):] 25 | print("mvp_idea_result", mvp_idea_result) 26 | product_idea = None 27 | product_idea_tag = "PRODUCT:" 28 | 29 | for line_item in mvp_idea_result.split("\n"): 30 | if product_idea_tag in line_item: 31 | product_idea = line_item[line_item.index(product_idea_tag) + len(product_idea_tag):].strip() 32 | break 33 | 34 | return product_idea 35 | 36 | def parse_business_plan_approval_result(self, result): 37 | business_plan_approval_result = result[result.index("[/INST]"):] 38 | print("business_plan_approval_result", business_plan_approval_result) 39 | answer = None 40 | answer_tag = "ANSWER:" 41 | 42 | for line_item in business_plan_approval_result.split("\n"): 43 | if answer_tag in line_item: 44 | answer = line_item[line_item.index(answer_tag) + len(answer_tag):].strip() 45 | break 46 | 47 | return answer 48 | 49 | def parse_criticisms_result(self, result): 50 | criticisms_result = result[result.index("[/INST]"):] 51 | 52 | line_item_sep = "- " 53 | 54 | criticisms_block = criticisms_result[criticisms_result.index('Criticisms:'):criticisms_result.index('New Business Plan:')] 55 | criticisms = [] 56 | for line_item in criticisms_block.split("\n"): 57 | line_item = line_item.strip() 58 | if line_item_sep in line_item: 59 | criticisms.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):]) 60 | 61 | business_block = criticisms_result[criticisms_result.index('New Business Plan:'):] 62 | business_plan = [] 63 | for line_item in business_block.split("\n"): 64 | line_item = line_item.strip() 65 | if line_item_sep in line_item: 66 | business_plan.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):]) 67 | 68 | print("Criticisms:") 69 | for item in criticisms: 70 | print("- ", item) 71 | 72 | print("New Business Plan:") 73 | for item in business_plan: 74 | print("- ", item) 75 | 76 | return business_plan, criticisms 77 | 78 | def parse_business_plan_result(self, result): 79 | business_plan_result = result[result.index("[/INST]"):] 80 | business_plan_items = [] 81 | 82 | line_item_sep = "- " 83 | for line_item in business_plan_result.split("\n"): 84 | line_item = line_item.strip() 85 | if line_item_sep in line_item: 86 | business_plan_items.append(line_item[line_item.index(line_item_sep) + len(line_item_sep):]) 87 | 88 | return business_plan_items 89 | 90 | def parse_idea_result(self, result): 91 | # print(result) 92 | idea_result = result[result.index("[/INST]"):] 93 | name = None 94 | branding = None 95 | idea = None 96 | for line_item in result.split("\n"): 97 | line_item = line_item.strip() 98 | name_tag = "NAME:" 99 | branding_tag = "BRANDING_COLORS:" 100 | idea_tag = "IDEA:" 101 | if name_tag in line_item: 102 | name = line_item[line_item.index(name_tag) + len(name_tag):].strip() 103 | elif branding_tag in line_item: 104 | branding = line_item[line_item.index(branding_tag) + len(branding_tag):].strip() 105 | elif idea_tag in line_item: 106 | idea = line_item[line_item.index(idea_tag) + len(idea_tag):].strip() 107 | 108 | return { 109 | "idea": idea, 110 | "branding": branding, 111 | "name": name 112 | } 113 | 114 | def pivot(self, business_plan, idea): 115 | pivot_prompt = self.prompt.get_pivot_prompt(business_plan, idea) 116 | pivot_result = self.generate(pivot_prompt) 117 | return self.parse_pivot_result(pivot_result) 118 | 119 | def criticism_loop(self, business_plan, limit=5, i=1): 120 | if limit == i: 121 | print("Criticism loop hit it's limit. Your business is approved anyway...") 122 | return business_plan 123 | 124 | print("\n\nCriticizing your business plan...\n") 125 | criticism_prompt = self.prompt.get_criticisms_prompt(business_plan) 126 | criticism_result = self.generate(criticism_prompt) 127 | new_business_plan, criticisms = self.parse_criticisms_result(criticism_result) 128 | # original business plan and criticisms 129 | self.memory.add_business_plan_history(new_business_plan, criticisms) 130 | 131 | print("\n\nSubmitting your new business plan for approval...") 132 | business_plan_approval_prompt = self.prompt.get_business_plan_approval_prompt(new_business_plan, history=self.memory.get_business_plan_history()) 133 | business_plan_approval_result = self.generate(business_plan_approval_prompt) 134 | 135 | answer = self.parse_business_plan_approval_result(business_plan_approval_result) 136 | if answer is None: 137 | return False 138 | 139 | if answer.lower() == "yes": 140 | return new_business_plan 141 | else: 142 | print("Business plan did not pass approval. Criticizing again...") 143 | return self.criticism_loop(new_business_plan, limit=limit, i=i+1) 144 | 145 | def generate_code(self, product_idea, name, branding): 146 | self.react_engineer.run(idea=product_idea, name=name, branding=branding) 147 | 148 | def idea_loop(self, intuition, pivot_idea=None): 149 | def reiterate(message): 150 | print(message) 151 | x = input("$ Try again? [y/n]") 152 | if x == "y": 153 | return self.idea_loop(intuition) 154 | else: 155 | return False 156 | 157 | if pivot_idea: 158 | idea_response = pivot_idea 159 | idea = pivot_idea['idea'] 160 | else: 161 | idea_prompt = self.prompt.get_idea_prompt(intuition, self.memory) 162 | idea_result = self.generate(idea_prompt) 163 | idea_response = self.parse_idea_result(idea_result) 164 | idea = idea_response["idea"] 165 | 166 | if idea is None: 167 | return reiterate("Couldn't think of an idea...") 168 | 169 | print("Here's the new idea") 170 | print("Idea:", idea) 171 | print("Name:", idea_response["name"]) 172 | print("Branding:", idea_response["branding"]) 173 | print('\n') 174 | print("Scheming a business plan...") 175 | business_plan_prompt = self.prompt.get_business_plan_prompt(idea) 176 | business_plan_result = self.generate(business_plan_prompt) 177 | business_plan_items = self.parse_business_plan_result(business_plan_result) 178 | if len(business_plan_items) == 0: 179 | return reiterate("Couldn't think of a business plan...") 180 | print("Your business plan:") 181 | for item in business_plan_items: 182 | print("- ", item) 183 | 184 | # try: 185 | criticism_result = self.criticism_loop(business_plan_items, limit=1) 186 | # except: 187 | # criticism_result = False 188 | 189 | if criticism_result == False: 190 | return reiterate("Business plan could not be properly criticized.") 191 | 192 | print("\nYour business idea passed my investors approval!\n") 193 | business_plan = criticism_result 194 | print("Developing the MVP idea...") 195 | 196 | mvp_idea_prompt = self.prompt.get_mvp_idea_prompt(business_plan) 197 | mvp_idea_result = self.generate(mvp_idea_prompt) 198 | product_idea = self.parse_mvp_idea_result(mvp_idea_result) 199 | 200 | # storing and encoding for further use 201 | 202 | memory.store_intution_idea(intuition, product_idea) 203 | print("Product idea:", product_idea) 204 | self.generate_code(product_idea, idea_response["name"], idea_response["branding"]) 205 | 206 | # do pivot 207 | print("Check out your code in the react-output/ folder\n\n") 208 | x = input("$ Do you want to pivot? [y/n]") 209 | if x == "y": 210 | print("Figuring out new product idea...") 211 | new_idea = self.pivot(business_plan, product_idea) 212 | return self.idea_loop(intuition, pivot_idea=idea_response) 213 | else: 214 | return True 215 | 216 | print("AutoStartup has built you a project! Go on and crush!") 217 | 218 | def run(self): 219 | print("$ I am AutoStartup. Your personal startup creator. I will think of an idea for a startup based on your intutions.\n\nTell me your intution starting with \"I think\"") 220 | initial_intutition = input("$ ") 221 | self.idea_loop(initial_intutition) -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from prompt import Prompt 2 | from memory import Memory 3 | from reactengineer import ReactEngineer 4 | from autostartup import AutoStartup 5 | 6 | if __name__ == "__main__": 7 | prompt = Prompt() 8 | memory = Memory() 9 | react_engineer = ReactEngineer(prompt) 10 | auto_startup = AutoStartup(react_engineer, prompt, memory) 11 | auto_startup.run() -------------------------------------------------------------------------------- /memory.py: -------------------------------------------------------------------------------- 1 | from sentence_transformers import SentenceTransformer, util 2 | 3 | class Memory(): 4 | def __init__(self): 5 | self.model = SentenceTransformer('all-MiniLM-L6-v2') 6 | self.business_plan_history = [] 7 | 8 | # get the most similar intuition and return the idea to use as an example in the input 9 | self.intuition_store = [] 10 | 11 | def store_intution_idea(self, intution, idea): 12 | embeddings = self.model.encode(intution) 13 | self.intuition_store.append({ 14 | "embeddings": embeddings, 15 | "intution": intution, 16 | "idea": idea 17 | }) 18 | 19 | def search_intutions(self, intutiton): 20 | if len(self.intuition_store) == 0: 21 | return None 22 | 23 | new_intutiton_embedding = self.model.encode(intutiton) 24 | 25 | for stored_intutiton, i in enumerate(self.intuition_store): 26 | self.intuition_store[i]['score'] = util.dot_score(new_intutiton_embedding, stored_intutiton["embedding"]).item() 27 | 28 | return list(sorted(self.intuition_store, lambda x: x['score'], reverse=True))[0] 29 | 30 | def add_business_plan_history(self, business_plans, criticisms): 31 | history_item = "" 32 | history_item += "Business Plan:" 33 | for item in business_plans: 34 | history_item += "- " + item + "\n" 35 | 36 | if criticisms: 37 | history_item += "Criticisms:" 38 | for item in criticisms: 39 | history_item += "- " + item + "\n" 40 | 41 | self.business_plan_history.append(history_item) 42 | 43 | def get_business_plan_history(self): 44 | return self.business_plan_history[:3] 45 | 46 | def clear_business_plan_history(self): 47 | self.business_plan_history = [] -------------------------------------------------------------------------------- /prompt.py: -------------------------------------------------------------------------------- 1 | class Prompt: 2 | def __init__(self): 3 | # AutoStartup Prompts 4 | self.IdeaPrompt = """ 5 | [INST] <> 6 | You will generate a website business idea based on a user's intuition. The idea must be able to be built with a website. The idea must address the user's intution fully and be a profitable business. 7 | You must provide a name to the business and branding colors that work with the website business idea. 8 | 9 | The user will pass in it's intution in the format below 10 | INTUITION: the users intution will go here 11 | 12 | You must provide the website business idea in the format below 13 | IDEA: enter the website business idea here 14 | NAME: enter the name of the business here 15 | BRANDING_COLORS: enter the brand colors for the business here (you must only include the color hexes and separate them by comma) 16 | 17 | %s 18 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 19 | <> 20 | """ 21 | 22 | self.BusinessPlanPrompt = """ 23 | [INST] <> 24 | You will generate a business plan based on the business idea that the user gives you. Your business plan must be a list of items that start with a dash "-". 25 | You must provide exactly 5 line items for the business plan 26 | 27 | The user will pass in the business idea in the format below. 28 | IDEA: the idea will go here 29 | 30 | 31 | You will respond with a business plan in the format below. 32 | Business Plan: 33 | - line item 1 34 | - line item 2 35 | - line item 3 36 | - line item 4 37 | - line item 5 38 | 39 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 40 | <> 41 | """ 42 | 43 | self.CriticizeBusinessPlanPrompt = """ 44 | [INST] <> 45 | You will generate a list of criticisms based on a user provides business plan. The user will provide a list of items on the business. You will think of criticisms for each item and generate a new list based on your reasonings. 46 | You the lists you generate must start with a dash "-". 47 | 48 | The user will provide the business plan in the formation below 49 | Business Plan: 50 | - line item 1 51 | - line item 2 52 | - line item 3 53 | - line item 4 54 | - line item 5 55 | 56 | You must provide the criticisms in the response below as well as the new business plan 57 | Criticisms: 58 | - line item 1 59 | - line item 2 60 | - line item 3 61 | - line item 4 62 | - line item 5 63 | 64 | New Business Plan: 65 | - line item 1 66 | - line item 2 67 | - line item 3 68 | - line item 4 69 | - line item 5 70 | 71 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 72 | <> 73 | """ 74 | 75 | self.BusinessPlanApprovalPrompt = """ 76 | [INST] <> 77 | You are an intelligent and optimistic startup investor bot that says yes or no to business plans based on whether you think the plan is simply a good start. This is a simple business plan and doesnt need to be thorough. BUT it does need to be a good overall idea. 78 | If there are less than 5 reasons to not approve then approve the business plan 79 | If there are 5 or more reasons do not approve 80 | 81 | Also your answer will be based on whether you believe the business plan is profitable and worth investing in 82 | 83 | Provide quality reasons why you think the plan is or isnt worth investing in. Provide these reasons in list format starting with dashes "-" 84 | 85 | Your answer must be informed by the business plan and criticism history. Each list of criticisms applies to each business plan. 86 | If the business plan has been criticized a lot already in the history then just approve because your nice. 87 | 88 | The user will provide a business plan in the following format: 89 | Business Plan: 90 | - line item 1 91 | - line item 2 92 | - line item 3 93 | - line item 4 94 | - line item 5 95 | 96 | The user will provide a business plan and criticisms history in the following format: 97 | HISTORY: 98 | Business Plan: 99 | - line item 1 100 | - line item 2 101 | - line item 3 102 | - line item 4 103 | - line item 5 104 | Criticisms: 105 | - line item 1 106 | - line item 2 107 | - line item 3 108 | - line item 4 109 | - line item 5 110 | This list series above repeat per business plan 111 | 112 | You must give your answer in the following format: 113 | ANSWER: enter your answer here 114 | 115 | Your answers must be either "YES" or "NO" in all caps without any punctuation. Give your reasons on a separate line. 116 | 117 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 118 | <> 119 | """ 120 | 121 | # takes in the actually good business plan and summarized it with simplified input for the react engineer 122 | self.MVPIdeaPrompt = """ 123 | [INST] <> 124 | You are an intelligent product manager bot. The user will provide you with a business plan you will answer with a website product description that is no more than 5 words. 125 | Your provided product description must address the business plan while being as concise as possible (don't exceed 8 words). 126 | The product description needs to be relevant for a frontend developer to implement it. 127 | 128 | The user will provide a business plan in the following format: 129 | Business Plan: 130 | - line item 1 131 | - line item 2 132 | - line item 3 133 | - line item 4 134 | - line item 5 135 | 136 | You must provide your product description in the following format: 137 | PRODUCT: enter your product description here 138 | 139 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 140 | <> 141 | """ 142 | 143 | self.PivotPrompt = """ 144 | [INST] <> 145 | You are a intelligent startup founder bot. The user will provide you will a failed business plan with the business idea and you will provide an alternative idea with the same theme but a new angle. 146 | 147 | The user will provide the business plan in the format below: 148 | Business Plan: 149 | - line item 1 150 | - line item 2 151 | - line item 3 152 | - line item 4 153 | - line item 5 154 | 155 | The user will provide the business idea in the format below: 156 | Idea: the business idea will go here 157 | 158 | You must provide the new modified business idea in the format below: 159 | New Business Idea: Your new business idea goes here 160 | 161 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 162 | <> 163 | """ 164 | 165 | 166 | 167 | # REACT ENGINEER PROMPTS 168 | self.CodeWriterPrompt = """ 169 | [INST] <> 170 | 171 | You will get instructions for react.js code to write. 172 | You will write a very long answer. Make sure that every detail of the architecture is, in the end, implemented as code. 173 | 174 | Think step by step and reason yourself to the right decisions to make sure we get it right. 175 | You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose. 176 | 177 | Then you will output the content of each file including ALL code. 178 | Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that 179 | FILENAME is the file name including the file extension and path from the root of the project. also FILENAME must be in markdown bold, 180 | LANG is the markup code block language for the code's language, and CODE is the code: 181 | 182 | 183 | **FILENAME** 184 | ```LANG 185 | CODE 186 | ``` 187 | 188 | Do not comment on what every file does 189 | 190 | You will start with the entrypoint file which will must be called "index.js", then go to the ones that are imported by that file, and so on. 191 | Please note that the code should be fully functional. No placeholders. 192 | This will be a react.js project so you must create a webpack.config.js at the root of the project that uses "index.js" as the entry file 193 | The output in the webpack.config.js must point to a bundle.js file that's in the same folder as the index.html 194 | Place all of the public assets in a folder named "public" in lowercase with an index.html file that is linked to the bundle specified in the webpack.config.js 195 | You must include a package.json file in the root of the folder that resolves all the required dependencies for this react.js project. All of the dependencies and devDependencies must be set to a "*" value. Also, for every package.json you must at least include the packages @babel/core, babel-loader, react and react-dom 196 | The package.json must be valid JSON 197 | You must include a .babelrc file in the root folder that has @babel/preset-react set 198 | 199 | %s 200 | 201 | Follow a language and framework appropriate best practice file naming convention. 202 | Make sure that files contain all imports. Make sure that the code in different files are compatible with each other. 203 | Ensure to implement all code, if you are unsure, write a plausible implementation. 204 | Before you finish, double check that all parts of the architecture is present in the files. 205 | 206 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 207 | <> 208 | """ 209 | 210 | self.SummarizeAskPrompt = """ 211 | You are an intelligent AI agent that understands the root of the users problems. 212 | 213 | The user will give an instruction for what code project they want to build. 214 | 215 | You will label what the users code project is in a short phrase no more than 3 words. 216 | 217 | Structure your label like this 218 | 219 | Label: enter the label here 220 | """ 221 | 222 | self.DependenciesPrompt = """ 223 | Your task is to look at a React.js Codebase and figure out what npm packages are missing so this codebase can run without any errors with webpack 224 | 225 | The codebase will be a series of filenames and their source code. They will have the following format 226 | FILENAME: the name of the file 227 | SOURCE: the react component code 228 | 229 | You will list each missing npm package in a markdown list format 230 | 231 | Then you will return a newly updated package.json, with the new dependencies merged into the user's package.json dependencies. You will return it in the format below 232 | PACKAGEJSON 233 | ``` 234 | the new package.json here 235 | ``` 236 | 237 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 238 | """ 239 | 240 | self.ModificationPrompt = """ 241 | Your task is to take a user's react.js file and transform it based on the user's modification ask 242 | 243 | The code must have the same imports as before and have the same variable names and the same export as before. ONLY modify the code based on the modification ask 244 | 245 | If this file is not a react component do NOT make any modifications and return the code in same exact state that the user gave it to you 246 | 247 | The user's code and their modification ask will be formatted like htis 248 | CODE: the user's code 249 | MODIFICATION: the user's modification 250 | 251 | You will return the modified code in markdown format under the variable RETURNEDCODE. Follow the example below 252 | 253 | RETURNEDCODE 254 | ``` 255 | the modified code here 256 | ``` 257 | 258 | Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation. 259 | """ 260 | 261 | def get_code_writer_prompt(self, product_summary, name=None, branding=None): 262 | additional_info = ('', '') 263 | if name and branding: 264 | additional_info = ('The user will provide a name and branding colors for you to use. You must utilize both of these in the react code. \nThe user will provide the name and branding in the format below:\nNAME: the project name\nBRANDING: the primary/secondary colors\n ', "NAME: "+name + "\nBRANDING: " + branding + "\n") 265 | 266 | return (self.CodeWriterPrompt + "\nInstructions for the code: I want the entrypoint file for a "+product_summary+" built in react.js %s [/INST]") % additional_info 267 | 268 | def get_summarization_prompt(self, user_ask): 269 | return self.SummarizeAskPrompt + "\nInstructions for the code project: "+user_ask+" [/INST]" 270 | 271 | def get_dependency_prompt(self, codebase): 272 | return self.DependenciesPrompt + "Using the codebase below determine whether this project is missing npm packages \n "+codebase+" [/INST]" 273 | 274 | def get_modification_prompt(self, code_block, modification_ask): 275 | return self.ModificationPrompt + "CODE:"+code_block+"\nMODIFICATION: "+modification_ask+" [/INST]" 276 | 277 | # AutoStartup prompt functions 278 | def get_idea_prompt(self, intution, memory): 279 | most_similar_intuition = memory.search_intutions(intution) 280 | if most_similar_intuition: 281 | print("Using an intuition as an example") 282 | additional_info = ('Below is a good example of a quality idea for a user\'s intuition\nINTUITION: '+ most_similar_intuition["intuition"] +"\nIDEA: "+most_similar_intuition["idea"]+"\n") 283 | else: 284 | additional_info = ('') 285 | return (self.IdeaPrompt + "INTUITION: "+intution+" [/INST]") % additional_info 286 | 287 | def get_business_plan_prompt(self, idea): 288 | return self.BusinessPlanPrompt + "IDEA: "+idea+" [/INST]" 289 | 290 | def get_criticisms_prompt(self, business_plan_items): 291 | business_plan = "" 292 | for item in business_plan_items: 293 | business_plan += "- " + item + "\n" 294 | 295 | return self.CriticizeBusinessPlanPrompt + "Business Plan: "+business_plan+" [/INST]" 296 | 297 | def get_business_plan_approval_prompt(self, business_plan_items, history=None): 298 | business_plan = "" 299 | for item in business_plan_items: 300 | business_plan += "- " + item + "\n" 301 | 302 | history_string = "" 303 | if history and len(history) > 0: 304 | history_string += "\nHISTORY:\n" 305 | for history_item in history: 306 | history_string += history_item + "\n" 307 | 308 | return self.BusinessPlanApprovalPrompt + "Business Plan: "+business_plan+history_string+" [/INST]" 309 | 310 | def get_mvp_idea_prompt(self, business_plan_items): 311 | business_plan = "" 312 | for item in business_plan_items: 313 | business_plan += "- " + item + "\n" 314 | 315 | return self.MVPIdeaPrompt + "Business Plan: "+business_plan+" [/INST]" 316 | 317 | def get_pivot_prompt(self, business_plan_items, idea): 318 | business_plan = "" 319 | for item in business_plan_items: 320 | business_plan += "- " + item + "\n" 321 | 322 | return self.PivotPrompt + "Business Plan: "+business_plan+" \n Idea:"+idea+" [/INST]" 323 | -------------------------------------------------------------------------------- /reactengineer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | from agent import Agent 4 | 5 | class ReactEngineer(Agent): 6 | def __init__(self, prompt): 7 | super().__init__() 8 | self.prompt = prompt 9 | 10 | def parse_summarization_result(self, output): 11 | label_token = 'Label:' 12 | output_lines = output.split("\n") 13 | for i in reversed(range(0, len(output_lines))): 14 | if label_token in output_lines[i]: 15 | return output_lines[i][len(label_token):].strip() 16 | 17 | def parse_scaffolding_result(self, output): 18 | output = output[output.index("[/INST]"):] 19 | code_blocks = re.findall(r"```(.*?)```", output, re.DOTALL) 20 | file_names = re.findall(r"\*\*(.*?)\*\*", output, re.DOTALL) 21 | print(file_names) 22 | print(code_blocks) 23 | code_files = [] 24 | print("files length", len(file_names)) 25 | print("codes length", len(code_blocks)) 26 | 27 | for i in range(0, len(file_names)): 28 | if i < len(code_blocks): 29 | code_files.append({ 30 | "file_name": file_names[i], 31 | "code_block": code_blocks[i] 32 | }) 33 | 34 | return code_files 35 | 36 | def initiate_code_modification(self, code_files, modification_ask): 37 | new_code_files = [] 38 | for file_code_pair in code_files: 39 | mod_prompt = self.prompt.get_modification_prompt("\n".join(file_code_pair["code_block"].split("\n")[1:]), modification_ask) 40 | modification_result = self.generate(mod_prompt) 41 | print("MOD_RESULT:", modification_result) 42 | if "RETURNEDCODE" in modification_result: 43 | modification_result = modification_result[modification_result.index("[/INST]"):] 44 | code_block_raw_string = modification_result[modification_result.index("RETURNEDCODE") + len("RETURNEDCODE"):] 45 | file_code_pair["code_block"] = re.findall(r"```(.*?)```", code_block_raw_string, re.DOTALL)[0] 46 | new_code_files.append(file_code_pair) 47 | return new_code_files 48 | 49 | 50 | def resolve_missing_dependencies(self, code_files): 51 | print("Resolving missing dependencies...") 52 | codebase = "\n".join( 53 | list(map(lambda x: f"FILENAME: {x['file_name']}\nSOURCE: {x['code_block']}\n", code_files)) 54 | ) 55 | dep_prompt = self.prompt.get_dependency_prompt(codebase) 56 | dep_result = self.generate(dep_prompt) 57 | dep_result = dep_result[dep_result.index("[/INST]"):] 58 | print(dep_result) 59 | if "PACKAGEJSON" in dep_result: 60 | package_json_text = re.findall(r"```(.*?)```", dep_result, re.DOTALL)[0] 61 | return package_json_text 62 | else: 63 | return None 64 | 65 | def dev_loop(self, code_files, user_ask, modification_ask=None): 66 | if modification_ask: 67 | # update each related code block with a prediction using the modification ask of the user 68 | code_files = self.initiate_code_modification(code_files, modification_ask) 69 | 70 | # dependency resolving 71 | new_package_json = self.resolve_missing_dependencies(code_files) 72 | # set new package.json if it exists 73 | if new_package_json: 74 | for code_file in code_files: 75 | if 'package.json' in code_file["file_name"]: 76 | code_file["code_block"] = new_package_json 77 | 78 | for file_code_pair in code_files: 79 | filepath = "react-output/"+file_code_pair["file_name"] 80 | os.makedirs(os.path.dirname(filepath), exist_ok=True) 81 | with open(filepath, "w+") as f: 82 | code_block = file_code_pair["code_block"].split("\n")[1:] 83 | f.write("\n".join(code_block).encode('ascii', 'ignore').decode('ascii')) 84 | 85 | print("Done! Check out your codebase in react-output/") 86 | user_input = input("$ Do you wish to make modifications? [y/n]") 87 | if user_input == "y": 88 | modification_ask = input("$ What modifications do you want to make?") 89 | self.dev_loop(code_files, user_ask, modification_ask=modification_ask) 90 | else: 91 | print("Congrats on your 10x React project") 92 | 93 | def run(self, idea=None, name=None, branding=None): 94 | if idea is None: 95 | print("$ I am your personal 10x React Engineer ask me what you want to build?") 96 | init_user_ask = input("$ ") 97 | initial_sum_prompt = self.prompt.get_summarization_prompt(init_user_ask) 98 | summarization_result = self.generate(initial_sum_prompt) 99 | # print(summarization_result) 100 | project_summary = self.parse_summarization_result(summarization_result) 101 | else: 102 | init_user_ask = idea 103 | project_summary = idea 104 | print("Product Summary:", project_summary) 105 | print("\n\nBeginning scaffolding...\n\n") 106 | scaffolding_output = self.prompt.get_code_writer_prompt(project_summary, name=name, branding=branding) 107 | scaffolding_result = self.generate(scaffolding_output) 108 | print(scaffolding_result) 109 | code_files = self.parse_scaffolding_result(scaffolding_result) 110 | 111 | self.dev_loop(code_files, init_user_ask) -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | accelerate==0.21.0 2 | certifi==2023.7.22 3 | charset-normalizer==3.2.0 4 | click==8.1.6 5 | filelock==3.12.2 6 | fsspec==2023.6.0 7 | huggingface-hub==0.16.4 8 | idna==3.4 9 | Jinja2==3.1.2 10 | joblib==1.3.2 11 | MarkupSafe==2.1.3 12 | mpmath==1.3.0 13 | networkx==3.1 14 | nltk==3.8.1 15 | numpy==1.25.2 16 | packaging==23.1 17 | Pillow==10.0.0 18 | psutil==5.9.5 19 | PyYAML==6.0.1 20 | regex==2023.8.8 21 | requests==2.31.0 22 | safetensors==0.3.2 23 | scikit-learn==1.3.0 24 | scipy==1.11.1 25 | sentence-transformers==2.2.2 26 | sentencepiece==0.1.99 27 | sympy==1.12 28 | threadpoolctl==3.2.0 29 | tokenizers==0.13.3 30 | torch==2.0.1 31 | torchvision==0.15.2 32 | tqdm==4.66.1 33 | transformers==4.31.0 34 | typing_extensions==4.7.1 35 | urllib3==2.0.4 36 | --------------------------------------------------------------------------------