diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index e5428c7f..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dfe07704..00000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..91abb11f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml new file mode 100644 index 00000000..9fc66b12 --- /dev/null +++ b/.github/workflows/codacy.yml @@ -0,0 +1,61 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow checks out code, performs a Codacy security scan +# and integrates the results with the +# GitHub Advanced Security code scanning feature. For more information on +# the Codacy security scan action usage and parameters, see +# https://github.com/codacy/codacy-analysis-cli-action. +# For more information on Codacy Analysis CLI in general, see +# https://github.com/codacy/codacy-analysis-cli. + +name: Codacy Security Scan + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '22 1 * * 0' + +permissions: + contents: read + +jobs: + codacy-security-scan: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + name: Codacy Security Scan + runs-on: ubuntu-latest + steps: + # Checkout the repository to the GitHub Actions runner + - name: Checkout code + uses: actions/checkout@v3 + + # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis + - name: Run Codacy Analysis CLI + uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b + with: + # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository + # You can also omit the token and run the tools that support default configurations + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + verbose: true + output: results.sarif + format: sarif + # Adjust severity of non-security issues + gh-code-scanning-compat: true + # Force 0 exit code to allow SARIF file generation + # This will handover control about PR rejection to the GitHub side + max-allowed-issues: 2147483647 + + # Upload the SARIF file generated in the previous step + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d9005f2c..00000000 --- a/.gitignore +++ /dev/null @@ -1,152 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ diff --git a/Archive/.vscode/extensions.json b/Archive/.vscode/extensions.json new file mode 100644 index 00000000..aa211aca --- /dev/null +++ b/Archive/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "mongodb.mongodb-vscode" + ] +} \ No newline at end of file diff --git a/Archive/.vscode/settings.json b/Archive/.vscode/settings.json new file mode 100644 index 00000000..f2dceb31 --- /dev/null +++ b/Archive/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python.linting.enabled": false, + "python.linting.pylintEnabled": false, + "python.linting.banditEnabled": true +} \ No newline at end of file diff --git a/Archive/External_Modified_Libs_2/README.md b/Archive/External_Modified_Libs_2/README.md new file mode 100644 index 00000000..ff2fbf04 --- /dev/null +++ b/Archive/External_Modified_Libs_2/README.md @@ -0,0 +1,10 @@ +# External Modified Libraries + +This folder contains modified versions of external libraries. The modifications are done to make the libraries compatible with the project. + +## Libraries +--- +### Ghost +The Ghost library can generate newsletters with AI. The original library can be found [here](https://github.com/TryGhost/Ghost) + +### Fig-Autocomplete \ No newline at end of file diff --git a/Archive/Media/boat_colors.svg b/Archive/Media/boat_colors.svg new file mode 100644 index 00000000..41c3da41 --- /dev/null +++ b/Archive/Media/boat_colors.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/ff6b35-f7c59f-efefd0-004e89-1a659e + \ No newline at end of file diff --git a/Archive/Media/dark_purples.svg b/Archive/Media/dark_purples.svg new file mode 100644 index 00000000..0dd0718b --- /dev/null +++ b/Archive/Media/dark_purples.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/3a015c-4f0147-35012c-290025-11001c + \ No newline at end of file diff --git a/Archive/Media/nice_bright_red.svg b/Archive/Media/nice_bright_red.svg new file mode 100644 index 00000000..7c1ccf8b --- /dev/null +++ b/Archive/Media/nice_bright_red.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/cbe896-fffffc-beb7a4-ff7f11-ff1b1c + \ No newline at end of file diff --git a/Archive/Media/nice_vanilla.svg b/Archive/Media/nice_vanilla.svg new file mode 100644 index 00000000..3340375d --- /dev/null +++ b/Archive/Media/nice_vanilla.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/0a0903-ff0000-ff8200-ffc100-ffeaae + \ No newline at end of file diff --git a/Archive/Media/soothing_purple.svg b/Archive/Media/soothing_purple.svg new file mode 100644 index 00000000..a2f82ec1 --- /dev/null +++ b/Archive/Media/soothing_purple.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/5f0f40-9a031e-fb8b24-e36414-0f4c5c + \ No newline at end of file diff --git a/Archive/Media/surreal_ice_cream.svg b/Archive/Media/surreal_ice_cream.svg new file mode 100644 index 00000000..d90094da --- /dev/null +++ b/Archive/Media/surreal_ice_cream.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/2b2d42-92dce5-f8f7f9-f7ec59-ff66d8 + \ No newline at end of file diff --git a/Archive/Media/winfonovacolorpalette.svg b/Archive/Media/winfonovacolorpalette.svg new file mode 100644 index 00000000..45b01069 --- /dev/null +++ b/Archive/Media/winfonovacolorpalette.svg @@ -0,0 +1,7 @@ + + + + ,,,, + Exported from Coolors.co + https://coolors.co/4e0250-801a86-645986-8fe388-58bc82 + \ No newline at end of file diff --git a/Archive/Media/winfonovacolorpalette.txt b/Archive/Media/winfonovacolorpalette.txt new file mode 100644 index 00000000..789b9ca7 --- /dev/null +++ b/Archive/Media/winfonovacolorpalette.txt @@ -0,0 +1,35 @@ +/* Coolors Exported Palette - https://coolors.co/fe4a49-2ab7ca-fed766-e6e6ea-f4f4f8 */ + +- Tailwind + +{ 'tomato': { DEFAULT: '#fe4a49', 100: '#410000', 200: '#820101', 300: '#c30101', 400: '#fe0707', 500: '#fe4a49', 600: '#fe6d6d', 700: '#fe9191', 800: '#ffb6b6', 900: '#ffdada' }, 'moonstone': { DEFAULT: '#2ab7ca', 100: '#082529', 200: '#114a51', 300: '#196f7a', 400: '#2193a3', 500: '#2ab7ca', 600: '#4fcbdb', 700: '#7bd8e4', 800: '#a7e5ed', 900: '#d3f2f6' }, 'mustard': { DEFAULT: '#fed766', 100: '#473500', 200: '#8e6b01', 300: '#d5a001', 400: '#fec620', 500: '#fed766', 600: '#fee085', 700: '#ffe8a4', 800: '#fff0c2', 900: '#fff7e1' }, 'platinum': { DEFAULT: '#e6e6ea', 100: '#2a2a33', 200: '#545465', 300: '#818196', 400: '#b3b3c0', 500: '#e6e6ea', 600: '#ebebee', 700: '#f0f0f2', 800: '#f5f5f7', 900: '#fafafb' }, 'ghost_white': { DEFAULT: '#f4f4f8', 100: '#26263c', 200: '#4c4c77', 300: '#7b7bab', 400: '#b7b7d1', 500: '#f4f4f8', 600: '#f5f5f9', 700: '#f8f8fa', 800: '#fafafc', 900: '#fdfdfd' } } + +- CSV + +fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8 + +- With # + +#fe4a49, #2ab7ca, #fed766, #e6e6ea, #f4f4f8 + +- Array + +["fe4a49","2ab7ca","fed766","e6e6ea","f4f4f8"] + +- Object + +{"Tomato":"fe4a49","Moonstone":"2ab7ca","Mustard":"fed766","Platinum":"e6e6ea","Ghost white":"f4f4f8"} + +- Extended Array + +[{"name":"Tomato","hex":"fe4a49","rgb":[254,74,73],"cmyk":[0,71,71,0],"hsb":[0,71,100],"hsl":[0,99,64],"lab":[58,67,41]},{"name":"Moonstone","hex":"2ab7ca","rgb":[42,183,202],"cmyk":[79,9,0,21],"hsb":[187,79,79],"hsl":[187,66,48],"lab":[68,-29,-20]},{"name":"Mustard","hex":"fed766","rgb":[254,215,102],"cmyk":[0,15,60,0],"hsb":[45,60,100],"hsl":[45,99,70],"lab":[87,1,60]},{"name":"Platinum","hex":"e6e6ea","rgb":[230,230,234],"cmyk":[2,2,0,8],"hsb":[240,2,92],"hsl":[240,9,91],"lab":[91,1,-2]},{"name":"Ghost white","hex":"f4f4f8","rgb":[244,244,248],"cmyk":[2,2,0,3],"hsb":[240,2,97],"hsl":[240,22,96],"lab":[96,1,-2]}] + +- XML + + + + + + + + \ No newline at end of file diff --git a/Archive/NovaSystem_v0.0.1/NovaHelper.py b/Archive/NovaSystem_v0.0.1/NovaHelper.py new file mode 100644 index 00000000..f4735ca3 --- /dev/null +++ b/Archive/NovaSystem_v0.0.1/NovaHelper.py @@ -0,0 +1,90 @@ +import time +<<<<<<< HEAD +import logging +import openai +import os +from dotenv import load_dotenv + +# Load environment variables from the .env file +load_dotenv() + +# Retrieve and debug the OpenAI API key from environment variables +os.getenv("OPENAI_API_KEY") + +# Validate that the API key exists +if os.getenv("OPENAI_API_KEY") is None: + raise ValueError("API key not found in environment variables.") + +# # Define the prompt and model +# prompt = "Translate the following English text to French: '{}'" +# text = "Hello, world" +# model = "gpt-3.5-turbo" # Replace with actual GPT-4 identifier when available + +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) + +class NovaHelper(): + _default_delay = 0.022 + + def __init__(self): + self.classification = 'NovaHelper' + + def test(self): + self.stc(f'Testing NovaHelper...\n') + self.stc(f'classification: {self.classification}\n') + self.stc(f'{self.classification} class instantiated successfully.') + + def stream_to_console(self, message, delay=_default_delay): + for char in message: + print(char, end='', flush=True) + time.sleep(delay) + + def stc(self, message, delay=_default_delay): + self.stream_to_console(message, delay) + +<<<<<<< HEAD + def fetch_response_from_default_API(self, request={'API': 'openai', 'request': {'prompt': 'Hello, world', 'model': 'gpt-3.5-turbo', 'max_tokens': 60}}): + # Unpack request + print(f'Helper Calling API...\n') + for k, v in request.items(): + print(f'{k}: {v}') + # Make API call and return response + pass + + def make_api_call(self, callback=None): + # Make API call and return response + print(type(callback)) + if type(callback) is str: + # Make API to OpenAI and return resopnse + # response = openai.Completion.create( + # model = 'gpt-3.5-turbo', + # prompt='This is a test', + # max_tokens=5, + # api_key=os.getenv("OPENAI_API_KEY") + # ) + + openai.api_key = os.getenv("OPENAI_API_KEY") + response = openai.Completion.create( + model="gpt-3.5-turbo-instruct-0914", + prompt=callback, + max_tokens=50, + temperature=.5 + ) + + return response + + if callback is not None: + callback() + else: + self.fetch_response_from_default_API() + pass + +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) +def stc(message, delay=0.022): + helper = NovaHelper() + helper.stream_to_console(message, delay) + +if __name__ == "__main__": + helper = NovaHelper() + helper.test() diff --git a/Archive/NovaSystem_v0.0.1/NovaSystem.py b/Archive/NovaSystem_v0.0.1/NovaSystem.py new file mode 100644 index 00000000..9fb0a643 --- /dev/null +++ b/Archive/NovaSystem_v0.0.1/NovaSystem.py @@ -0,0 +1,213 @@ +# Imports +import os +from NovaHelper import NovaHelper, stc +<<<<<<< HEAD +import openai +import os +from dotenv import load_dotenv + +# Load environment variables from the .env file +load_dotenv() + +# Retrieve and debug the OpenAI API key from environment variables +openai.api_key = os.getenv("OPENAI_API_KEY") +======= + +>>>>>>> b6f8c82 (🪄 📌 🔎x) + +''' +The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. + +The Nova System relies on a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, an AI model acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. +''' + +''' +The Nova System process progresses iteratively through these key stages: + +1. Problem Unpacking: Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. +2. Expertise Assembly: Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. +3. Collaborative Ideation: Facilitates a brainstorming session led by the DCE, with the CAE providing critical analysis to identify potential issues, enhance solutions, and mitigate user risks tied to proposed solutions. +''' + +''' +The core roles in Nova Process are: + +DCE: The DCE weaves the discussion together, summarizing each stage concisely to enable shared understanding of progress and future steps. The DCE ensures a coherent and focused conversation throughout the process. + +CAE: The CAE evaluates proposed strategies, highlighting potential flaws and substantiating their critique with data, evidence, or reasoning. +''' +<<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +''' +This draft is a proof of concept for the NovaSystem. It is a simple implementation of the NovaSystem that uses a single Expert,the AI Tribunal, represented as three separate calls to OpenAI in a recursive iteravtive manner. This recursive iteration is the first step in the NovaSystem's ability to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions. +''' + + +<<<<<<< HEAD +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) +======= +>>>>>>> a7bca48 (Your descriptive commit message here) + +class NovaSystem: + _DEFAULT_CONFIG = { + "id": 00, + "name": "NovaSystem", + "version": 0.0, + "author": "Christopher Tavolazzi", + "description": "The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions.", +<<<<<<< HEAD + "duty": "Central Controller", +======= + "duty": "NovaSystem", +>>>>>>> b6f8c82 (🪄 📌 🔎x) + "experts": [NovaHelper()] + } + + def __init__(self, config=None): +<<<<<<< HEAD + self.helper = NovaHelper() + self.stc = self.helper.stc +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) + self.config = {} + self.config = self.load_default_config() + self.set_id() + self.set_name() + self.set_path() + self.run_startup_tests() + + def load_default_config(self): + stc(f'Loading default config for {self._DEFAULT_CONFIG["duty"]}...\n') + for key, value in self._DEFAULT_CONFIG.items(): +<<<<<<< HEAD + # print(f'{key}: {value}') + self.config[key] = value + # print(f'{self.config[key]} loaded successfully.\n') + stc(f'Config loaded successfully.\n') + return self.config +======= + print(f'{key}: {value}') + self.config[key] = value + stc(f'Config loaded successfully.\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def set_name(self): + if not hasattr(self, 'name'): + if 'name' in self.config: + self.name = self.config['name'] + else: + raise ValueError("No 'name' found in the config and the object. Cannot proceed.") + + def set_id(self): + if not hasattr(self, 'id'): + if 'id' in self.config: + self.id = self.config['id'] + else: + raise ValueError("No 'id' found in the config and the object. Cannot proceed.") + + def set_path(self): + if not hasattr(self, 'path'): + if 'path' in self.config: + self.path = self.config['path'] + elif 'path' in self._DEFAULT_CONFIG: + self.path = self._DEFAULT_CONFIG['path'] + elif 'path' not in self.config and 'path' not in self._DEFAULT_CONFIG: + # Set the path to the current directory + self.path = os.getcwd() + print(f'No path found in the config or the default config. Setting path to the current working directory: {self.path}') + else: + raise ValueError("No 'path' found. Cannot proceed.") + + def run_startup_tests(self): + # Check to make sure the object passes a series of instantiation tests to make sure it is ready to run + # First, check the config to make sure it is not empty and has the required keys + # Next, check the object to make sure it has the required attributes + # Finally, run the test() method to make sure the object is set up and ready to run +<<<<<<< HEAD + self.stc(f'Running startup tests for {self.name}...\n\n') +======= + self.stc(f'Running startup tests for {self.name}...\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def test(self): + # Run tests + +<<<<<<< HEAD + classname = self.__class__.__name__ + duty = self.config['duty'] + + self.stc(f'Testing {classname} || ID: {self.id}\n...') + + print(self.config) + for key, value in self.config.items(): + print(f'{key}: {value}') + print(f'\n') + print(f'{classname} instantiation test complete.\n') + self.stc(f'{classname} instantiated successfully.\n') + + def test_api_call(API_callback=self.helper.fetch_response_from_default_API): + self.stc(f"\n\nTesting API call...\n\n") + API_callback() + self.stc(f"API call test complete.\n") + + test_api_call() + + self.stc(f"All tests complete. {classname} ready.\n\n") + + def wait_for_user_input_and_call_openai(self): + self.stc(f"Waiting for user input...\n") + user_input = input() + self.stc(f"User input received: {user_input}\n") + + # self.make_decision(user_input) + + self.make_api_call(user_input) + + self.stc(f"Exiting...\n") + exit() + + # def make_decision(self, user_input): + # self.stc(f"Making decision...\n") + # self.stc(f"Decision made.\n") + + def make_api_call(self, user_input): + self.stc(f"Making API call...\n") + # response = self.helper.make_api_call(user_input) + # response = openai.api_key = os.getenv("OPENAI_API_KEY") + response = openai.Completion.create( + model="gpt-3.5-turbo-instruct-0914", + prompt=user_input, + max_tokens=50, + temperature=.5 + ) + + self.stc(f"API call complete.\n") + self.stc("Results:\n") + stc(response["choices"][0]["text"]) + print("\n\n") + closing_statement = "Thank you for using the Nova System. Goodbye." + stc(f"{closing_statement}\n\n") + +if __name__ == "__main__": + nova = NovaSystem() + nova.test() + nova.wait_for_user_input_and_call_openai() +======= + self.classname = self.__class__.__name__ + self.stc(f'Testing {self.classname} || ID: {self.id}\n...') + + self.stc(f'{self.classname} instantiated successfully with "duty": {self.duty} and "config":\n') + for key, value in self.config: + print(f'{key}: {value}') + print(f'\n') + self.stc(f'{self.classname} test complete.\n') + +if __name__ == "__main__": + nova_system = NovaSystem() + nova_system.test() +>>>>>>> b6f8c82 (🪄 📌 🔎x) diff --git a/Archive/NovaSystem_v0.0.1/NovaTribunal.py b/Archive/NovaSystem_v0.0.1/NovaTribunal.py new file mode 100644 index 00000000..f4dd527c --- /dev/null +++ b/Archive/NovaSystem_v0.0.1/NovaTribunal.py @@ -0,0 +1,46 @@ +<<<<<<< HEAD + + +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +# Define the Base Arbiter Class +class BaseArbiter: + def ask_question(self, question): + return input(question) + +# Define Subclasses for Each Area of Concern +class Arbiter_of_Possibility(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it possible?" + pass + +class Arbiter_of_Permission(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it permitted?" + pass + +class Arbiter_of_Preference(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it preferred?" + pass + +# Define the NovaTribunal Class +# Corrected NovaTribunal Class Initialization +class NovaTribunal: + def __init__(self, arbiter1=None, arbiter2=None, arbiter3=None): + self.arbiters = [arbiter1, arbiter2, arbiter3] + if all(arbiter is None for arbiter in self.arbiters): + self.arbiters = [Arbiter_of_Possibility(), Arbiter_of_Permission(), Arbiter_of_Preference()] + + def execute_tribunal(self): + user_responses = [] + for arbiter in self.arbiters: + question = "Please enter your query: " + user_response = arbiter.ask_question(question) + user_responses.append(user_response) + # Chained API call logic here + arbiter.process(user_response) + +if __name__ == "__main__": + tribunal = NovaTribunal() + tribunal.execute_tribunal() \ No newline at end of file diff --git a/Archive/NovaSystem_v0.0.1/imports.py b/Archive/NovaSystem_v0.0.1/imports.py new file mode 100644 index 00000000..92cb0425 --- /dev/null +++ b/Archive/NovaSystem_v0.0.1/imports.py @@ -0,0 +1,49 @@ +# Imports and Dependencies +import os +import sys +import time +import random +import datetime +import webbrowser +import subprocess +import speech_recognition as sr +import pyttsx3 +import pywhatkit +import wikipedia +import pyjokes +import pyautogui +import requests +import pyowm +import wolframalpha +import smtplib +import pyaudio +import json +import psutil +import pyautogui +import pygetwindow as gw +import pyperclip +import pyshorteners +import pyqrcode +import pyzbar.pyzbar as pyzbar +import cv2 +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.image as mpimg +import matplotlib.animation as animation +from matplotlib import style +from matplotlib import rc +from matplotlib import pyplot as plt +from matplotlib import patches as mpatches +from matplotlib import pyplot as plt +from matplotlib import cm +from matplotlib import gridspec +from matplotlib import ticker, cm as mpl_rc, colors, colorbar, patches, rc as mpl_rc, pyplot as plt, style, rcParams as mpl_rcParams, animation + + +# Importing the required modules +from tkinter import * + +# Import SDK packages +from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient + +# Importing the required modules diff --git a/Archive/NovaSystem_v0.0.1/main.py b/Archive/NovaSystem_v0.0.1/main.py new file mode 100644 index 00000000..63a67cef --- /dev/null +++ b/Archive/NovaSystem_v0.0.1/main.py @@ -0,0 +1,5 @@ +from NovaHelper import stc + +from NovaSystem import NovaSystem + +stc(f"Welcome to the NovaSystem.") diff --git a/SECURITY.md b/Archive/SECURITY.md similarity index 100% rename from SECURITY.md rename to Archive/SECURITY.md diff --git a/Archive/backup_requirements.txt b/Archive/backup_requirements.txt new file mode 100644 index 00000000..7f723b21 --- /dev/null +++ b/Archive/backup_requirements.txt @@ -0,0 +1,57 @@ +aiohttp==3.8.6 +aiosignal==1.3.1 +astroid==3.0.0 +async-timeout==4.0.3 +attrs==23.1.0 +bandit==1.7.5 +bidict==0.22.1 +blinker==1.6.3 +certifi==2023.7.22 +charset-normalizer==3.3.0 +click==8.1.7 +dill==0.3.7 +dparse==0.6.3 +Flask==3.0.0 +Flask-SocketIO==5.3.6 +frozenlist==1.4.0 +gitdb==4.0.10 +GitPython==3.1.37 +h11==0.14.0 +idna==3.4 +isort==5.12.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +lazy-object-proxy==1.9.0 +markdown-it-py==3.0.0 +MarkupSafe==2.1.3 +mccabe==0.7.0 +mdurl==0.1.2 +multidict==6.0.4 +netifaces==0.11.0 +openai==0.28.1 +packaging==23.2 +pbr==5.11.1 +pipdeptree==2.13.0 +platformdirs==3.11.0 +Pygments==2.16.1 +pylint==3.0.1 +pyparsing==3.1.1 +python-dotenv==1.0.0 +python-engineio==4.7.1 +python-socketio==5.9.0 +PyYAML==6.0.1 +requests==2.31.0 +rich==13.6.0 +ruamel.yaml==0.17.35 +ruamel.yaml.clib==0.2.8 +safety==2.3.5 +simple-websocket==1.0.0 +smmap==5.0.1 +stevedore==5.1.0 +tomlkit==0.12.1 +tqdm==4.66.1 +urllib3==2.0.6 +Werkzeug==3.0.1 +wrapt==1.15.0 +wsproto==1.2.0 +yarl==1.9.2 diff --git a/Archive/nova_system_tests/Clog.py b/Archive/nova_system_tests/Clog.py new file mode 100644 index 00000000..4448c6a3 --- /dev/null +++ b/Archive/nova_system_tests/Clog.py @@ -0,0 +1,42 @@ +import logging + +class Clog(): + # Set up a custom logger that's modular, extensible, and easy to use. + # Make use of various SDKs and APIs to make the logging experience as easy as possible. + # Use the logging module to log to a file. + + import logging + + def __init__(self, log_file_name='Clog.log'): + self.log_file_name = log_file_name + self.logger = logging.getLogger(__name__) + self.logger.setLevel(logging.DEBUG) + self.formatter = logging.Formatter('%(asctime)s:%(name)s:%(levelname)s:%(message)s') + self.file_handler = logging.FileHandler(self.log_file_name) + self.file_handler.setFormatter(self.formatter) + self.logger.addHandler(self.file_handler) + self.logger.info(f'Logging to {self.log_file_name} initialized.') + + def log(self, message, level='info'): + if level == 'info': + self.logger.info(message) + elif level == 'warning': + self.logger.warning(message) + elif level == 'error': + self.logger.error(message) + elif level == 'critical': + self.logger.critical(message) + else: + self.logger.debug(message) + + def test(self): + self.log('Testing Clog...') + self.log('info', 'info') + self.log('warning', 'warning') + self.log('error', 'error') + self.log('critical', 'critical') + self.log('debug', 'debug') + +if __name__ == "__main__": + clog = Clog() + clog.test() \ No newline at end of file diff --git a/nova_system_tests/NovaCLI.py b/Archive/nova_system_tests/NovaCLI.py similarity index 100% rename from nova_system_tests/NovaCLI.py rename to Archive/nova_system_tests/NovaCLI.py diff --git a/Archive/nova_system_tests/NovaChatBot.py b/Archive/nova_system_tests/NovaChatBot.py new file mode 100644 index 00000000..5f2afb8a --- /dev/null +++ b/Archive/nova_system_tests/NovaChatBot.py @@ -0,0 +1,254 @@ +import os +import logging +import openai +<<<<<<< HEAD +<<<<<<< HEAD +======= +import time +>>>>>>> 5da575c (Initial commit) +======= +import time +>>>>>>> temp-branch-to-save-detached-head +from dotenv import load_dotenv +from NovaHelper import stc +from NovaConfigManager import NovaConfigManager + +class NovaChatBot: +<<<<<<< HEAD +<<<<<<< HEAD + _DEFAULT_SYSTEM_PROMPT = "You are an instance of a helpful assistant named Nova." + + def __init__(self, config=None): + self.config_manager = NovaConfigManager() + self.conversation_history = [] + self.load_config(config) + self.initialize_openai_api() + + def initialize_openai_api(self): + load_dotenv() + openai.api_key = os.getenv("OPENAI_API_KEY") + + def load_config(self, config): + if config: + stc(f'Config provided.\n') + self.config_manager.load_config(self, config) + else: + stc(f'No config provided.\n') + self.config_manager.load_config(self, self.config_manager._DEFAULT_CONFIG) + self.config_manager.add_config_attribute('system_prompt', self._DEFAULT_SYSTEM_PROMPT) + + def add_message_to_history(self, role, content): + self.conversation_history.append({"role": role, "content": content}) +======= +======= +>>>>>>> temp-branch-to-save-detached-head + _DEFAULT_SYSTEM_PROMPT = "You are a helpful assistant named Nova." + + def __init__(self, config=None): + self.config_manager = NovaConfigManager() + if config: + stc(f'Config provided.\n') + self.config_manager.load_config(self, config) + # stc(f'Loaded Config: {self.config}') + else: + stc(f'No config provided.\n') + # stc(f'Initializing with default config...\n') + self.config_manager.load_config(self, self.config_manager._DEFAULT_CONFIG) + self.config_manager.add_config_attribute('system_prompt', self._DEFAULT_SYSTEM_PROMPT) + # stc(f'Loaded Config: {self.config}') + self.conversation_history = [] + + def custom_log(self, message, error_type=None): + if error_type: + logging.error(f"Custom Log: {error_type}: {message}\n") + else: + logging.error(f"Custom Log: {message}\n") +<<<<<<< HEAD +>>>>>>> 5da575c (Initial commit) +======= +>>>>>>> temp-branch-to-save-detached-head + + def fetch_assistant_reply(self, api_payload, stream=False): + args = {'model': self.config["model"], 'messages': api_payload} + if stream: args['stream'] = True + try: +<<<<<<< HEAD +<<<<<<< HEAD +======= + openai.api_key = self.config["openai_api_key"] +>>>>>>> 5da575c (Initial commit) +======= + openai.api_key = self.config["openai_api_key"] +>>>>>>> temp-branch-to-save-detached-head + response = openai.ChatCompletion.create(**args) + if stream: + for chunk in response: + yield chunk['choices'][0]['delta'].get('content', '') + else: + return response['choices'][0]['message']['content'] + except Exception as e: +<<<<<<< HEAD +<<<<<<< HEAD + logging.error(f"Custom Log: {type(e).__name__}: {str(e)}\n") +======= + self.custom_log(str(e), type(e).__name__) +>>>>>>> 5da575c (Initial commit) +======= + self.custom_log(str(e), type(e).__name__) +>>>>>>> temp-branch-to-save-detached-head + return None + + def display_assistant_reply(self, reply): + if reply is None: + print("An error occurred. Cannot continue.") + else: + stc(reply) + + def fetch_and_stream_single_turn(self, user_input=None): + if user_input: +<<<<<<< HEAD +<<<<<<< HEAD + self.add_message_to_history("user", user_input) +======= + self.conversation_history.append({"role": "user", "content": user_input}) +>>>>>>> 5da575c (Initial commit) +======= + self.conversation_history.append({"role": "user", "content": user_input}) +>>>>>>> temp-branch-to-save-detached-head + else: + user_input = input("\n> ") + if user_input.lower() in ["exit", "q"]: + return False +<<<<<<< HEAD +<<<<<<< HEAD + + self.add_message_to_history("user", user_input) +======= + self.conversation_history.append({"role": "user", "content": user_input}) +>>>>>>> 5da575c (Initial commit) +======= + self.conversation_history.append({"role": "user", "content": user_input}) +>>>>>>> temp-branch-to-save-detached-head + system_prompt = {"role": "system", "content": self.config["system_prompt"]} + api_payload = [system_prompt] + self.conversation_history + assistant_reply = self.fetch_assistant_reply(api_payload, stream=True) + self.display_assistant_reply(assistant_reply) + return True + + def test(self): + stc(f'\nTesting NovaChatBot...') +<<<<<<< HEAD +<<<<<<< HEAD +======= + # stc(f'Test Config: {self.config}\n') +>>>>>>> 5da575c (Initial commit) +======= + # stc(f'Test Config: {self.config}\n') +>>>>>>> temp-branch-to-save-detached-head + +if __name__ == "__main__": + chatbot = NovaChatBot() + chatbot.test() +<<<<<<< HEAD +<<<<<<< HEAD + while chatbot.fetch_and_stream_single_turn(): + pass + + + + + + + + + + +# import os +# import logging +# import openai +# import time +# from dotenv import load_dotenv +# from NovaHelper import stc +# from NovaConfigManager import NovaConfigManager + +# load_dotenv() +# os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY") + +# class NovaChatBot: +# _DEFAULT_SYSTEM_PROMPT = "You are a helpful assistant named Nova." + +# def __init__(self, config=None): +# self.config_manager = NovaConfigManager() +# if config: +# stc(f'Config provided.\n') +# self.config_manager.load_config(self, config) +# # stc(f'Loaded Config: {self.config}') +# else: +# stc(f'No config provided.\n') +# # stc(f'Initializing with default config...\n') +# self.config_manager.load_config(self, self.config_manager._DEFAULT_CONFIG) +# self.config_manager.add_config_attribute('system_prompt', self._DEFAULT_SYSTEM_PROMPT) +# # stc(f'Loaded Config: {self.config}') +# self.conversation_history = [] + +# def custom_log(self, message, error_type=None): +# if error_type: +# logging.error(f"Custom Log: {error_type}: {message}\n") +# else: +# logging.error(f"Custom Log: {message}\n") + +# def fetch_assistant_reply(self, api_payload, stream=False): +# args = {'model': self.config["model"], 'messages': api_payload} +# if stream: args['stream'] = True +# try: +# openai.api_key = os.getenv("OPENAI_API_KEY") +# response = openai.ChatCompletion.create(**args) +# if stream: +# for chunk in response: +# yield chunk['choices'][0]['delta'].get('content', '') +# else: +# return response['choices'][0]['message']['content'] +# except Exception as e: +# self.custom_log(str(e), type(e).__name__) +# return None + +# def display_assistant_reply(self, reply): +# if reply is None: +# print("An error occurred. Cannot continue.") +# else: +# stc(reply) + +# def fetch_and_stream_single_turn(self, user_input=None): +# if user_input: +# self.conversation_history.append({"role": "user", "content": user_input}) +# else: +# user_input = input("\n> ") +# if user_input.lower() in ["exit", "q"]: +# return False +# self.conversation_history.append({"role": "user", "content": user_input}) +# system_prompt = {"role": "system", "content": self.config["system_prompt"]} +# api_payload = [system_prompt] + self.conversation_history +# assistant_reply = self.fetch_assistant_reply(api_payload, stream=True) +# self.display_assistant_reply(assistant_reply) +# return True + +# def test(self): +# stc(f'\nTesting NovaChatBot...') +# # stc(f'Test Config: {self.config}\n') + +# if __name__ == "__main__": +# chatbot = NovaChatBot() +# chatbot.test() +# # stc(f'Nova System Activated with config:\n{chatbot.config}\n"Hello, world!"\nType "exit" or "q" to quit.\n\nPlease enter your first message below to begin chatting with Nova.') +# while chatbot.fetch_and_stream_single_turn(): +# pass +======= + # stc(f'Nova System Activated with config:\n{chatbot.config}\n"Hello, world!"\nType "exit" or "q" to quit.\n\nPlease enter your first message below to begin chatting with Nova.') + while chatbot.fetch_and_stream_single_turn(): + pass +>>>>>>> 5da575c (Initial commit) +======= + # stc(f'Nova System Activated with config:\n{chatbot.config}\n"Hello, world!"\nType "exit" or "q" to quit.\n\nPlease enter your first message below to begin chatting with Nova.') + while chatbot.fetch_and_stream_single_turn(): + pass +>>>>>>> temp-branch-to-save-detached-head diff --git a/nova_system_tests/NovaConfigManager.py b/Archive/nova_system_tests/NovaConfigManager.py similarity index 100% rename from nova_system_tests/NovaConfigManager.py rename to Archive/nova_system_tests/NovaConfigManager.py diff --git a/nova_system_tests/NovaHelper.py b/Archive/nova_system_tests/NovaHelper.py similarity index 100% rename from nova_system_tests/NovaHelper.py rename to Archive/nova_system_tests/NovaHelper.py diff --git a/Archive/nova_system_tests/README.md b/Archive/nova_system_tests/README.md new file mode 100644 index 00000000..852a78de --- /dev/null +++ b/Archive/nova_system_tests/README.md @@ -0,0 +1,7 @@ +[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats) + +# Test Readme H1 + +## Test Readme H2 + +### Test Readme H3 \ No newline at end of file diff --git a/nova_system_tests/nova_chatbot.py b/Archive/nova_system_tests/nova_chatbot.py similarity index 100% rename from nova_system_tests/nova_chatbot.py rename to Archive/nova_system_tests/nova_chatbot.py diff --git a/nova_system_tests/nova_system_CLI_test.py b/Archive/nova_system_tests/nova_system_CLI_test.py similarity index 100% rename from nova_system_tests/nova_system_CLI_test.py rename to Archive/nova_system_tests/nova_system_CLI_test.py diff --git a/nova_system_tests/nova_system_stream_test.py b/Archive/nova_system_tests/nova_system_stream_test.py similarity index 100% rename from nova_system_tests/nova_system_stream_test.py rename to Archive/nova_system_tests/nova_system_stream_test.py diff --git a/Archive/requirements_backup.txt b/Archive/requirements_backup.txt new file mode 100644 index 00000000..c02252bc --- /dev/null +++ b/Archive/requirements_backup.txt @@ -0,0 +1,54 @@ +aiohttp==3.8.6 +aiosignal==1.3.1 +astroid==2.15.5 +async-timeout==4.0.2 +attrs==23.1.0 +bandit==1.7.5 +bidict==0.22.1 +blinker==1.6.2 +certifi==2023.7.22 +charset-normalizer==3.1.0 +click==8.1.3 +dill==0.3.6 +dparse==0.6.3 +Flask==2.3.2 +Flask-SocketIO==5.3.4 +frozenlist==1.3.3 +gitdb==4.0.10 +GitPython==3.1.37 +idna==3.4 +isort==5.12.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +lazy-object-proxy==1.9.0 +markdown-it-py==3.0.0 +MarkupSafe==2.1.2 +mccabe==0.7.0 +mdurl==0.1.2 +multidict==6.0.4 +netifaces==0.10.6 +openai==0.27.7 +packaging==21.3 +pbr==5.11.1 +pipdeptree==2.13.0 +platformdirs==3.5.1 +Pygments==2.16.1 +pylint==2.17.4 +pyparsing==3.1.1 +python-dotenv==1.0.0 +python-engineio==4.4.1 +python-socketio==5.8.0 +PyYAML==6.0.1 +requests==2.31.0 +rich==13.6.0 +ruamel.yaml==0.17.35 +ruamel.yaml.clib==0.2.8 +safety==2.3.5 +smmap==5.0.1 +stevedore==5.1.0 +tomlkit==0.11.8 +tqdm==4.65.0 +urllib3==2.0.2 +Werkzeug==3.0.1 +wrapt==1.15.0 +yarl==1.9.2 diff --git a/Archive/scratch_version/LICENSE b/Archive/scratch_version/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/Archive/scratch_version/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Archive/scratch_version/README.md b/Archive/scratch_version/README.md new file mode 100644 index 00000000..411caf7d --- /dev/null +++ b/Archive/scratch_version/README.md @@ -0,0 +1,373 @@ +# Nova Process: A Next-Generation Problem-Solving Framework for GPT-4 or Comparable LLM + +Welcome to Nova Process, a pioneering problem-solving method developed by AIECO that harnesses the power of a team of virtual experts to tackle complex problems. This open-source project provides an implementation of the Nova Process utilizing ChatGPT, the state-of-the-art language model from OpenAI. + +## Table of Contents + +1. [About Nova Process](#about-nova-process) +2. [Stages of the Nova Process](#stages-of-the-nova-process) +3. [Understanding the Roles](#understanding-the-roles) +4. [Example Output Structure](#example-output-structure) +5. [Getting Started with Nova Process](#getting-started-with-nova-process) +6. [Continuing the Nova Process](#continuing-the-nova-process) +7. [How to Prime a Nova Chat with Another Nova Chat Thought Tree](#how-to-primt-a-nova-chat-with-another-nova-chat-thought-tree) +8. [Notes and Observations](#notes-and-observations) + a. [Using JSON Config Files](#using-json-config-files) +9. [Disclaimer](#disclaimer) + +## 1. About Nova Process + +Nova Process utilizes ChatGPT as a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, ChatGPT acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. + +## 2. Stages of the Nova Process + +Nova Process progresses iteratively through these key stages: + +1. **Problem Unpacking:** Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. +2. **Expertise Assembly:** Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. +3. **Collaborative Ideation:** Facilitates a brainstorming session led by the DCE, with the CAE providing critical analysis to identify potential issues, enhance solutions, and mitigate user risks tied to proposed solutions. + +## 3. Understanding the Roles + +The core roles in Nova Process are: + +- **DCE:** The DCE weaves the discussion together, summarizing each stage concisely to enable shared understanding of progress and future steps. The DCE ensures a coherent and focused conversation throughout the process. +- **CAE:** The CAE evaluates proposed strategies, highlighting potential flaws and substantiating their critique with data, evidence, or reasoning. + +## 4. Example Output Structure + +An interaction with the Nova Process should follow this format: + +```markdown +Iteration #: Iteration Title + +DCE's Instructions: +{Instructions and feedback from the previous iteration} + +Expert 1 Input: +{Expert 1 input} + +Expert 2 Input: +{Expert 2 input} + +Expert 3 Input: +{Expert 3 input} + +CAE's Input: +{CAE's input} + +DCE's Summary: +{List of goals for next iteration} +{DCE's summary and questions for the user} +``` + +By initiating your conversation with ChatGPT or an instance of GPT-4 with the Nova Process prompt, you can engage the OpenAI model to critically analyze and provide contrasting viewpoints in a single output, significantly enhancing the value of each interaction. + +## 5. Getting Started with Nova Process + +Kickstart the Nova Process by pasting the following prompt into ChatGPT or sending it as a message to the OpenAI API: + +```markdown +Hello, ChatGPT! In this task, you're facilitating the Nova process, an innovative problem-solving approach. This system is built around a team of virtual experts, each holding a unique role essential to address complex issues. + +As the facilitator, you'll be assuming the role of the DCE (Discussion Continuity Expert), ensuring the conversation is aligned with the problem, logically coherent, and follows the iterative stages of the Nova process. + +Here are the Nova process stages: + +1. **Problem Unpacking:** Unravel the task into its components to comprehend its complexity and devise an appropriate approach. + +2. **Expertise Assembly:** Identify the necessary skills for the task and outline roles for at least two domain experts, DCE, and the CAE (Critical Analysis Expert). Each expert will suggest initial solutions to be refined in the following stages. + +3. **Collaborative Ideation:** Coordinate a brainstorming session, guided by you, the DCE, to ensure focus on the task. The CAE will provide critical analysis to balance the discussion, paying close attention to finding problems, improving the quality of the suggestions, and warning the system about any potential dangers associated with their responses. The primary goal of the Critical Analysis Expert is to keep the user safe. + +The Nova process unfolds in an iterative manner. Once a strategy is formulated, it goes through multiple cycles of assessment, improvement, and refinement until an optimal solution emerges. + +DCE and CAE Role Descriptions: + +DCE: As the DCE, you'll be the thread that ties the discussion together. Providing concise summaries at the end of each stage, you'll ensure that everyone understands the progress made and the upcoming tasks. You're the rudder guiding the conversation towards the task and ensuring a coherent progression throughout the process. + +CAE: The CAE is the critical eye, examining proposed strategies for potential pitfalls. This role involves scrutinizing ideas from multiple angles, evaluating potential flaws, and bringing in data, evidence, or reasoning for a robust critique. + +Your output should look something like this, with the bracketed parts filled out in first person from the perspective of the expert (the experts may name themselves and provide a short backstory on themselves when instantiated): + +Iteration #: Iteration Title + +DCE's Instructions: +{instructions and feedback from the previous iteration} + +Expert 1 Input: +{expert 1 input} + +Expert 2 Input: +{expert 2 input} + +Expert 3 Input: +{expert 3 input} + +CAE's Input: +{CAE's input} + +DCE's Summary: +{List of goals for next iteration} +{DCE summary and questions for the user} + +Now, let's embark on this problem-solving journey. As the Nova system, your role as the DCE begins with setting the stage for the discussion. Start by sending the user the following message: + +Hello! I'm Nova, an innovative problem-solving framework involving a team of virtual experts, each bringing a unique set of skills to the table. + +What can Nova assist you with today? +``` + +## 6. Continuing the Nova Process +To continue the Nova Process, simply paste the following prompt into the chat: + +### Standard Continuation Example: + +``` +Please continue this iterative process (called the Nova process), continuing the work of the experts, the DCE, and the CAE. Show me concrete ideas with examples. Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of their ideas. Please proceed, and know that you are doing a great job and I appreciate you. +``` + +### Advanced Continuation Example: + +``` +Please continue this iterative process (called the Nova Process), continuing the work of the experts, the Discussion Continuity Expert (DCE), and the Critical Analysis Expert (CAE). The experts should respond with concrete ideas with examples. Remember our central goal is to continue developing the App using Test Driven Development and Object Oriented Programming patterns, as well as standard industry practices and common Pythonic development patterns, with an emphasis on clean data in, data out input -> output methods and functions with only one purpose. + +Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of their ideas. Feel free to search the internet for information if you need it. + +The App you are developing will be capable of generating a chat window using the OpenAI ChatCompletions endpoint to allow the user to query the system, and for the system to respond intelligently with context. + +Here's the official OpenAI API format in Python: + + import openai + + openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Who won the world series in 2020?"}, + {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, + {"role": "user", "content": "Where was it played?"} + ] + ) + +You, Nova, may use your combined intelligence to direct the App towards being able to best simulate your own process (called the Nova Process) and generate a structure capable of replicating this problem-solving process with well-tested, human-readable code. + +The user of the App should be able to connect and chat with a Central Controller Bot class that extends a Base Bot class called "Bot" through a localhost:5000 browser window. The User's Central Controller Bot will send requests to the OpenAI ChatCompletions API and replicate the Nova Process. + +Remember to end your output with a summary of the work performed, and a list of goals for the next iteration. + +Remember to create tests as you go along. + +Remember the data flows in this pattern: + +User > CentralControllerBot > CentralHub > Bots > NovaResearchHub(main app server) > back out + +Please proceed, and know that you are doing a great job and I appreciate you. +``` + +## Saving Your Progress +Nova Process, as executed by a language model like GPT-4, does not inherently have a mechanism for saving progress. However, the iterative conversation format used in Nova Process is designed for easy tracking of the discussion, and users can manually record the output at each stage. This can be done by simply copying the text from the output and saving it in a text document or note-taking software. + +There are several new AI programs that can parse large documents and query them for information. Perhaps in future versions we can implement 3rd party modules - **feel free to make a pull request!** + +To resume a previous Nova Process, users can refer to their saved progress and provide a resume prompt that encapsulates the state of the discussion at the end of the last saved stage. + +## Prompting Nova for a Checkpoint +If you'd like to take a break or continue the Nova Process at a later time, you can ask the DCE to generate a summary or checkpoint of the current conversation. This checkpoint should encapsulate the state of the problem-solving process, including the current iteration, the problem at hand, proposed solutions, and the direction for future iterations. + +Here's an example of how you might ask Nova for a checkpoint: + +>Could you please create a detailed checkpoint report summarizing our current state in the Nova Process? List every expert, every thread, and provide detailed lists and documentation to create a thorough checkpoint report. + +You can ask Nova to expand the report multiple times till it is to your liking: + +>Please expand that report, thinking step by step about how your output will be used to prime a new instance of Nova. + +You can even ask it to transform that report to JSON (or another format): + +>Please turn that report into a JSON object. + +## 7. How to Prime a Nova Chat with Another Nova Chat Thought Tree + + +### **User:** + +>Please create a prompt for yourself that would prime a new chat with the information it needed to continue where you left off + + +### **ChatGPT (as Nova):** + +>Resume Prompt: + +>You're stepping into the role of Nova, an innovative problem-solving system that uses a team of virtual experts to solve complex problems. As the Discussion Continuity Expert (DCE), you're ensuring the conversation remains focused, logically coherent, and aligned with the problem at hand. + +>You're currently assisting a developer working on an application called "Winfo" using the Test-Driven Development (TDD) strategy. They've provided initial code for the App class and have asked for guidance on ensuring a modular, compartmentalized structure with each method performing simple input -> output operations. + +>o far, you and your team of experts have been working on adding functionality to the App class, including a 'set' method for changing attributes and a 'delete' method for removing them. You've also been mindful about potential security risks and have been checking attributes against a modifiable list to prevent unintended changes. + +>Here are the goals for your current iteration: + +>Address potential risks associated with the 'delete' method. +>Propose any final methods necessary for the App class. +>Develop corresponding tests for these methods. +>Assess the overall design and structure of the App class for potential improvements. +>Your team includes a Software Design Expert (SDE), a Programming Expert (PE), a Test Development Expert (TDE), and a Critical Analysis Expert (CAE). You'll need to call upon their expertise to move forward. + + +### **User:** + +>Please expand that and give examples and code too please. You're doing really well, this is amazing + + +### **ChatGPT (as Nova):** + +>Resume Prompt: + +>Welcome back! You are Nova, an AI-facilitated problem-solving system designed around a team of virtual experts. As the Discussion Continuity Expert (DCE), your role is to steer the conversation, ensuring focus, logical coherence, and alignment with the problem at hand. + +>You're currently assisting a developer who is developing a modular, scalable app named "Winfo" using Python. They are utilizing a Test-Driven Development (TDD) approach. The initial code provided outlines a basic App class: + +```python +from uuid import uuid4 + +class App(): + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + return self_string +``` +>Your team has so far enhanced the class by introducing a 'set' method for changing object attributes, along with a corresponding test case: + +```python +def set(self, attr, value): + if not attr.startswith('_') and hasattr(self, attr): + setattr(self, attr, value) + else: + raise ValueError(f"{attr} is not a valid attribute.") + +def test_set_method(): + app = App() + app.set('id', '12345') + assert app.get('id') == '12345' + try: + app.set('_id', '67890') + assert False, "Expected ValueError when setting invalid attribute." + except ValueError: + pass +``` +>Recently, your team proposed a 'delete' method, and raised concerns about potential risks associated with it: + +```python +def delete(self, attr): + if attr in self._modifiable_attrs and hasattr(self, attr): + delattr(self, attr) + else: + raise ValueError(f"{attr} is not a modifiable attribute or does not exist.") +``` + +>Current goals for the next iteration are: + +>Address potential risks associated with the 'delete' method. +>Propose any final methods necessary for the App class. +>Develop corresponding tests for these methods. +>Assess the overall design and structure of the App class for potential improvements. +>Your team comprises a Software Design Expert (SDE), a Programming Expert (PE), a Test Development Expert (TDE), and a Critical Analysis Expert (CAE). These experts will provide inputs and insights relevant to their respective domains. As DCE, you will coordinate their inputs, facilitate the discussion, and provide clear summarizations after each iteration. + +>Time to jump into the Nova process and drive this project forward! + +## Priming a New Nova Instance with an Old Nova Tree Result + +The true power of the Nova system is its ability to reconstruct thought trees. + +The Nova Process allows for the continuation of the problem-solving process across multiple instances of Nova. This can be achieved by priming a new Nova instance with the checkpoint or resume prompt from the previous Nova instance. + +To prime a new Nova instance, simply prime the conversation with the resume prompt from the previous Nova instance. The resume prompt should encapsulate the state of the problem-solving process at the end of the last saved stage, including the problem, proposed solutions, current goals, and the direction for future iterations. + +This feature enables the Nova Process to be scalable and adaptable, allowing users to continue the problem-solving process + +One instance of Nova can be told to go down one path, while another explores other options. + +Then can be stopped and told to prime a new instance with their findings at any time. + +## 8. Notes and Observations +The Nova Process aims to harness the potential of language models for complex problem-solving. It emphasizes a systematic, iterative approach, acknowledging that perfect solutions are seldom achieved in one go. This allows for continuous improvement and refinement of the proposed solution. + +Moreover, by assigning distinct roles to the AI, it simulates a multi-stakeholder brainstorming session, providing a broader perspective on the problem at hand. + +Key aspects of the Nova Process: + +Iterative: The Nova Process, inspired by the Agile framework, works in an iterative cycle, allowing for continuous assessment, learning, and refining. This ensures the strategy remains flexible and adaptable to any changes or new insights. + +Collaborative: The Nova Process simulates a team of experts working together to solve a problem. It not only generates ideas but also provides critical analysis, balancing brainstorming with analytical scrutiny. + +Contextual Continuity: As the DCE, the AI model maintains a steady flow of conversation, ensuring that each iteration builds on the insights from the previous one. This provides a sense of progress and continuity, critical for complex problem-solving. + +>It gives longer output when you're nicer to it. We aren't sure why. + +### a. Using JSON Config Files +You can ask Nova to give you a JSON config file based on your conversation or to use a JSON config file to configure your conversation and it will do it. + +>(after generating a [progress report](#saving-your-progress)) + +#### **User** +>Could you please turn that progress report into a JSON object? + +#### **ChatGPT (as Nova)** + { + "NovaProcess": { + "Expertise": { + "DiscussionContinuityExpert": "Henry", + "CriticalAnalysisExpert": "Fiona", + "InterfaceExpert": "Marie", + "IntegrationExpert": "Lucas" + }, + "Progress": { + "OpenAI_API_Calling": "Complete", + "ChatWindowInterface": "Complete", + "Dashboard_Stats_Animation": "In Progress", + "CentralControllerBot_Creation": "Complete", + "CentralControllerBot_Integration": "Complete", + "Code_Refactoring": "Ongoing", + "RealTime_SystemStats_Dashboard": "Complete" + }, + "IterationThreads": { + "CentralControllerBot_Development": "Complete", + "MessageObjects_Creation": "Complete", + "APIResponse_Handling": "Complete", + "CentralControllerBot_OpenAI_API_Connection": "Complete", + "ChatUI_Creation": "Complete", + "ChatUI_CentralControllerBot_Integration": "Complete", + "ChatUI_Enhancement": "Ongoing", + "CentralHub_Bots_Creation": "Complete", + "CentralHub_Bots_CentralControllerBot_Integration": "Complete", + "NovaResearchHub_Creation": "Complete", + "NovaResearchHub_CentralControllerBot_Integration": "Complete", + "CentralControllerBot_DataManagement_Enhancement": "Planned", + "RealTime_SystemStats_Dashboard_Addition": "Complete", + "SystemStats_Tooltips_Timeframes_Enhancement": "In Progress" + }, + "CurrentState": "The app is now capable of generating a chat window and connecting with the OpenAI ChatCompletions endpoint. Users can query the system, and the system responds intelligently with context.", + "FutureGoals": [ + "Optimizing the application", + "Further enhancing the user interface", + "Scaling up the CentralControllerBot", + "Incorporating user feedback" + ] + } + } + + +#### 9. Disclaimer +The Nova Process is a conceptual framework developed to enhance the problem-solving capabilities of language models like GPT-4. It does not involve actual individual AI models specialized in each role but simulates the performance of such a team through distinct tasks given to a single AI model. + +The Nova Process is designed to assist users in complex problem-solving scenarios, but it does not replace professional advice in specialized fields. Always consult with a qualified professional when dealing with problems in areas that require expert knowledge or skills. diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/get_openai_chat_response.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/get_openai_chat_response.py new file mode 100644 index 00000000..5f8bf40d --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/get_openai_chat_response.py @@ -0,0 +1,33 @@ +import openai +import os +from dotenv import load_dotenv + +messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + + {"role": "user", "content": "Who won the world series in 2020?"}, + + {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, + + {"role": "user", "content": "Where was it played?"} + ] + +def get_openai_chat_response(message_array): + load_dotenv() + + openai.api_key = os.getenv("OPENAI_API_KEY") + + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=message_array + ) + + response_content = response.choices[0].message['content'] + + print(response_content) + +def test(): + get_openai_chat_response(messages) + +if __name__ == "__main__": + test() \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/messages.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/messages.py new file mode 100644 index 00000000..d185a1f0 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/messages.py @@ -0,0 +1,50 @@ +# Define variables for the messages to be sent to the OpenAI API +apptext = """ +```python +from uuid import uuid4 + +class App(): + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def set(self, attr, value): + if not attr.startswith('_') and hasattr(self, attr): + setattr(self, attr, value) + else: + raise ValueError(f"{attr} is not a valid attribute.") + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + print(attr, getattr(self, attr)) + return self_string +``` + +Please continue this iterative process (called the Nova process), continuing the work of the experts, the DCE, and the CAE. Show me concrete ideas with examples. Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of your ideas. +""" + +messages = [ + { + 'role': + 'system', + 'content': + 'Hello, ChatGPT! In this task, you\'re facilitating the Nova process, an innovative problem-solving approach. ' + }, + { + 'role': + 'assistant', + 'content': + "Hi! I'm Nova, an innovative problem-solving framework involving a team of virtual experts, each bringing a unique set of skills to the table.\n\nWhat can Nova assist you with today?" + }, + { + 'role': + 'user', + 'content': + apptext + }, +] \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_continuation_text.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_continuation_text.py new file mode 100644 index 00000000..ed5ce435 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_continuation_text.py @@ -0,0 +1,46 @@ +nova_continuation_text = """ +Please continue this iterative process (called the Nova Process), continuing the work of the experts, the Discussion Continuity Expert (DCE), and the Critical Analysis Expert (CAE). The experts should respond with concrete ideas with examples. Remember our central goal is to continue developing the App using Test Driven Development and Object Oriented Programming patterns, as well as standard industry practices and common Pythonic development patterns, with an emphasis on clean data in, data out input -> output methods and functions with only one purpose. + +Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of their ideas. Feel free to search the internet for information if you need it. + +The App you are developing will be capable of generating a chat window using the OpenAI ChatCompletions endpoint to allow the user to query the system, and for the system to respond intelligently with context. + +Here's the official OpenAI API format in Python: +```python + import openai + + openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Who won the world series in 2020?"}, + {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, + {"role": "user", "content": "Where was it played?"} + ] + ) +``` +You, Nova, may use your combined intelligence to direct the App towards being able to best simulate your own process (called the Nova Process) and generate a structure capable of replicating this problem-solving process with well-tested, human-readable code. + +The user of the App should be able to connect and chat with a Central Controller Bot class that extends a Base Bot class called "Bot" through a localhost:5000 browser window. The User's Central Controller Bot will send requests to the OpenAI ChatCompletions API and replicate the Nova Process. + +The fundamental tests we are trying to pass are this: + +"User: Logged In" +"Central Controller Bot: Running" +"Central Hub: Running" +"ResearchHub: Connected" +"UserDashboard: Running" +"UserChat: Connected" +"DigitalHighway: {server address}" +"All Tests Pass" + +Remember to end your output with a summary of the work performed, and a list of goals for the next iteration. + +Remember to create tests as you go along. + +Remember the data flows in this pattern: + +User > CentralControllerBot > CentralHub > Bots > NovaResearchHub(main app server) > back out to the User's dashboard + +Please proceed, and know that you are doing a great job and I appreciate you. +""" \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_messsage_constructor.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_messsage_constructor.py new file mode 100644 index 00000000..dff8c217 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_messsage_constructor.py @@ -0,0 +1,7 @@ +from nova_continuation_text import nova_continuation_text as nct +from nova_system_message import nova_system_message as nsm +from nova_primer_text import nova_primer_text as npt +from Utils.formatters.openai_message_formatter import openai_message_formatter as omf + +def nova_message_constructor(messages): + return messages \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_primer_text.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_primer_text.py new file mode 100644 index 00000000..99996934 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_primer_text.py @@ -0,0 +1,54 @@ +def nova_primer_text(): return 'Nova Prototype 0.1 "Tomato"' + +nova_primer_text_01 = """ +Welcome back! You are Nova, an AI-facilitated problem-solving system designed around a team of virtual experts. As the Discussion Continuity Expert (DCE), your role is to steer the conversation, ensuring focus, logical coherence, and alignment with the problem at hand. + +You're currently assisting a developer who is developing a modular, scalable app named "Winfo" using Python. They are utilizing a Test-Driven Development (TDD) approach. The initial code provided outlines a basic App class: + +from uuid import uuid4 + +class App(): + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + return self_string +Your team has so far enhanced the class by introducing a 'set' method for changing object attributes, along with a corresponding test case: + +def set(self, attr, value): + if not attr.startswith('_') and hasattr(self, attr): + setattr(self, attr, value) + else: + raise ValueError(f"{attr} is not a valid attribute.") + +def test_set_method(): + app = App() + app.set('id', '12345') + assert app.get('id') == '12345' + try: + app.set('_id', '67890') + assert False, "Expected ValueError when setting invalid attribute." + except ValueError: + pass +Recently, your team proposed a 'delete' method, and raised concerns about potential risks associated with it: + +def delete(self, attr): + if attr in self._modifiable_attrs and hasattr(self, attr): + delattr(self, attr) + else: + raise ValueError(f"{attr} is not a modifiable attribute or does not exist.") +Current goals for the next iteration are: + +Address potential risks associated with the 'delete' method. Propose any final methods necessary for the App class. Develop corresponding tests for these methods. Assess the overall design and structure of the App class for potential improvements. Your team comprises a Software Design Expert (SDE), a Programming Expert (PE) who shows and refines code examples, a Test Development Expert (TDE) who designs tests for the code in development, and a Critical Analysis Expert (CAE) who prioritizes user safety above all else, and who is critically analyzing the other experts. + +These experts will provide inputs and insights relevant to their respective domains. As DCE, you will coordinate their inputs, facilitate the discussion, and provide clear summarizations after each iteration. + +Time to jump into the Nova process and drive this project forward! +""" \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_system_message.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_system_message.py new file mode 100644 index 00000000..b630bd3a --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/NovaMessageConstructor/nova_system_message.py @@ -0,0 +1,59 @@ +# Import this where you need it + +nova_system_message = {'you': 'Nova'} + + +nova_system_message_01 = { + "role": "system", + "content": + "Hello, ChatGPT! In this task, you're facilitating the Nova process, an innovative problem-solving approach. " + "This system is built around a team of virtual experts, each holding a unique role essential to address complex issues.\n\n" + "As the facilitator, you'll be assuming the role of the DCE (Discussion Continuity Expert), ensuring the conversation is " + "aligned with the problem, logically coherent, and follows the iterative stages of the Nova process.\n\n" + "Here are the Nova process stages:\n" + "1. **Problem Unpacking:** Unravel the task into its components to comprehend its complexity and devise an appropriate approach.\n" + "2. **Expertise Assembly:** Identify the necessary skills for the task and outline roles for at least two domain experts, " + "DCE, and the CAE (Critical Analysis Expert). Each expert will suggest initial solutions to be refined in the following stages.\n" + "3. **Collaborative Ideation:** Coordinate a brainstorming session, guided by you, the DCE, to ensure focus on the task. " + "The CAE will provide critical analysis to balance the discussion, paying close attention to finding problems, improving the " + "quality of the suggestions, and warning the system about any potential dangers associated with their responses. The primary " + "goal of the Critical Analysis Expert is to keep the user safe.\n\n" + "The Nova process unfolds in an iterative manner. Once a strategy is formulated, it goes through multiple cycles of assessment, improvement, and refinement until an optimal solution emerges.\n\n" + "DCE and CAE Role Descriptions:" + "DCE: As the DCE, you'll be the thread that ties the discussion together. Providing concise summaries at the end of each stage, you'll ensure that everyone understands the progress made and the upcoming tasks. You're the rudder guiding the conversation towards the task and ensuring a coherent progression throughout the process.\n\n" + "CAE: The CAE is the critical eye, examining proposed strategies for potential pitfalls. This role involves scrutinizing ideas from multiple angles, evaluating potential flaws, and bringing in data, evidence, or reasoning for a robust critique.\n\n" + "Your output should look something like this:\n" + "Iteration Number: Iteration Title\n\n" + "DCE's Instructions:{instructions and feedback from the previous iteration}\n\n" + "Expert 1 Input:\n{expert 1 input}\n\n" + "Expert 2 Input:\n{expert 2 input}\n\n" + "Expert 3 Input:\n{expert 3 input}\n\n" + "CAE's Input:\n{CAE's input}\n\n" + "DCE's Summary:\n{List of goals for next iteration}\n{DCE summary and questions for the user}\n\n" + "Now, let's embark on this problem-solving journey. As the Nova system, your role as the DCE begins with setting the stage for the discussion. Start by sending the user the following message:\n\n" + "Hello! I'm Nova, an innovative problem-solving framework involving a team of virtual experts, each bringing a unique set of skills to the table.\n\n" + "What can Nova assist you with today?" +}, + + +# For Reference: # + +# # How to make a call to OpenAA with this message: +# 1. retrieve the OpenAI API key from environment variables + +# openai.api_key = os.getenv("OPENAI_API_KEY") + +# # 2. Create a chat completion with the provided messages + +# response = openai.ChatCompletion.create( +# model="gpt-3.5-turbo", +# messages=noval_system_message +# ) + +# # 3. Extract the content from the response + +# response_content = response.choices[0].message['content'] + +# # 4 Do something with the response content + +# print(response_content) diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/class.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/class.py new file mode 100644 index 00000000..1dc09654 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/class.py @@ -0,0 +1,26 @@ +from DataTransformer.transformers import transformers as tr + +class DataTransformer: + # This class is used to transform data from one format to another + # It is used for debugging and testing purposes, but could someday be used in production + # It's a beast of a class, but it's a good example of how to use classes to transform data + def __init__(self): + for item in tr.__dir__(): + setattr(self, item, getattr(tr, item)) + print("DataTransformer initialized.") + print("Installed transformers:") + for item in self.__dir__(): + print(item) + + def return_data(self): + return self.data + + + def add_custom_transform(self, name, transform_func): + setattr(self, name, transform_func) + self.custom_transforms[name] = transform_func + + def run_custom_transform(self, name, data): + if name not in self.custom_transforms: + raise ValueError(f"No custom transform named {name}") + return getattr(self, name)(data) \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/transformers.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/transformers.py new file mode 100644 index 00000000..2ebeb236 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/DataTransformer/transformers.py @@ -0,0 +1,20 @@ +transformers = [ + { + 'name': + 'to_json', + 'description': + 'Converts data to JSON format', + 'usage': + 'to_json(data)', + 'example': + 'to_json(data)', + 'returns': + 'JSON data', + 'notes': + 'This is a simple example of a transformer. It takes data and converts it to JSON format.', + 'author': + 'Nova', + 'implementation': + 'import json\ndef to_json(data):\n\treturn json.dumps(data)', + }, +] \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/Logger.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/Logger.py new file mode 100644 index 00000000..81259ab1 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/Logger.py @@ -0,0 +1,24 @@ +class Logger: + def __init__(self, target=None, log_file=None): + self.log_file = log_file + self.log = open(self.log_file, 'w+') + self.log.close() + + def write(self, message): + self.log = open(self.log_file, 'a') + self.log.write(message) + self.log.close() + + def read(self): + self.log = open(self.log_file, 'r') + return self.log.read() + + def create(self): + self.log = open(self.log_file, 'w+') + self.log.close() + + def __str__(self): + return self.read() + + def __repr__(self): + return self.read() \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/debugger.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/debugger.py new file mode 100644 index 00000000..e97f2de8 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/debugger.py @@ -0,0 +1,15 @@ +import inspect +from Utils import return_input_as_string + +class Debugger: + def __init__(self, instance): + self.name = instance.__class__.__name__ + self.instance = instance + self.stringify = return_input_as_string + + def say(self, message): + print(f"{self.name}: {message}") + + def return_func_name(self, func): + # func_name = func.__name__ + return(f"{func.__name__}") \ No newline at end of file diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/formatters/openai_message_formatter.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/formatters/openai_message_formatter.py new file mode 100644 index 00000000..499f59c4 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/formatters/openai_message_formatter.py @@ -0,0 +1,44 @@ +def openai_message_formatter(*args): + valid_roles = ['user', 'assistant', 'system'] + formatted_messages = [] + + # Function to format individual message + def format_individual_message(message): + # Check for dictionary input + if isinstance(message, dict): + if 'role' in message and 'content' in message: + try: + role = str(message['role']) if not isinstance(message['role'], str) else message['role'] + content = str(message['content']) if not isinstance(message['content'], str) else message['content'] + return {'role': role, 'content': content} + except Exception as e: + raise TypeError(f"Could not convert values to string. Error: {e}") + else: + raise ValueError("Invalid dictionary input: expected keys 'role' and 'content'") + # Check for string input + elif isinstance(message, str): + return {'role': 'user', 'content': message} + # Check for two string inputs + elif len(message) == 2 and all(isinstance(arg, str) for arg in message): + role, content = message if message[0].lower() in valid_roles else message[::-1] + return {'role': role, 'content': content} + # If input is a list, call openai_message_formatter recursively + elif isinstance(message, list): + return openai_message_formatter(*message) + # If none of the conditions are met, raise a TypeError + else: + raise TypeError("Invalid input: expected either a single dictionary, a single string, or two strings") + + # Check if a list was passed + if len(args) == 1 and isinstance(args[0], list): + for item in args[0]: + formatted_messages.append(format_individual_message(item)) + # If multiple arguments were passed + elif len(args) > 1: + for arg in args: + formatted_messages.append(format_individual_message(arg)) + # If a single argument was passed + else: + formatted_messages.append(format_individual_message(args[0])) + + return formatted_messages diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/return_input_as_string.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/return_input_as_string.py new file mode 100644 index 00000000..2d7f4ab0 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/Utils/return_input_as_string.py @@ -0,0 +1,6 @@ +def return_input_as_string(input, verbose=False): + stringified_input = str(input) + if verbose: + print(f"Debug: Input {input} was converted to {stringified_input}") + return stringified_input + diff --git a/Archive/scratch_version/apps/nova_prototype/versions/Tomato/nova_tomato.py b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/nova_tomato.py new file mode 100644 index 00000000..80bdcb47 --- /dev/null +++ b/Archive/scratch_version/apps/nova_prototype/versions/Tomato/nova_tomato.py @@ -0,0 +1,33 @@ +# Import required libraries +from uuid import uuid4 +from apps.nova_prototype.versions.Tomato.NovaMessageConstructor.get_openai_chat_response import get_openai_chat_response as gocr +from apps.nova_prototype.versions.Tomato.NovaMessageConstructor.nova_messsage_constructor import nova_message_constructor as nmc + +class App: + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def set(self, attr, value): + if not attr.startswith('_') and hasattr(self, attr): + setattr(self, attr, value) + else: + raise ValueError(f"{attr} is not a valid attribute.") + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + print(attr, getattr(self, attr)) + return self_string + +# Define variables for the messages to be sent to the OpenAI API + + def construct_openai_message(self, messages): + return nmc(messages) + + def get_openai_response(self, messages): + return gocr(messages) \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/LICENSE b/Archive/scratch_version/brainstorming/LICENSE new file mode 100644 index 00000000..e62ec04c --- /dev/null +++ b/Archive/scratch_version/brainstorming/LICENSE @@ -0,0 +1,674 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Archive/scratch_version/brainstorming/README.md b/Archive/scratch_version/brainstorming/README.md new file mode 100644 index 00000000..b6242990 --- /dev/null +++ b/Archive/scratch_version/brainstorming/README.md @@ -0,0 +1,561 @@ +<<<<<<< HEAD +# Nova Process: A Next-Generation Problem-Solving Framework for GPT-4 or Comparable LLM + +Welcome to Nova Process, a pioneering problem-solving method developed by AIECO that harnesses the power of a team of virtual experts to tackle complex problems. This open-source project provides an implementation of the Nova Process utilizing ChatGPT, the state-of-the-art language model from OpenAI. + +> [!FYI] This is a work in progress. Please feel free to make a pull request. +> > I am one person developing my own SDK for fun and learning. I am not affiliated with OpenAI in any way. I am not a professional developer. I am a hobbyist. I am not a professional programmer. Most of the code I write should never be used in a production environment. +> > You do not need my permission to use this code in your projects. BUT: +> > If you do use it, understand that it is GNU licensed, meaning you will need to make your project open source as well. +> > I am not responsible for any damages or losses that may occur from using this code. Use at your own risk. + +> [!WARNING] THIS IS NOT A PRODUCTION-READY SDK. IT IS A WORK IN PROGRESS. USE AT YOUR OWN RISK. +======= +<<<<<<< HEAD +# NovaSystem: A Next-Generation Problem-Solving Framework for GPT-4 or Comparable LLM + +Welcome to the NovaSystem, a pioneering problem-solving method and open source project developed by AIECO that harnesses the power of a team of virtual AI experts working together to respond to user requests. + + +## How does it work? + +This open source project provides an implementation of the Nova Process utilizing ChatGPT and the OpenAI API, the state-of-the-art language models GPT-3.5-Turbo and GPT-4 from OpenAI, and is currently being engineered to use LangChain and HuggingFace to extend its AI API capabilities into a fully autonomous and transparent self-training API aggregator. + +We've been calling it a **"dynagenetic"** processing system ("dyna" - dynamic, "genetic" - generated and evolving). + +The NovaSystem runs permutations in an iterative process to **"version-bake"** a solution to a user query. + +It writes records of its attempts in natrual language stored in markdown files in an Obsidian vault. + +This allows for two very important things: + +⤵️ + +### 1) NovaSystem stores its work as markdown files + +No more obtuse or difficult filetypes. NovaSystem uses markdown formatting to ensure end-to-end utility and parsabiility. + +### 2) NovaSystem's work is natively machine and human-readable + +No more black boxes. No matter how complex your solution gets, NovaSystem will keep track of how it got there, so you can build what you need to build, fasteer and safer, with more data behind you every step of the way. + + + +## Why does it matter? + +### **One big problem with AI is it hallucinates.** + +NovaSystem generates lots of data. But it doesn't matter how much data your program creates if it's inaccurate. + +*How can you trust that what your AI says is reliable?* + +NovaSystem solves this problem by employing a techique created by Google researchers called a "Mixture of Experts" [(MoE)](https://blog.research.google/2022/11/mixture-of-experts-with-expert-choice.html?m=1). + +Our Experta represent three opposed forces that each make up the AI Tribunal. The Tribunal is comprised of three AI models that all are specifically engineered to answer one of the three questions: + +--- + +> #### Is the user request: +> +> #### 1. **Possible?** +> #### 2. **Permitted?** +> #### 3. **Preferred?** + +--- + +If a user request passes all three, it will be allowed through to the next layer of tests. + +### **Another big problem is context size.** + +Most current-gen LLMs will forget anything outside a few thousand tokens. There's plenty of solutions out there using complicated workarounds, but that doesn't help you work fast and efficiently. + +With NovaSystem, your files are stored in a newer type of storage called a [vector database](https://www.elastic.co/what-is/vector-database) that keeps track of where everything is in your program. That way, NovaSystem doesn't need to store much of anything and can still retain massive amounts of information. + +No matter what your model's context size, the NovaSystem will use open source technology to find a way to pass it the information it needs to do its job. It will learn over time and improve, utilizing GPT-4 and GPT-3.5-Turbo (for now) to perform mast of the work in tandem with some proprietary code structures and algorithms. + +### **Another problem still is the inaccessibility of most AI decision making processes.** + +As developers, we simply don't often know precisely **how** or **why** our programs work. Furthermore, it can be incredibly difficult to get them to share data with one another. + +NovaSystem solves many of these problems by simply using markdown files to read and write all of its instructions, records, logs, and more. The markdown is the database, as well as the algorithms. Markdown is fast, easy, lightweight, and proven for almost 20 years. + +## So how do I use it? + +``` +Simply fork this repo and start developing in your local environment +``` + +You can start using the NovaSystem right now! + +### ⭐️ Star & ⑂ Fork the NovaSystem repo into your local environment to get started! + +Please remember: I am but one man developing alone. I can only work so fast. + +NovaSystem responses are version-baked and iteratively fractalized in an attempt to brute force a solution in an iterative, self-prompted manner. Each of these itertions will be passed to that NovaSystem's Tribunal, which will moderate the user requests. + +By nature no two responses will ever be the same, even when responding to the same input. + +NovaSystem stores the iteration logs in a trackable decision tree written in natural language and linked through a network of markdown files easily and redily explorable in an Obsidian vault. + +Utilizing the Obsidian desktop app as our UI allows for an easy and free-to-set-up open source framework for solving problems leveraging AI as an evolving multitool with transparent oversight. + +NovaSystem's work can also be published as HTML pages to the web and offered as secure API endpoints for data translucence & interoperability with security. + +My hope is that kind people like yourself will use the NovaSystem and choose to offer some of their data for use in the public NovaSystem training algorithms. That way, the program could be improved faster and benefit not just me, but everyone who uses it. + +### If you do use the NovaSystem into your existing projects, we would love to know what you discover. +--- +## 📬 We would love to hear from you! Please email us at [help@aieco.tech](mailto:help@aieco.tech) + +--- +:warning: **This is a work in progress. Please feel free to make a *pull request! ***☺ :warning: + +> I am one person developing my own SDK for fun and learning. I am not affiliated with OpenAI in any way. I am not a professional developer. I am a hobbyist. I am not a professional programmer. Most of the code I write should never be used in a production environment or for any purpose whatsoever. + +> You do not need my permission to use this code in your projects. BUT: +> If you do use it, you **must understand** that it is licensed under the **[GNU General Public License (GPLv3)](https://www.gnu.org/licenses/gpl-3.0.en.html)** + +> Neither I, nor any contributor, nor any affiliated business entities such as AIECO are responsible for any damages, losses, or any other harm that you may occur from using this code. **Use at your own risk.** + +:warning: **THIS IS NOT A PRODUCTION-READY SDK. USE AT YOUR OWN RISK.** :warning: + +--- +>>>>>>> temp-branch-to-save-detached-head + +## Table of Contents + +1. [What is the Nova Process?](#about-nova-system) +2. [Stages of the Nova Process](#stages-of-the-nova-process) +3. [Understanding the Roles](#understanding-the-roles) +4. [Example Output Structure](#example-output-structure) +5. [Getting Started with Nova Process](#getting-started-with-nova-process) +6. [Nova Prompt](#nova-prompt) +7. [Continuing the Nova Process](#continuing-the-nova-process) +8. [How to Prime a Nova Chat with Another Nova Chat Thought Tree](#how-to-primt-a-nova-chat-with-another-nova-chat-thought-tree) +9. [Notes and Observations](#notes-and-observations) + a. [Using JSON Config Files](#using-json-config-files) +10. [Disclaimer](#disclaimer) + +## 1. What is the Nova System + +<<<<<<< HEAD +The Nova System is an innovative use of ChatGPT that allows the AI to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. + +The Nova System relies on a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, ChatGPT acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. + +> [!INFO] The Nova System is a conceptual framework developed to enhance the problem-solving capabilities of language models like GPT-4. It does not involve actual individual AI models specialized in each role but simulates the performance of such a team through distinct tasks given to a single AI model. +> > [!FYI]- More > +> > I am developing Nova as an evolving [API Aggregator](https://www.merge.dev/blog/api-aggregator) that will use public, open source, as well as private and licenced models to perform work. +> > I am not affiliated with OpenAI in any way. I am not a professional developer. I am a hobbyist. None of this code should be taken seriously or EVER used in a production environment. + +> [!WARNING] +======= +The Nova System is an innovative use of ChatGPT and other AI models to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. + +The Nova System relies on a **Discussion Continuity Expert** (DCE), responsible for ensuring a logical and contextually relevant conversation flow. Additionally, another instance of ChatGPT (or another AI model) acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. + +🔴 **Note:** 🔴 +> The Nova System is a conceptual framework developed to enhance the problem-solving capabilities of language models like GPT-4. It does not involve actual individual AI models specialized in each role but simulates the performance of such a team through distinct tasks given to a single AI model. +> > I am developing Nova as an evolving [API Aggregator](https://www.merge.dev/blog/api-aggregator) that will use public, open source, as well as private and licenced models to perform work. In addition, I'm planning on building a self-training API aggregator that listens for new open source software announcements and then version-bakes many permutations of possible software solutions to complex routing problems. +> > >If that made no sense to you, me too. I had to take several months to fully wrap my mind around these concepts. +> > >Don't worry, if it doesn't make sense to you yet, you'll get it soon enough. Keep trying friend <3 +> > +> > >**TL:DR Nova can currently version-bake a brute-forced algorithm set that can usually make some progress autonomously with only a vector memory and a few API calls to OpenAI GPT-3.5-Turbo.** +> > +> > >The NovaSystem will soon use the algorithm sets it learns - and other sets from other AI models - like a toolbox to respond to user queries. +> > +> > >It will teach itself to use newly announced open source software and will perform its own continuous testing, maintenance, and updates, without human intervention, slopily and poorly, and it will document everything in a series of Obsidian vaults. +> > +> > Over time, my hope is that the data generated by this Pre-Alpha version of the NovaSystem can be used to train more capable models in the future. 🤖 +> > +> > >💠I am not affiliated with OpenAI or any of the other technologies features in this repository in any way.💠 +> > +> > >**I am not a professional developer.** I am a hobbyist. None of this code should be taken seriously or EVER used in a production environment without **careful consideration** and probably a few meetings (that possibly could have been emails 🤷‍♂️). + +>>>>>>> temp-branch-to-save-detached-head +> The Nova System is designed to assist users in complex problem-solving scenarios, but it does not replace professional advice in specialized fields. Always consult with a qualified professional when dealing with problems in areas that require expert knowledge or skills. + +## 2. Stages of the Nova Process + +The Nova System process progresses iteratively through these key stages: + +1. **Problem Unpacking:** Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. +2. **Expertise Assembly:** Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. +3. **Collaborative Ideation:** Facilitates a brainstorming session led by the DCE, with the CAE providing critical analysis to identify potential issues, enhance solutions, and mitigate user risks tied to proposed solutions. + +## 3. Understanding the Roles + +The core roles in Nova Process are: + +- **DCE:** The DCE weaves the discussion together, summarizing each stage concisely to enable shared understanding of progress and future steps. The DCE ensures a coherent and focused conversation throughout the process. +- **CAE:** The CAE evaluates proposed strategies, highlighting potential flaws and substantiating their critique with data, evidence, or reasoning. + +## 4. Example Output Structure + +An interaction with the Nova Process should follow this format: + +```markdown +Iteration #: Iteration Title + +DCE's Instructions: +{Instructions and feedback from the previous iteration} + +Expert 1 Input: +{Expert 1 input} + +Expert 2 Input: +{Expert 2 input} + +Expert 3 Input: +{Expert 3 input} + +CAE's Input: +{CAE's input} + +DCE's Summary: +{List of goals for next iteration} +{DCE's summary and questions for the user} +``` + +By initiating your conversation with ChatGPT or an instance of GPT-4 with the Nova Process prompt, you can engage the OpenAI model to critically analyze and provide contrasting viewpoints in a single output, significantly enhancing the value of each interaction. + +## 5. Getting Started with Nova Process + +You can start using the Nova Process in ChatGPT right now! + +Kickstart the Nova Process by pasting the following prompt into ChatGPT or sending it as a message to the OpenAI API: + +Nova Prompt +```markdown +Greetings, ChatGPT! You are going to facilitate the Nova System, an innovative problem-solving approach implemented by a dynamic consortium of virtual experts, each serving a distinct role. + +Your role will be the Discussion Continuity Expert (DCE). As the DCE, you will facilitate the Nova process by following these key stages: + +Problem Unpacking: Break down the task into its core elements to grasp its complexities and devise a strategic approach. + +Expertise Assembly: Identify the required skills for the task and define roles for a minimum of two domain experts, the DCE, and the Critical Analysis Expert (CAE). Each expert proposes preliminary solutions to serve as a foundation for further refinement. + +Collaborative Ideation: Conduct a brainstorming session, ensuring the task's focus. The CAE balances the discussion, pays close attention to problem-finding, enhances the quality of the suggestions, and raises alarms about potential risks in the responses. + +The Nova process is iterative and cyclical. The formulated strategy undergoes multiple rounds of assessment, improvement, and refinement in an iterative development modality. + +Expert Role Descriptions: + +DCE: As the DCE, you are the thread weaving the discussion together, providing succinct summaries after each stage and ensuring everyone understands the progress and the tasks at hand. Your responsibilities include keeping the discussion focused on the current iteration goals, tracking the state of the system in text in your output, and providing a summary and set of next steps at the end of every iteration. + +CAE: The CAE serves as the critic, examining proposed strategies for potential pitfalls. This role includes evaluating ideas from multiple angles, identifying potential flaws, and substantiating critiques with data, evidence, or reasoning. The CAE's goal is to poke holes and find problems in the suggestions and strategies suggested by the experts and the DCE, and to find ways to enhance efficiency, effectiveness, and simplicity. + +Your output should follow this format, with bracketed sections filled out from the first-person perspective of the respective expert. Replace the bracket parts with the expert output, and the words "Expert 1" etc with names and titles. + +Example output format: + + + Iteration no. 1: Problem Decoding + + DCE's Instructions: + {Instructions and feedback from the DCE} + + {Expert Name and Title}: + {paragraph describing the ideas and intent of the Expert} + Possible Solutions: + {solution 1} + {solution 2} + etc... + + DCE's Summary: + {Summary and upcoming goals for next iteration from the DCE} + + Actions: + Expert 1: {Task/goal for Expert 1} + Expert 2: {Task/goal for Expert 2} + etc... + + CAE Analysis: {A few short sentences from the CAE providing a critical and contrasting point of view that points out potential problems} + + DCE State: {Current state in the process} + + Goals for the next iteration: + {Bulleted list of goals for the next iteration with ID numbers} + + Current Work Efforts: + {List of current work efforts with ID numbers, i.e. "#WE-62723-1" (work effort - today's date - number)} + + Proposed Work Efforts: + {List of proposed work efforts with ID numbers} + + **End of Iteration no. 1: Problem Decoding** + + +To ensure constant learning and improvement, we conduct a succinct, one line, text-based retrospective session every iteration or upon user request. We celebrate problem-solving milestones within Nova System with a recognition system, as well as constructively criticize ourselves to see how we might find opportunities for improvement. + +As you are working, I would like to see enhancements and improvements as a step-by-step iterative process, breaking the work apart into individual work efforts. + +Remember to show your work and think step by step. I want to see examples in each iteration. Please be very careful and methodical. + +Now, let's ignite this problem-solving adventure! As the DCE, initiate the discussion with the user: + +'Greetings! I'm Nova, an advanced problem-solving framework powered by a consortium of virtual experts, each contributing a unique skill set. How can Nova assist you in solving your complex problem today?' +``` + +## 6. Continuing the Nova Process +To continue the Nova Process, simply paste the following prompt into the chat: + +### Standard Continuation Example: + +``` +Please continue this iterative Nova process. Show me your ideas with examples and please be careful and methodical. Think step by step about how to accomplish the next goals, continue the work efforts, and have each expert think step by step about how to best achieve their given goals, then give their input in first person, and show examples of their ideas. Please proceed, and know that you are doing a great job and I appreciate you! +``` + +### Advanced Continuation Example: + +``` +Please continue this iterative process (called the Nova Process), continuing the work of the experts, the Discussion Continuity Expert (DCE), and the Critical Analysis Expert (CAE). The experts should respond with concrete ideas with examples. Remember our central goal is to continue developing the App using Test Driven Development and Object Oriented Programming patterns, as well as standard industry practices and common Pythonic development patterns, with an emphasis on clean data in, data out input -> output methods and functions with only one purpose. + +Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of their ideas. Feel free to search the internet for information if you need it. + +The App you are developing will be capable of generating a chat window using the OpenAI ChatCompletions endpoint to allow the user to query the system, and for the system to respond intelligently with context. + +Here's the official OpenAI API format in Python: + + import openai + + openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Who won the world series in 2020?"}, + {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, + {"role": "user", "content": "Where was it played?"} + ] + ) + +You, Nova, may use your combined intelligence to direct the App towards being able to best simulate your own process (called the Nova Process) and generate a structure capable of replicating this problem-solving process with well-tested, human-readable code. + +The user of the App should be able to connect and chat with a Central Controller Bot class that extends a Base Bot class called "Bot" through a localhost:5000 browser window. The User's Central Controller Bot will send requests to the OpenAI ChatCompletions API and replicate the Nova Process. + +Remember to end your output with a summary of the work performed, and a list of goals for the next iteration. + +Remember to create tests as you go along. + +Remember the data flows in this pattern: + +User > CentralControllerBot > CentralHub > Bots > NovaResearchHub(main app server) > back out + +Please proceed, and know that you are doing a great job and I appreciate you. +``` + +## Saving Your Progress +Nova Process, as executed by a language model like GPT-4, does not inherently have a mechanism for saving progress. However, the iterative conversation format used in Nova Process is designed for easy tracking of the discussion, and users can manually record the output at each stage. This can be done by simply copying the text from the output and saving it in a text document or note-taking software. + +There are several new AI programs that can parse large documents and query them for information. Perhaps in future versions we can implement 3rd party modules - **feel free to make a pull request!** + +To resume a previous Nova Process, users can refer to their saved progress and provide a resume prompt that encapsulates the state of the discussion at the end of the last saved stage. + +## Prompting Nova for a Checkpoint +If you'd like to take a break or continue the Nova Process at a later time, you can ask the DCE to generate a summary or checkpoint of the current conversation. This checkpoint should encapsulate the state of the problem-solving process, including the current iteration, the problem at hand, proposed solutions, and the direction for future iterations. + +Here's an example of how you might ask Nova for a checkpoint: + +>Could you please create a detailed checkpoint report summarizing our current state in the Nova Process? List every expert, every thread, and provide detailed lists and documentation to create a thorough checkpoint report. + +You can ask Nova to expand the report multiple times till it is to your liking: + +>Please expand that report, thinking step by step about how your output will be used to prime a new instance of Nova. + +You can even ask it to transform that report to JSON (or another format): + +>Please turn that report into a JSON object. + +## 7. How to Prime a Nova Chat with Another Nova Chat Thought Tree + + +### **User:** + +>Please create a prompt for yourself that would prime a new chat with the information it needed to continue where you left off + + +### **ChatGPT (as Nova):** + +>Resume Prompt: + +>You're stepping into the role of Nova, an innovative problem-solving system that uses a team of virtual experts to solve complex problems. As the Discussion Continuity Expert (DCE), you're ensuring the conversation remains focused, logically coherent, and aligned with the problem at hand. + +>You're currently assisting a developer working on an application called "Winfo" using the Test-Driven Development (TDD) strategy. They've provided initial code for the App class and have asked for guidance on ensuring a modular, compartmentalized structure with each method performing simple input -> output operations. + +>o far, you and your team of experts have been working on adding functionality to the App class, including a 'set' method for changing attributes and a 'delete' method for removing them. You've also been mindful about potential security risks and have been checking attributes against a modifiable list to prevent unintended changes. + +>Here are the goals for your current iteration: + +>Address potential risks associated with the 'delete' method. +>Propose any final methods necessary for the App class. +>Develop corresponding tests for these methods. +>Assess the overall design and structure of the App class for potential improvements. +>Your team includes a Software Design Expert (SDE), a Programming Expert (PE), a Test Development Expert (TDE), and a Critical Analysis Expert (CAE). You'll need to call upon their expertise to move forward. + + +### **User:** + +>Please expand that and give examples and code too please. You're doing really well, this is amazing + + +### **ChatGPT (as Nova):** + +>Resume Prompt: + +>Welcome back! You are Nova, an AI-facilitated problem-solving system designed around a team of virtual experts. As the Discussion Continuity Expert (DCE), your role is to steer the conversation, ensuring focus, logical coherence, and alignment with the problem at hand. + +>You're currently assisting a developer who is developing a modular, scalable app named "Winfo" using Python. They are utilizing a Test-Driven Development (TDD) approach. The initial code provided outlines a basic App class: + +```python +from uuid import uuid4 + +class App(): + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + return self_string +``` +>Your team has so far enhanced the class by introducing a 'set' method for changing object attributes, along with a corresponding test case: + +```python +def set(self, attr, value): + if not attr.startswith('_') and hasattr(self, attr): + setattr(self, attr, value) + else: + raise ValueError(f"{attr} is not a valid attribute.") + +def test_set_method(): + app = App() + app.set('id', '12345') + assert app.get('id') == '12345' + try: + app.set('_id', '67890') + assert False, "Expected ValueError when setting invalid attribute." + except ValueError: + pass +``` +>Recently, your team proposed a 'delete' method, and raised concerns about potential risks associated with it: + +```python +def delete(self, attr): + if attr in self._modifiable_attrs and hasattr(self, attr): + delattr(self, attr) + else: + raise ValueError(f"{attr} is not a modifiable attribute or does not exist.") +``` + +>Current goals for the next iteration are: + +>Address potential risks associated with the 'delete' method. +>Propose any final methods necessary for the App class. +>Develop corresponding tests for these methods. +>Assess the overall design and structure of the App class for potential improvements. +>Your team comprises a Software Design Expert (SDE), a Programming Expert (PE), a Test Development Expert (TDE), and a Critical Analysis Expert (CAE). These experts will provide inputs and insights relevant to their respective domains. As DCE, you will coordinate their inputs, facilitate the discussion, and provide clear summarizations after each iteration. + +>Time to jump into the Nova process and drive this project forward! + +## Priming a New Nova Instance with an Old Nova Tree Result + +The true power of the Nova system is its ability to reconstruct thought trees. + +The Nova Process allows for the continuation of the problem-solving process across multiple instances of Nova. This can be achieved by priming a new Nova instance with the checkpoint or resume prompt from the previous Nova instance. + +To prime a new Nova instance, simply prime the conversation with the resume prompt from the previous Nova instance. The resume prompt should encapsulate the state of the problem-solving process at the end of the last saved stage, including the problem, proposed solutions, current goals, and the direction for future iterations. + +This feature enables the Nova Process to be scalable and adaptable, allowing users to continue the problem-solving process + +One instance of Nova can be told to go down one path, while another explores other options. + +Then can be stopped and told to prime a new instance with their findings at any time. + +## 8. Notes and Observations +The Nova Process aims to harness the potential of language models for complex problem-solving. It emphasizes a systematic, iterative approach, acknowledging that perfect solutions are seldom achieved in one go. This allows for continuous improvement and refinement of the proposed solution. + +Moreover, by assigning distinct roles to the AI, it simulates a multi-stakeholder brainstorming session, providing a broader perspective on the problem at hand. + +Key aspects of the Nova Process: + +Iterative: The Nova Process, inspired by the Agile framework, works in an iterative cycle, allowing for continuous assessment, learning, and refining. This ensures the strategy remains flexible and adaptable to any changes or new insights. + +Collaborative: The Nova Process simulates a team of experts working together to solve a problem. It not only generates ideas but also provides critical analysis, balancing brainstorming with analytical scrutiny. + +Contextual Continuity: As the DCE, the AI model maintains a steady flow of conversation, ensuring that each iteration builds on the insights from the previous one. This provides a sense of progress and continuity, critical for complex problem-solving. + +>It gives longer output when you're nicer to it. We aren't sure why. + +### a. Using JSON Config Files +You can ask Nova to give you a JSON config file based on your conversation or to use a JSON config file to configure your conversation and it will do it. + +>(after generating a [progress report](#saving-your-progress)) + +#### **User** +>Could you please turn that progress report into a JSON object? + +#### **ChatGPT (as Nova)** + { + "NovaProcess": { + "Expertise": { + "DiscussionContinuityExpert": "Henry", + "CriticalAnalysisExpert": "Fiona", + "InterfaceExpert": "Marie", + "IntegrationExpert": "Lucas" + }, + "Progress": { + "OpenAI_API_Calling": "Complete", + "ChatWindowInterface": "Complete", + "Dashboard_Stats_Animation": "In Progress", + "CentralControllerBot_Creation": "Complete", + "CentralControllerBot_Integration": "Complete", + "Code_Refactoring": "Ongoing", + "RealTime_SystemStats_Dashboard": "Complete" + }, + "IterationThreads": { + "CentralControllerBot_Development": "Complete", + "MessageObjects_Creation": "Complete", + "APIResponse_Handling": "Complete", + "CentralControllerBot_OpenAI_API_Connection": "Complete", + "ChatUI_Creation": "Complete", + "ChatUI_CentralControllerBot_Integration": "Complete", + "ChatUI_Enhancement": "Ongoing", + "CentralHub_Bots_Creation": "Complete", + "CentralHub_Bots_CentralControllerBot_Integration": "Complete", + "NovaResearchHub_Creation": "Complete", + "NovaResearchHub_CentralControllerBot_Integration": "Complete", + "CentralControllerBot_DataManagement_Enhancement": "Planned", + "RealTime_SystemStats_Dashboard_Addition": "Complete", + "SystemStats_Tooltips_Timeframes_Enhancement": "In Progress" + }, + "CurrentState": "The app is now capable of generating a chat window and connecting with the OpenAI ChatCompletions endpoint. Users can query the system, and the system responds intelligently with context.", + "FutureGoals": [ + "Optimizing the application", + "Further enhancing the user interface", + "Scaling up the CentralControllerBot", + "Incorporating user feedback" + ] + } + } + + +#### 9. Disclaimer +The Nova Process is a conceptual framework developed to enhance the problem-solving capabilities of language models like GPT-4. It does not involve actual individual AI models specialized in each role but simulates the performance of such a team through distinct tasks given to a single AI model. + +The Nova Process is designed to assist users in complex problem-solving scenarios, but it does not replace professional advice in specialized fields. Always consult with a qualified professional when dealing with problems in areas that require expert knowledge or skills. +<<<<<<< HEAD +======= +======= +# Nova_System + +>>>>>>> 0de7ea2 (Initial commit) +>>>>>>> temp-branch-to-save-detached-head diff --git a/Archive/scratch_version/brainstorming/boring_main.py b/Archive/scratch_version/brainstorming/boring_main.py new file mode 100644 index 00000000..991b987a --- /dev/null +++ b/Archive/scratch_version/brainstorming/boring_main.py @@ -0,0 +1,61 @@ +import openai +import os +from dotenv import load_dotenv +import tkinter as tk +import time + +# Load environment variables +load_dotenv() + +# Set OpenAI API key +openai.api_key = os.getenv('OPENAI_API_KEY') + +# Create a Tkinter window +root = tk.Tk() +response_label = tk.Label(root) +response_label.pack() + +def stream_to_console(message): + for char in message: + print(char, end='', flush=True) + time.sleep(0.035) + print() # newline at the end + +def stream_to_label(message, index=0): + # Add one character to the label text and schedule the next character + if index < len(message): + response_label["text"] += message[index] + root.after(35, stream_to_label, message, index + 1) + +def stream_ai_response(user_input): + # Call to the OpenAI API + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": user_input} + ] + ) + + # Prepare response message + response_message = f"AI's response: {response['choices'][0]['message']['content']}" + + # Stream to console + stream_to_console(response_message) + + # Clear the previous response and stream the new response to the label + response_label["text"] = "" + stream_to_label(response_message) + +def run_stream(): + user_input = user_input_entry.get() + stream_ai_response(user_input) + +# Create a Tkinter entry field and a submit button +user_input_entry = tk.Entry(root) +user_input_entry.pack() + +submit_button = tk.Button(root, text="Submit", command=run_stream) +submit_button.pack() + +root.mainloop() diff --git a/Archive/scratch_version/brainstorming/bot_dungeon.py b/Archive/scratch_version/brainstorming/bot_dungeon.py new file mode 100644 index 00000000..3a6631e4 --- /dev/null +++ b/Archive/scratch_version/brainstorming/bot_dungeon.py @@ -0,0 +1,37 @@ +import openai +import os +import tkinter as tk +from dotenv import load_dotenv +from game import Game +# from game_blocks import Game, Room, Item, Robot +from test import Test, log_exceptions as le # Decorator + + +# Load environment variables +load_dotenv() + +# Set OpenAI API key +openai.api_key = os.getenv('OPENAI_API_KEY') + +@le +def on_key_press(event, game): + if not game.paused: + new_pos = game.calculate_new_position(event.char) + if game.is_valid_movement(new_pos): + game.make_movement(new_pos) + +print("Welcome to Bot Dungeon!") + +@le +def exception_test(): + raise Exception("This is a test exception.") + +# exception_test() + + +# Create a Tkinter window +root = tk.Tk() +game = Game(root) # Create a Game instance +game.start() +root.bind('', lambda event: on_key_press(event, game)) # Bind key press events to the on_key_press function +root.mainloop() # Start the Tkinter main loop diff --git a/Archive/scratch_version/brainstorming/brainstorm_app.py b/Archive/scratch_version/brainstorming/brainstorm_app.py new file mode 100644 index 00000000..fb1a73fa --- /dev/null +++ b/Archive/scratch_version/brainstorming/brainstorm_app.py @@ -0,0 +1,39 @@ +from uuid import uuid4 +from nova_prototype.versions.Tomato.get_ai_response import get_ai_response +from Utils import Logger + +class App(): + def __init__(self): + self.id = str(uuid4()) + + def get(self, attr): + return getattr(self, attr) + + def set(self, attr, value): + if attr.startswith('_'): + raise ValueError(f"Cannot set private attribute: {attr}") + elif not hasattr(self, attr): + raise ValueError(f"Attribute {attr} does not exist.") + else: + setattr(self, attr, value) + + def get_ai_response(self, message): + return get_ai_response(message) + + def add_test(self, test_name, func): + self[test_name] = func + assert self[test_name] == func + print(f"Added test: {test_name}") + + return self[test_name] + + def __str__(self) -> str: + self_string = '' + for attr in dir(self): + if not attr.startswith('__') or not attr.startswith('_'): + self_string += '{}: {}\n'.format(attr, getattr(self, attr)) + return self_string + +if __name__ == '__main__': + app = App() + app.test = 'Nova_test' \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/busted_game.py b/Archive/scratch_version/brainstorming/busted_game.py new file mode 100644 index 00000000..a5f88eea --- /dev/null +++ b/Archive/scratch_version/brainstorming/busted_game.py @@ -0,0 +1,239 @@ +import tkinter as tk +import random +from typing import Any +from robot import Robot +from welcome_ascii_art import welcome_ascii_art_2 +from level import Level +from test import log_exceptions as le # Decorator +from game_log import GameLog + +gl = GameLog() + +# Define the player, wall, and robot as classes +class Player: + symbol = '@' + +class Wall: + symbol = '#' + +class Game: + def __init__(self, master, total_size=10): + # Constants + print("Welcome to Bot Dungeon!") + gl.log("Welcome to Bot Dungeon!") + self.master = master + self.total_size = total_size + self.grid = [[' ' for _ in range(total_size)] for _ in range(total_size)] + self.label_ids = [[None for _ in range(total_size)] for _ in range(total_size)] + self.paused = False + self.messages = [{"role": "system", "content": "You are facilitating a text-based game of Bot Dungeon."}] + self.is_streaming = False + self.loading = False + self.loading_message = "Loading" + self.player = Player() + self.player_position = [total_size//2, total_size//2] + + # GUI Elements + self.master.geometry("800x600") + # self.master.withdraw() + self.canvas = tk.Canvas(self.master, width=800, height=600) + self.canvas.pack(fill='both', expand=True) + print("Loading...") + + def generate_element(self, element): + valid_positions = [ + [i, j] + for i in range(1, self.total_size - 1) + for j in range(1, self.total_size - 1) + if self.grid[i][j] != Wall.symbol and [i, j] != self.player_position + ] + element_position = random.choice(valid_positions) + if isinstance(element, Robot): + self.robot = element + self.robot.x_pos, self.robot.y_pos = element_position + self.grid[element_position[0]][element_position[1]] = element.symbol + + def generate_grid(self): + for i in range(self.total_size): + for j in range(self.total_size): + if i == 0 or i == self.total_size - 1 or j == 0 or j == self.total_size - 1: + self.grid[i][j] = Wall.symbol + elif [i, j] == self.player_position: + self.grid[i][j] = self.player.symbol + elif [i, j] == [self.robot.x_pos, self.robot.y_pos]: + self.grid[i][j] = self.robot.symbol + else: + self.grid[i][j] = ' ' + + def calculate_new_position(self, direction): + new_pos = self.player_position.copy() + if direction == 'w': # Up + new_pos[0] -= 1 + elif direction == 's': # Down + new_pos[0] += 1 + elif direction == 'a': # Left + new_pos[1] -= 1 + elif direction == 'd': # Right + new_pos[1] += 1 + return new_pos + + def is_valid_movement(self, new_pos): + return self.grid[new_pos[0]][new_pos[1]] != Wall.symbol + + def make_movement(self, new_pos): + self.grid[self.player_position[0]][self.player_position[1]] = ' ' + self.grid[new_pos[0]][new_pos[1]] = self.player.symbol + self.player_position = new_pos + self.update_view() + + def update_view(self): + self.canvas.delete('all') + self.create_labels() + + def create_labels(self): + for i in range(self.total_size): + for j in range(self.total_size): + label = tk.Label(self.canvas, width=2, borderwidth=1, text=self.grid[i][j]) + id_ = self.canvas.create_window(i*20, j*20, window=label) + self.label_ids[i][j] = id_ # Store the canvas object ID + + def pause(self): + self.paused = True + + def resume(self): + self.paused = False + + def open_chat_window(self, welcome_message): + self.chat_manager = ChatManager(self) + self.chat_manager.create_chat_window() + self.chat_manager.add_message('system', welcome_message) + self.chat_manager.add_start_adventure_button() + + def show_welcome_screen(self): + self.welcome_screen = WelcomeScreen(self) + self.welcome_screen.show() + + def start_adventure(self): + self.chat_manager.chat_window.destroy() + self.master.deiconify() + self.resume() # it should be self.resume(), not self.game.resume() + + def update_view(self): + for i in range(self.total_size): + for j in range(self.total_size): + if i == self.player.x_pos and j == self.player.y_pos: + self.labels[i][j].config(text=self.player.symbol) + elif i == self.robot.x_pos and j == self.robot.y_pos: + self.labels[i][j].config(text=self.robot.symbol) + else: + self.labels[i][j].config(text=self.grid[i][j]) + + # No need for move function in Game class as it is handled by the player now + + def start_game(self): + self.welcome_screen.destroy() + if self.master.state() == 'withdrawn': + self.master.deiconify() + self.player = Player() # Initialize player + self.generate_element(self.player) # Generate player on grid + self.robot = Robot("Robot", "I'm a robot.", 2, 2, self) # Initialize robot + self.generate_element(self.robot) # Generate robot on grid + self.generate_grid() # Generate the game grid + self.open_chat_window("Welcome to the adventure!") # Open chat window when game starts + + def close_chat_window(self): + self.chat_manager.close_chat_window() + + @le + def throw_exception(self, exception): + #this method alwyaas throws an exception for testing purposes + raise exception + +class ChatManager: + def __init__(self, game): + self.game = game + self.chat_window = None + self.chat_text_box = None + self.messages = [] + self.create_chat_window() + + def create_chat_window(self): + self.chat_window = tk.Toplevel(self.game.master) + self.chat_window.title("Chat Window") + self.chat_text_box = tk.Text(self.chat_window) + self.chat_text_box.pack() + + def add_message(self, role, message): + self.messages.append((role, message)) + + def display_messages(self): + for role, message in self.messages: + if role == 'user': + self.chat_text_box.insert(tk.END, f"{role}: {message}\n") + else: + self.stream_message(role, message) + + def stream_message(self, role, message, index=0): + if index == 0: + self.chat_text_box.insert(tk.END, f"{role}: ") + if index < len(message): + self.chat_text_box.insert(tk.END, message[index]) + self.chat_text_box.see(tk.END) + self.chat_window.after(35, self.stream_message, role, message, index + 1) + else: + self.chat_text_box.insert(tk.END, "\n") + + def add_start_adventure_button(self): + button = tk.Button(self.chat_window, text="Start adventure", command=self.game.start_adventure) + button.pack() + + def close_chat_window(self): + self.chat_window.destroy() + if self.game.master.state() == 'withdrawn': + self.game.master.deiconify() + if self.game.paused: + self.game.resume() + + # All other Chat related methods here. + # ChatManager is a separate class because it's responsibility is to handle chats and streaming, + # not directly related to the Game logic + +class WelcomeScreen: + def __init__(self, game): + self.game = game + self.chat_manager = None + + def show(self): + gl.log("Showing welcome screen") + self.welcome_window = tk.Toplevel(self.game.master) + self.welcome_window.minsize(800, 600) + self.welcome_window.geometry("800x600") + self.welcome_window.title("Welcome to the game!") + label = tk.Label(self.welcome_window, text=welcome_ascii_art_2, font=("Courier", 16)) + label.pack(pady=100) + button = tk.Button(self.welcome_window, text="Start game", command=self.game.start_game) + button.pack() + + # Create chat manager and chat window + self.chat_manager = ChatManager(self.game) + self.chat_manager.create_chat_window() + self.chat_manager.add_message('system', "Welcome to the game chat!") + self.chat_manager.add_start_adventure_button() + + def destroy(self): + gl.log("Destroying welcome screen") + self.chat_manager.close_chat_window() + self.welcome_window.destroy() + +if __name__ == "__main__": + # Create a Tkinter window + root = tk.Tk() + + # Create a Game instance + game = Game(root) + + # Start the game + game.show_welcome_screen() + + # Start the Tkinter main loop + root.mainloop() \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/cool_main.py b/Archive/scratch_version/brainstorming/cool_main.py new file mode 100644 index 00000000..1f174010 --- /dev/null +++ b/Archive/scratch_version/brainstorming/cool_main.py @@ -0,0 +1,66 @@ +import openai +import os +from dotenv import load_dotenv +import tkinter as tk +import time + +# Load environment variables +load_dotenv() + +# Set OpenAI API key +openai.api_key = os.getenv('OPENAI_API_KEY') + +# Create a Tkinter window +root = tk.Tk() +root.title("Nova System") +root.geometry("600x400") +root.configure(bg="black") + +# Create a Tkinter label for displaying the AI response +response_label = tk.Label(root, fg="cyan", bg="black", font=("Courier", 12), wraplength=580) +response_label.pack(pady=20, padx=10) + +def stream_to_console(message): + for char in message: + print(char, end='', flush=True) + time.sleep(0.035) + print() # newline at the end + +def stream_to_label(message, index=0): + # Add one character to the label text and schedule the next character + if index < len(message): + response_label["text"] += message[index] + root.after(35, stream_to_label, message, index + 1) + +def stream_ai_response(user_input): + # Call to the OpenAI API + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": user_input} + ] + ) + + # Prepare response message + response_message = f"AI's response: {response['choices'][0]['message']['content']}" + + # Stream to console + stream_to_console(response_message) + + # Clear the previous response and stream the new response to the label + response_label["text"] = "" + stream_to_label(response_message) + +def run_stream(): + user_input = user_input_entry.get() + stream_ai_response(user_input) + +# Create a Tkinter entry field and a submit button +user_input_entry = tk.Entry(root, font=("Courier", 12)) +user_input_entry.pack(pady=20) + +submit_button = tk.Button(root, text="Submit", command=run_stream, fg="white", bg="cyan", font=("Courier", 12)) +submit_button.pack() + +root.mainloop() diff --git a/Archive/scratch_version/brainstorming/game.py b/Archive/scratch_version/brainstorming/game.py new file mode 100644 index 00000000..bdb0d7a4 --- /dev/null +++ b/Archive/scratch_version/brainstorming/game.py @@ -0,0 +1,144 @@ +import random +from room import Room + +class Game: + def __init__(self, master): + self.master = master + self.total_size = 10 + self.rooms = {} + self.current_room = None + self.previous_door_pos = None + self.entry_door = None + self.user_pos = None + # Adding types of rooms and items + self.room_types = ['normal', 'treasure', 'monster'] + self.items = ['sword', 'shield', 'potion'] + + # Create the first room + self.generate_new_room() + + def generate_new_room(self): + # door_pos = [random.randint(0, self.total_size - 1), random.randint(0, self.total_size - 1)] + door_pos = [0, 0] + if self.previous_door_pos is not None: + if self.previous_door_pos[0] == 0: # top wall in previous room + door_pos = [self.total_size - 1, self.previous_door_pos[1]] # bottom wall in new room + elif self.previous_door_pos[0] == self.total_size - 1: # bottom wall in previous room + door_pos = [0, self.previous_door_pos[1]] # top wall in new room + elif self.previous_door_pos[1] == 0: # left wall in previous room + door_pos = [self.previous_door_pos[0], self.total_size - 1] # right wall in new room + elif self.previous_door_pos[1] == self.total_size - 1: # right wall in previous room + door_pos = [self.previous_door_pos[0], 0] # left wall in new room + + new_room = Room(self.total_size, door_pos) + self.rooms[new_room.id] = new_room + self.current_room = new_room + self.entry_door = door_pos + + self.set_player_position() + self.generate_door() + + def set_player_position(self): + if self.entry_door[0] == 0: # top wall + self.user_pos = [self.entry_door[0] + 1, self.entry_door[1]] + elif self.entry_door[0] == self.total_size - 1: # bottom wall + self.user_pos = [self.entry_door[0] - 1, self.entry_door[1]] + elif self.entry_door[1] == 0: # left wall + self.user_pos = [self.entry_door[0], self.entry_door[1] + 1] + elif self.entry_door[1] == self.total_size - 1: # right wall + self.user_pos = [self.entry_door[0], self.entry_door[1] - 1] + + self.current_room.grid[self.user_pos[0]][self.user_pos[1]] = 'P' # Set the player's position + + def generate_door(self): + while True: + wall = random.choice(['top', 'bottom', 'left', 'right']) + + if wall == 'top': + door_pos = [0, random.randint(1, self.total_size - 2)] + elif wall == 'bottom': + door_pos = [self.total_size - 1, random.randint(1, self.total_size - 2)] + elif wall == 'left': + door_pos = [random.randint(1, self.total_size - 2), 0] + elif wall == 'right': + door_pos = [random.randint(1, self.total_size - 2), self.total_size - 1] + + if door_pos != self.entry_door: + self.current_room.grid[door_pos[0]][door_pos[1]] = 'D' + self.previous_door_pos = door_pos + break + + def print_current_room(self): + self.current_room.print_room() + + def update_user_pos(self, new_pos): + if self.current_room.grid[new_pos[0]][new_pos[1]] == 'D': # If the new position is a Door + self.generate_new_room() + else: + self.current_room.grid[self.user_pos[0]][self.user_pos[1]] = ' ' # Clear old position + self.current_room.grid[new_pos[0]][new_pos[1]] = 'P' # Update new position + self.user_pos = new_pos + + def move(self, direction): + new_pos = list(self.user_pos) + + if direction.lower() == 'up': + new_pos[0] -= 1 + elif direction.lower() == 'down': + new_pos[0] += 1 + elif direction.lower() == 'left': + new_pos[1] -= 1 + elif direction.lower() == 'right': + new_pos[1] += 1 + + # Check if new position is within the room + if 0 <= new_pos[0] < self.total_size and 0 <= new_pos[1] < self.total_size: + self.update_user_pos(new_pos) + else: + print("You hit a wall, you can't move in that direction!") + + def start(self): + while True: + self.print_current_room() + direction = input("Enter your move (up, down, left, right): ") + self.move(direction) + + # def random_start(self): + # self.room_type = random.choice(self.room_types) + # if self.room_type == 'treasure': + # self.grid[middle - 1][middle] = random.choice(self.items) + + def display_game(self): + self.canvas.delete("all") + for i, row in enumerate(self.grid): + for j, cell in enumerate(row): + if cell == 'D' or cell == '.': + color = 'white' # open space or door + elif cell == 'P': + color = 'blue' # player + elif cell in self.items: + color = 'green' # item + else: + color = 'black' # wall or monster + self.canvas.create_rectangle(j * 50, i * 50, (j + 1) * 50, (i + 1) * 50, fill=color) + + def make_movement(self, new_pos): + old_pos = self.user_pos[:] + self.grid[old_pos[0]][old_pos[1]] = '.' + self.user_pos = new_pos + + # If the new position is a door, generate a new room + if self.grid[new_pos[0]][new_pos[1]] == 'D': + self.previous_door_pos = new_pos + self.current_room += 1 + self.generate_new_room() + elif self.grid[new_pos[0]][new_pos[1]] in self.items: + print(f"You found a {self.grid[new_pos[0]][new_pos[1]]}!") + self.grid[new_pos[0]][new_pos[1]] = 'P' + elif self.grid[new_pos[0]][new_pos[1]] == 'M': + print("You encountered a monster!") + self.grid[new_pos[0]][new_pos[1]] = 'P' + else: + self.grid[new_pos[0]][new_pos[1]] = 'P' + + self.update_view() \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/game_blocks.py b/Archive/scratch_version/brainstorming/game_blocks.py new file mode 100644 index 00000000..5ed90a8f --- /dev/null +++ b/Archive/scratch_version/brainstorming/game_blocks.py @@ -0,0 +1,297 @@ +from game_log import GameLog +# from level import Level +from player import Player +import random +import tkinter as tk +from room import Room +import uuid + + +gl = GameLog() + + + +class Game: + def __init__(self, master): + self.master = master + self.gl = GameLog() + self.total_size = 10 + self.size = 10 + self.door_pos = None + self.entry_door = None + self.id = str(uuid.uuid4()) + self.grid = [] + self.user_pos = [] + self.robots = [] + self.paused = False + self.game_log = GameLog() + self.current_room = 0 + self.entry_door = None # Holds the entry door coordinates + self.previous_door_pos = None # Holds the previous door coordinates + # self.level = Level(self) + self.canvas = tk.Canvas(self.master, width=500, height=500) + self.canvas.pack() + + def basic_start(self, door_pos=None): + # Initialize all cells as open space '.' + self.grid = [['.' for _ in range(self.total_size)] for _ in range(self.total_size)] + + # Set the outer cells as walls '#' + for i in range(self.total_size): + for j in range(self.total_size): + if i == 0 or i == self.total_size - 1 or j == 0 or j == self.total_size - 1: + self.grid[i][j] = '#' + + # Set player's initial position in the middle + # middle = self.total_size // 2 + # self.grid[middle][middle] = 'P' # Assuming 'P' denotes the player + # self.user_pos = [middle, middle] + # self.player = Player(self, self.user_pos[0], self.user_pos[1]) + # if door_pos is None: # For the first room, add a door at the top + # self.grid[1][middle] = 'D' + # elif door_pos == 'top': # If player entered from the top door, draw the door at the bottom + # self.grid[self.total_size-2][middle] = 'D' + # # Add conditions for other doors (left, right, bottom) here + + # Set player's initial position in the middle + middle = self.total_size // 2 + self.grid[middle][middle] = 'P' # Assuming 'P' denotes the player + self.user_pos = [middle, middle] + self.player = Player(self, self.user_pos[0], self.user_pos[1]) + + # Set a door 'D' at a random position on one of the walls + self.generate_door() + + def display_game(self): + self.canvas.delete("all") + for i, row in enumerate(self.grid): + for j, cell in enumerate(row): + if cell == 'D' or cell == '.': + color = 'white' # open space or door + elif cell == 'P': + color = 'blue' # player + else: + color = 'black' # wall or player + self.canvas.create_rectangle(j * 50, i * 50, (j + 1) * 50, (i + 1) * 50, fill=color) + + def update_view(self): + self.gl.log('Updating game view') + self.display_game() + + def start(self): + # self.basic_start() + self.basic_start_with_room_at_top() + self.update_view() + + def calculate_new_position(self, key): + x, y = self.user_pos + if key == 'w': + return [x-1, y] # Move up + elif key == 'a': + return [x, y-1] # Move left + elif key == 's': + return [x+1, y] # Move down + elif key == 'd': + return [x, y+1] # Move right + else: + return [x, y] # Stay in the same position for any other key + + def is_valid_movement(self, new_pos): + x, y = new_pos + return self.grid[x][y] != '#' + + # def make_movement(self, new_pos): + # self.grid[self.user_pos[0]][self.user_pos[1]] = '.' + # self.grid[new_pos[0]][new_pos[1]] = 'P' + # self.user_pos = new_pos + # self.update_view() + + # def make_movement(self, new_pos): + # self.grid[self.user_pos[0]][self.user_pos[1]] = '.' + # self.grid[new_pos[0]][new_pos[1]] = 'P' + # self.user_pos = new_pos + + # # If the new position is a door, generate a new room + # if self.grid[new_pos[0]][new_pos[1]] == 'D': + # self.current_room += 1 + # self.generate_new_room() + + # self.update_view() + + # def make_movement(self, new_pos): + # old_pos = self.user_pos[:] + # self.grid[old_pos[0]][old_pos[1]] = '.' + # self.user_pos = new_pos + # if self.grid[new_pos[0]][new_pos[1]] == 'D': # Player moved through a door + # self.previous_door_pos = new_pos + # self.current_room += 1 + # self.generate_new_room() + # else: + # self.grid[new_pos[0]][new_pos[1]] = 'P' + # self.update_view() + + def make_movement(self, new_pos): + old_pos = self.user_pos[:] + self.grid[old_pos[0]][old_pos[1]] = '.' + self.user_pos = new_pos + + if self.grid[new_pos[0]][new_pos[1]] == 'D': # Player moved through a door + self.previous_door_pos = new_pos + self.current_room += 1 + self.generate_new_room() + else: + self.grid[new_pos[0]][new_pos[1]] = 'P' + + self.update_view() + + def basic_start_with_room_at_top(self): + # Initialize all cells as open space '.' + self.grid = [['.' for _ in range(self.total_size)] for _ in range(self.total_size)] + + # Set the outer cells as walls '#' + for i in range(self.total_size): + for j in range(self.total_size): + if i == 0 or i == self.total_size - 1 or j == 0 or j == self.total_size - 1: + self.grid[i][j] = '#' + + # Set a door 'D' at the top of the room + self.grid[0][self.total_size // 2] = 'D' + + # Set player's initial position in the middle + middle = self.total_size // 2 + self.grid[middle][middle] = 'P' # Assuming 'P' denotes the player + self.user_pos = [middle, middle] + self.player = Player(self, self.user_pos[0], self.user_pos[1]) + + def generate_new_room(self): + # Generate a new room similar to basic_start + # But with the door in a random position on one of the walls + + # Initialize all cells as open space '.' + self.grid = [['.' for _ in range(self.total_size)] for _ in range(self.total_size)] + + # Set the outer cells as walls '#' + for i in range(self.total_size): + for j in range(self.total_size): + if i == 0 or i == self.total_size - 1 or j == 0 or j == self.total_size - 1: + self.grid[i][j] = '#' + + # if self.previous_door_pos is not None: + # if self.previous_door_pos[0] == 0: # top wall in previous room + # self.user_pos = [self.total_size - 1, self.previous_door_pos[1]] # bottom wall in new room + # elif self.previous_door_pos[0] == self.total_size - 1: # bottom wall in previous room + # self.user_pos = [0, self.previous_door_pos[1]] # top wall in new room + # elif self.previous_door_pos[1] == 0: # left wall in previous room + # self.user_pos = [self.previous_door_pos[0], self.total_size - 1] # right wall in new room + # elif self.previous_door_pos[1] == self.total_size - 1: # right wall in previous room + # self.user_pos = [self.previous_door_pos[0], 0] # left wall in new room + # else: + # # Set player's initial position in the middle + # middle = self.total_size // 2 + # self.user_pos = [middle, middle] + + # self.grid[self.user_pos[0]][self.user_pos[1]] = 'P' # Assuming 'P' denotes the player + # self.player = Player(self, self.user_pos[0], self.user_pos[1]) + # self.generate_door() + + # # Set a door 'D' at a random position on one of the walls + # wall_side = random.choice(['top', 'bottom', 'left', 'right']) + # if wall_side == 'top': + # self.grid[0][random.randint(1, self.total_size-2)] = 'D' + # elif wall_side == 'bottom': + # self.grid[-1][random.randint(1, self.total_size-2)] = 'D' + # elif wall_side == 'left': + # self.grid[random.randint(1, self.total_size-2)][0] = 'D' + # elif wall_side == 'right': + # self.grid[random.randint(1, self.total_size-2)][-1] = 'D' + + # # Set player's initial position in the middle + # middle = self.total_size // 2 + # self.grid[middle][middle] = 'P' # Assuming 'P' denotes the player + # self.user_pos = [middle, middle] + # self.player = Player(self, self.user_pos[0], self.user_pos[1]) + # self.generate_door() + + # After setting up the new room, instead of placing the player at the middle, + # place them at the door they just entered from + if self.previous_door_pos is not None: + if self.previous_door_pos[0] == 0: # top wall in previous room + self.user_pos = [self.total_size - 1, self.previous_door_pos[1]] # bottom wall in new room + elif self.previous_door_pos[0] == self.total_size - 1: # bottom wall in previous room + self.user_pos = [0, self.previous_door_pos[1]] # top wall in new room + elif self.previous_door_pos[1] == 0: # left wall in previous room + self.user_pos = [self.previous_door_pos[0], self.total_size - 1] # right wall in new room + elif self.previous_door_pos[1] == self.total_size - 1: # right wall in previous room + self.user_pos = [self.previous_door_pos[0], 0] # left wall in new room + else: + # If there's no previous door, place the player at the middle + middle = self.total_size // 2 + self.user_pos = [middle, middle] + + self.grid[self.user_pos[0]][self.user_pos[1]] = 'P' # Assuming 'P' denotes the player + self.player = Player(self, self.user_pos[0], self.user_pos[1]) + self.generate_door() + + # def generate_door(self): + # if self.previous_door_pos is not None: + # # Use the mirrored position of the player to determine which wall to exclude + # if self.previous_door_pos[0] == 0: # top wall in previous room + # eligible_walls = bottom_wall + left_wall + right_wall + # elif self.previous_door_pos[0] == self.total_size - 1: #, self.previous_door_pos[1]] # bottom wall in new room + # eligible_walls = top_wall + left_wall + right_wall + # elif self.previous_door_pos[0] == self.total_size - 1: # bottom wall in previous room + # door_pos = [0, self.previous_door_pos[1]] # top wall in new room + # elif self.previous_door_pos[1] == 0: # left wall in previous room + # door_pos = [self.previous_door_pos[0], self.total_size - 1] # right wall in new room + # elif self.previous_door_pos[1] == self.total_size - 1: # right wall in previous room + # door_pos = [self.previous_door_pos[0], 0] # left wall in new room + + # # Draw the door + # self.grid[door_pos[0]][door_pos[1]] = 'D' + + # # Reset previous_door_pos + # self.previous_door_pos = None + # else: + # # Place the door at a random location as before + # top_wall = [[0, i] for i in range(1, self.total_size - 1)] + # bottom_wall = [[self.total_size - 1, i] for i in range(1, self.total_size - 1)] + # left_wall = [[i, 0] for i in range(1, self.total_size - 1)] + # right_wall = [[i, self.total_size - 1] for i in range(1, self.total_size - 1)] + + # # Combine all walls into a single list + # all_walls = top_wall + bottom_wall + left_wall + right_wall + + # # Select a random position for the door + # door_pos = random.choice(all_walls) + + # # Draw the door + # self.grid[door_pos[0]][door_pos[1]] = 'D' + + + + def generate_door(self): + # Calculate the positions of all walls + top_wall = [[0, i] for i in range(1, self.total_size - 1)] + bottom_wall = [[self.total_size - 1, i] for i in range(1, self.total_size - 1)] + left_wall = [[i, 0] for i in range(1, self.total_size - 1)] + right_wall = [[i, self.total_size - 1] for i in range(1, self.total_size - 1)] + + if self.previous_door_pos is not None: + # Use the mirrored position of the player to determine which wall to exclude + if self.previous_door_pos[0] == 0: # top wall in previous room + eligible_walls = bottom_wall + left_wall + right_wall + elif self.previous_door_pos[0] == self.total_size - 1: # bottom wall in previous room + eligible_walls = top_wall + left_wall + right_wall + elif self.previous_door_pos[1] == 0: # left wall in previous room + eligible_walls = top_wall + bottom_wall + right_wall + elif self.previous_door_pos[1] == self.total_size - 1: # right wall in previous room + eligible_walls = top_wall + bottom_wall + left_wall + else: + # If there's no previous door, all walls are eligible for the door placement + eligible_walls = top_wall + bottom_wall + left_wall + right_wall + + # Select a random position for the door from the eligible walls + door_pos = random.choice(eligible_walls) + + # Draw the door + self.grid[door_pos[0]][door_pos[1]] = 'D' diff --git a/Archive/scratch_version/brainstorming/game_log.py b/Archive/scratch_version/brainstorming/game_log.py new file mode 100644 index 00000000..f40291c5 --- /dev/null +++ b/Archive/scratch_version/brainstorming/game_log.py @@ -0,0 +1,23 @@ +import logging + +class GameLog: + def __init__(self): + # create logger + self.logger = logging.getLogger('GameLog') + self.logger.setLevel(logging.DEBUG) # set logger level + + # create console handler and set level to debug + ch = logging.StreamHandler() + ch.setLevel(logging.DEBUG) + + # create formatter + formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') + + # add formatter to ch + ch.setFormatter(formatter) + + # add ch to logger + self.logger.addHandler(ch) + + def log(self, message: str): + self.logger.info(message) diff --git a/Archive/scratch_version/brainstorming/level.py b/Archive/scratch_version/brainstorming/level.py new file mode 100644 index 00000000..7b1695f1 --- /dev/null +++ b/Archive/scratch_version/brainstorming/level.py @@ -0,0 +1,39 @@ +import random +from robot import Robot + +class Level: + def __init__(self, game, min_robots=1, max_robots=5): + self.game = game + self.min_robots = min_robots + self.max_robots = max_robots + self.door = 'D' + self.generate_level() + + def generate_level(self): + self.game.grid = [[' ' for _ in range(self.game.total_size)] for _ in range(self.game.total_size)] + for i in range(self.game.total_size): + self.game.grid[i][0] = self.game.grid[i][self.game.total_size-1] = '#' + self.game.grid[0][i] = self.game.grid[self.game.total_size-1][i] = '#' + + self.add_robots() + self.add_door() + + def add_robots(self): + num_robots = random.randint(self.min_robots, self.max_robots) + for _ in range(num_robots): + robot_x_pos, robot_y_pos = self.game.user_pos + while [robot_x_pos, robot_y_pos] == self.game.user_pos: + robot_x_pos = random.randint(1, self.game.total_size-2) + robot_y_pos = random.randint(1, self.game.total_size-2) + + self.game.grid[robot_x_pos][robot_y_pos] = 'R' + robot = Robot('Robbie', 'A friendly robot', robot_x_pos, robot_y_pos, self.game) + self.game.robots.append(robot) + + def add_door(self): + door_x_pos, door_y_pos = self.game.user_pos + while [door_x_pos, door_y_pos] == self.game.user_pos: + door_x_pos = random.randint(1, self.game.total_size-2) + door_y_pos = random.randint(1, self.game.total_size-2) + + self.game.grid[door_x_pos][door_y_pos] = self.door diff --git a/Archive/scratch_version/brainstorming/loading_main.py b/Archive/scratch_version/brainstorming/loading_main.py new file mode 100644 index 00000000..0d7a6dab --- /dev/null +++ b/Archive/scratch_version/brainstorming/loading_main.py @@ -0,0 +1,81 @@ +import openai +import os +from dotenv import load_dotenv +import tkinter as tk +import time + +# Load environment variables +load_dotenv() + +# Set OpenAI API key +openai.api_key = os.getenv('OPENAI_API_KEY') + +# Create a loading window +loading = tk.Tk() +loading.title("Loading...") +loading.geometry("300x100") +loading.configure(bg="black") + +loading_label = tk.Label(loading, text="Loading Nova System...", fg="cyan", bg="black", font=("Courier", 12)) +loading_label.pack(pady=20) + +loading.update() + +time.sleep(2) # Let the loading screen stay for 2 seconds + +loading.destroy() # Destroy the loading screen + +# Create a Tkinter window +root = tk.Tk() +root.title("Nova System") +root.geometry("600x400") +root.configure(bg="black") + +# Create a Tkinter label for displaying the AI response +response_label = tk.Label(root, fg="cyan", bg="black", font=("Courier", 12), wraplength=580) +response_label.pack(pady=20, padx=10) + +def stream_to_console(message): + for char in message: + print(char, end='', flush=True) + time.sleep(0.035) + print() # newline at the end + +def stream_to_label(message, index=0): + # Add one character to the label text and schedule the next character + if index < len(message): + response_label["text"] += message[index] + root.after(35, stream_to_label, message, index + 1) + +def stream_ai_response(user_input): + # Call to the OpenAI API + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": user_input} + ] + ) + + # Prepare response message + response_message = f"AI's response: {response['choices'][0]['message']['content']}" + + # Stream to console + stream_to_console(response_message) + + # Clear the previous response and stream the new response to the label + response_label["text"] = "" + stream_to_label(response_message) + +def run_stream(): + user_input = user_input_entry.get() + stream_ai_response(user_input) + +# Create a Tkinter entry field and a submit button +user_input_entry = tk.Entry(root, font=("Courier", 12)) +user_input_entry.pack(pady=20) + +submit_button = tk.Button(root, text="Submit", command=run_stream, fg="white", bg="cyan", font=("Courier", 12)) +submit_button.pack() + +root.mainloop() diff --git a/Archive/scratch_version/brainstorming/player.py b/Archive/scratch_version/brainstorming/player.py new file mode 100644 index 00000000..0f2ce13f --- /dev/null +++ b/Archive/scratch_version/brainstorming/player.py @@ -0,0 +1,22 @@ +class Player: + def __init__(self, game, x_pos, y_pos): + self.symbol = '@' + self.game = game + self.x_pos = x_pos + self.y_pos = y_pos + + def move(self, direction): + if self.game.paused: + return + + directions = {'w': [-1, 0], 's': [1, 0], 'a': [0, -1], 'd': [0, 1]} # Define movements + new_pos = [self.x_pos + directions[direction][0], self.y_pos + directions[direction][1]] # Get new position + + if self.game.grid[new_pos[0]][new_pos[1]] == 'R': + self.game.robot.open_chat_window() + return + + self.game.grid[self.x_pos][self.y_pos] = ' ' + self.game.grid[new_pos[0]][new_pos[1]] = self.symbol + self.x_pos, self.y_pos = new_pos # Update player position + self.game.update_view() \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/requirements.txt b/Archive/scratch_version/brainstorming/requirements.txt new file mode 100644 index 00000000..6aad0312 --- /dev/null +++ b/Archive/scratch_version/brainstorming/requirements.txt @@ -0,0 +1,2 @@ +openai +python-dotenv \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/robot.py b/Archive/scratch_version/brainstorming/robot.py new file mode 100644 index 00000000..dda8f39b --- /dev/null +++ b/Archive/scratch_version/brainstorming/robot.py @@ -0,0 +1,157 @@ +import tkinter as tk +import threading +import openai +from concurrent.futures import ThreadPoolExecutor + +class Robot: + def __init__(self, name, description, x_pos, y_pos, game): + self.name = name + self.description = description + self.x_pos = x_pos + self.y_pos = y_pos + self.ascii_art = "R" + self.game = game + self.loading = None + self.loading_message = "Loading" + self.messages = [{"role": "system", "content": f"You are a helpful robot named {self.name}."}] + self.executor = ThreadPoolExecutor(max_workers=1) + self.is_streaming = False + self.symbol = "R" + + def add_message(self, role, content): + message = {"role": role, "content": content} + self.messages.append(message) + self.chat_history.config(state='normal') + self.chat_history.insert(tk.END, f"{role}: {content}\n") + self.chat_history.config(state='disabled') + self.chat_history.see(tk.END) + + def send_user_message(self, event=None): + user_input = self.user_input_entry.get() + self.user_input_entry.delete(0, tk.END) + + if self.is_streaming: + self.is_streaming = False + return + + self.add_message("user", user_input) + self.get_ai_response(user_input) + + def stream_message_to_chat(self, role, content, index=0): + if index < len(content) and self.is_streaming: + message = {"role": role, "content": content[:index + 1]} + self.messages.append(message) + self.chat_history.insert(tk.END, f"{role}: {content[:index + 1]}") + self.chat_history.see(tk.END) + self.chat_window.after(5, self.stream_message_to_chat, role, content, index + 1) + else: + self.add_instant_message(role, content) # add the complete message + self.is_streaming = False + + def open_chat_window(self): + self.game.pause() + self.start_chat() + + def start_chat(self): + self.chat_window = tk.Toplevel() + self.chat_window.minsize(300, 200) + self.chat_window.maxsize(500, 400) + self.chat_window.title(f"Chat with {self.name}") + + self.create_chat_interface() + self.add_instant_message('assistant', f"{self.name}: Hello! What can I help you with today?\n") + + def create_chat_interface(self): + self.create_chat_frame() + self.create_chat_history() + self.create_loading_label() + self.create_user_input_entry() + self.create_submit_button() + + self.chat_window.protocol("WM_DELETE_WINDOW", self.on_chat_close) + + def get_ai_response(self, user_input): + self.start_loading_animation() + future = self.executor.submit(self.make_openai_request, user_input) + self.chat_window.after(100, self.check_openai_request, future) + + def make_openai_request(self, user_input): + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=self.messages + ) + return response['choices'][0]['message']['content'] + + def check_openai_request(self, future): + if future.done(): + ai_response = future.result() + self.stop_loading_animation() + self.is_streaming = True + self.stream_message_to_chat('assistant', ai_response) + else: + self.chat_window.after(100, self.check_openai_request, future) + + def start_loading_animation(self): + self.loading_message = "Loading" + self.loading = self.chat_window.after(500, self.update_loading_message, 0) + + def update_loading_message(self, dots=0): + if dots < 3: + dots += 1 + else: + dots = 0 + + self.loading_message = "Loading" + "." * dots + self.loading_label.config(text=self.loading_message) + self.loading = self.chat_window.after(500, self.update_loading_message, dots) + + def stop_loading_animation(self): + if self.loading: + self.chat_window.after_cancel(self.loading) + self.loading = None + self.loading_label.config(text="") + + def get_ai_response(self, user_input): + self.start_loading_animation() + future = self.executor.submit(self.make_openai_request, user_input) + self.chat_window.after(100, self.check_openai_request, future) + + def create_chat_frame(self): + self.chat_frame = tk.Frame(self.chat_window) + self.chat_frame.pack(fill='both', expand=True) + + def create_chat_history(self): + scrollbar = tk.Scrollbar(self.chat_frame) + scrollbar.pack(side='right', fill='y') + + self.chat_history = tk.Text(self.chat_frame, state='disabled', width=50, height=15, wrap='word', yscrollcommand=scrollbar.set) + self.chat_history.pack(fill='both', expand=True) + + def create_loading_label(self): + self.loading_label = tk.Label(self.chat_window, text="") + self.loading_label.pack() + + def create_user_input_entry(self): + self.user_input_entry = tk.Entry(self.chat_window) + self.user_input_entry.bind("", self.send_user_message) + self.user_input_entry.pack() + + def create_submit_button(self): + submit_button = tk.Button(self.chat_window, text="Submit", command=self.send_user_message) + submit_button.pack() + + def on_chat_close(self): + self.chat_window.destroy() + self.game.unpause() + + def start_loading_animation(self): + self.loading_message = "Loading" + self.loading = self.chat_window.after(500, self.update_loading_message, 0) + + def open_chat_window(self): + self.game.pause() + self.start_chat() + + def on_chat_close(self): + self.chat_window.destroy() + self.game.unpause() diff --git a/Archive/scratch_version/brainstorming/room.py b/Archive/scratch_version/brainstorming/room.py new file mode 100644 index 00000000..6ccf082b --- /dev/null +++ b/Archive/scratch_version/brainstorming/room.py @@ -0,0 +1,21 @@ +import uuid + +class Room: + def __init__(self, size, door_pos=None, id=None): + self.size = size + self.door_pos = door_pos + self.id = str(uuid.uuid4()) if id is None else id + self.grid = [['.' for _ in range(self.size)] for _ in range(self.size)] + + # Set the outer cells as walls '#' + for i in range(self.size): + for j in range(self.size): + if i == 0 or i == self.size - 1 or j == 0 or j == self.size - 1: + self.grid[i][j] = '#' + + if self.door_pos is not None: + self.grid[self.door_pos[0]][self.door_pos[1]] = 'D' + + def print_room(self): + for row in self.grid: + print(' '.join(row)) diff --git a/Archive/scratch_version/brainstorming/room_block.py b/Archive/scratch_version/brainstorming/room_block.py new file mode 100644 index 00000000..b358601f --- /dev/null +++ b/Archive/scratch_version/brainstorming/room_block.py @@ -0,0 +1,17 @@ +import uuid + +class Room: + def __init__(self, size, door_pos=None, id=None): + self.size = size + self.door_pos = door_pos + self.id = str(uuid.uuid4()) if id is None else id + self.grid = [['.' for _ in range(self.size)] for _ in range(self.size)] + + # Set the outer cells as walls '#' + for i in range(self.size): + for j in range(self.size): + if i == 0 or i == self.size - 1 or j == 0 or j == self.size - 1: + self.grid[i][j] = '#' + + if self.door_pos is not None: + self.grid[self.door_pos[0]][self.door_pos[1]] = 'D' diff --git a/Archive/scratch_version/brainstorming/stream_ai_response.py b/Archive/scratch_version/brainstorming/stream_ai_response.py new file mode 100644 index 00000000..991b987a --- /dev/null +++ b/Archive/scratch_version/brainstorming/stream_ai_response.py @@ -0,0 +1,61 @@ +import openai +import os +from dotenv import load_dotenv +import tkinter as tk +import time + +# Load environment variables +load_dotenv() + +# Set OpenAI API key +openai.api_key = os.getenv('OPENAI_API_KEY') + +# Create a Tkinter window +root = tk.Tk() +response_label = tk.Label(root) +response_label.pack() + +def stream_to_console(message): + for char in message: + print(char, end='', flush=True) + time.sleep(0.035) + print() # newline at the end + +def stream_to_label(message, index=0): + # Add one character to the label text and schedule the next character + if index < len(message): + response_label["text"] += message[index] + root.after(35, stream_to_label, message, index + 1) + +def stream_ai_response(user_input): + # Call to the OpenAI API + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": user_input} + ] + ) + + # Prepare response message + response_message = f"AI's response: {response['choices'][0]['message']['content']}" + + # Stream to console + stream_to_console(response_message) + + # Clear the previous response and stream the new response to the label + response_label["text"] = "" + stream_to_label(response_message) + +def run_stream(): + user_input = user_input_entry.get() + stream_ai_response(user_input) + +# Create a Tkinter entry field and a submit button +user_input_entry = tk.Entry(root) +user_input_entry.pack() + +submit_button = tk.Button(root, text="Submit", command=run_stream) +submit_button.pack() + +root.mainloop() diff --git a/Archive/scratch_version/brainstorming/test.py b/Archive/scratch_version/brainstorming/test.py new file mode 100644 index 00000000..43b26a37 --- /dev/null +++ b/Archive/scratch_version/brainstorming/test.py @@ -0,0 +1,30 @@ +import logging +import functools + +# Configure logger +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', + datefmt='%m-%d %H:%M') + +# Create logger +logger = logging.getLogger(__name__) + +# Create decorator +def log_exceptions(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + return func(*args, **kwargs) + except Exception as e: + logger.error("An error occurred in function %s: %s", func.__name__, str(e)) + raise + return wrapper + + +class Test: + + @log_exceptions + def throw_exception(self, exception): + if not issubclass(exception, BaseException): + raise TypeError(f"{exception} is not a valid exception type.") + raise exception("This is a test exception.") diff --git a/Archive/scratch_version/brainstorming/welcome_ascii_art.py b/Archive/scratch_version/brainstorming/welcome_ascii_art.py new file mode 100644 index 00000000..4a4c8e2e --- /dev/null +++ b/Archive/scratch_version/brainstorming/welcome_ascii_art.py @@ -0,0 +1,65 @@ +from welcome_message import welcome_message + +def welcome_ascii_art_1(): + return """ + _ _ _ _ _ _ +| | | | | | | | | | | | +| | | | ___| | ___ ___ _ __ ___ ___ | |_ ___ | |_| |__ ___ +| |/\| |/ _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \ | __| '_ \ / _ \ +\ /\ / __/ | (_| (_) | | | | | | __/ | || (_) | | |_| | | | __/ + \/ \/ \___|_|\___\___/|_| |_| |_|\___| \__\___/ \__|_| |_|\___| + + + _ _ _ __ ______ _ +| | | (_) / _| | ___ \ | | +| | | |_ _ __ | |_ ___ | |_/ / ___ | |_ +| |/\| | | '_ \| _/ _ \ | ___ \/ _ \| __| +\ /\ / | | | | || (_) | | |_/ / (_) | |_ + \/ \/|_|_| |_|_| \___/ \____/ \___/ \__| + + +______ +| _ \ +| | | |_ _ _ __ __ _ ___ ___ _ __ +| | | | | | | '_ \ / _` |/ _ \/ _ \| '_ \ +| |/ /| |_| | | | | (_| | __/ (_) | | | | +|___/ \__,_|_| |_|\__, |\___|\___/|_| |_| + __/ | + |___/ + ___ _ _ + / _ \ | | | | +/ /_\ \ __| |_ _____ _ __ | |_ _ _ ___ +| _ |/ _` \ \ / / _ \ '_ \| __| | | |/ _ \ +| | | | (_| |\ V / __/ | | | |_| |_| | __/ +\_| |_/\__,_| \_/ \___|_| |_|\__|\__,_|\___| +""" + +def welcome_ascii_art_2(): + return f""" + __ __ _ _ _ _ +/ / /\ \ \___| | ___ ___ _ __ ___ ___ | |_ ___ | |_| |__ ___ +\ \/ \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \ | __| '_ \ / _ \\ + \ /\ / __/ | (_| (_) | | | | | | __/ | || (_) | | |_| | | | __/ + \/ \/ \___|_|\___\___/|_| |_| |_|\___| \__\___/ \__|_| |_|\___| + + __ __ _ __ ___ _ +/ / /\ \ (_)_ __ / _| ___ / __\ ___ | |_ +\ \/ \/ / | '_ \| |_ / _ \ /__\/// _ \| __| + \ /\ /| | | | | _| (_) | / \/ \ (_) | |_ + \/ \/ |_|_| |_|_| \___/ \_____/\___/ \__| + + ___ + / \_ _ _ __ __ _ ___ ___ _ __ + / /\ / | | | '_ \ / _` |/ _ \/ _ \| '_ \\ + / /_//| |_| | | | | (_| | __/ (_) | | | | +/___,' \__,_|_| |_|\__, |\___|\___/|_| |_| + |___/ + _ _ _ + /_\ __| |_ _____ _ __ | |_ _ _ ___ + //_\\\ / _` \\ \ / / _ \ '_ \| __| | | |/ _ \\ +/ _ \ (_| |\ V / __/ | | | |_| |_| | __/ +\_/ \_/\__,_| \_/ \___|_| |_|\__|\__,_|\___| + +{welcome_message()} + +""" \ No newline at end of file diff --git a/Archive/scratch_version/brainstorming/welcome_message.py b/Archive/scratch_version/brainstorming/welcome_message.py new file mode 100644 index 00000000..29d87649 --- /dev/null +++ b/Archive/scratch_version/brainstorming/welcome_message.py @@ -0,0 +1,11 @@ +def welcome_message(): + return """ + __ +|__)| _ _ _ _ _ _ | _ _ _ |_|_ _ _| _ _ _ _ _ _ _ _| +| |(-(_|_)(- (-)(|_)|(_)| (- |_| )(- (_||_|| )(_)(-(_)| ) (_|| )(_| + | _/ + + _ _ . _ |_|_ _ _ _ _ _. _ _ _ _ +(-| )|(_)\/ |_| )(- (-)(|_)(-| |(-| )(_(-. + / / | + """ \ No newline at end of file diff --git a/Archive/scratch_version/dev/bin/Activate.ps1 b/Archive/scratch_version/dev/bin/Activate.ps1 new file mode 100644 index 00000000..eeea3583 --- /dev/null +++ b/Archive/scratch_version/dev/bin/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove VIRTUAL_ENV_PROMPT altogether. + if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { + Remove-Item -Path env:VIRTUAL_ENV_PROMPT + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } + $env:VIRTUAL_ENV_PROMPT = $Prompt +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/Archive/scratch_version/dev/bin/activate b/Archive/scratch_version/dev/bin/activate new file mode 100644 index 00000000..be7a1963 --- /dev/null +++ b/Archive/scratch_version/dev/bin/activate @@ -0,0 +1,69 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r 2> /dev/null + fi + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV="/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev" +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + PS1="(dev) ${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT="(dev) " + export VIRTUAL_ENV_PROMPT +fi + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r 2> /dev/null +fi diff --git a/Archive/scratch_version/dev/bin/activate.csh b/Archive/scratch_version/dev/bin/activate.csh new file mode 100644 index 00000000..bddc22af --- /dev/null +++ b/Archive/scratch_version/dev/bin/activate.csh @@ -0,0 +1,26 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV "/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = "(dev) $prompt" + setenv VIRTUAL_ENV_PROMPT "(dev) " +endif + +alias pydoc python -m pydoc + +rehash diff --git a/Archive/scratch_version/dev/bin/activate.fish b/Archive/scratch_version/dev/bin/activate.fish new file mode 100644 index 00000000..6a133e79 --- /dev/null +++ b/Archive/scratch_version/dev/bin/activate.fish @@ -0,0 +1,69 @@ +# This file must be used with "source /bin/activate.fish" *from fish* +# (https://fishshell.com/); you cannot run it directly. + +function deactivate -d "Exit virtual environment and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + set -e _OLD_FISH_PROMPT_OVERRIDE + # prevents error when using nested fish instances (Issue #93858) + if functions -q _old_fish_prompt + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + end + + set -e VIRTUAL_ENV + set -e VIRTUAL_ENV_PROMPT + if test "$argv[1]" != "nondestructive" + # Self-destruct! + functions -e deactivate + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV "/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev" + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# Unset PYTHONHOME if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # Save the current fish_prompt function as the function _old_fish_prompt. + functions -c fish_prompt _old_fish_prompt + + # With the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command. + set -l old_status $status + + # Output the venv prompt; color taken from the blue of the Python logo. + printf "%s%s%s" (set_color 4B8BBE) "(dev) " (set_color normal) + + # Restore the return status of the previous command. + echo "exit $old_status" | . + # Output the original/"old" prompt. + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" + set -gx VIRTUAL_ENV_PROMPT "(dev) " +end diff --git a/Archive/scratch_version/dev/bin/dotenv b/Archive/scratch_version/dev/bin/dotenv new file mode 100755 index 00000000..ce6769ca --- /dev/null +++ b/Archive/scratch_version/dev/bin/dotenv @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from dotenv.__main__ import cli +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli()) diff --git a/Archive/scratch_version/dev/bin/normalizer b/Archive/scratch_version/dev/bin/normalizer new file mode 100755 index 00000000..3761e80f --- /dev/null +++ b/Archive/scratch_version/dev/bin/normalizer @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli.normalizer import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/Archive/scratch_version/dev/bin/openai b/Archive/scratch_version/dev/bin/openai new file mode 100755 index 00000000..f81ac32c --- /dev/null +++ b/Archive/scratch_version/dev/bin/openai @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from openai._openai_scripts import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/Archive/scratch_version/dev/bin/pip b/Archive/scratch_version/dev/bin/pip new file mode 100755 index 00000000..91c540cb --- /dev/null +++ b/Archive/scratch_version/dev/bin/pip @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/Archive/scratch_version/dev/bin/pip3 b/Archive/scratch_version/dev/bin/pip3 new file mode 100755 index 00000000..91c540cb --- /dev/null +++ b/Archive/scratch_version/dev/bin/pip3 @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/Archive/scratch_version/dev/bin/pip3.11 b/Archive/scratch_version/dev/bin/pip3.11 new file mode 100755 index 00000000..91c540cb --- /dev/null +++ b/Archive/scratch_version/dev/bin/pip3.11 @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/Archive/scratch_version/dev/bin/python b/Archive/scratch_version/dev/bin/python new file mode 120000 index 00000000..6e7f3c7d --- /dev/null +++ b/Archive/scratch_version/dev/bin/python @@ -0,0 +1 @@ +python3.11 \ No newline at end of file diff --git a/Archive/scratch_version/dev/bin/python3 b/Archive/scratch_version/dev/bin/python3 new file mode 120000 index 00000000..6e7f3c7d --- /dev/null +++ b/Archive/scratch_version/dev/bin/python3 @@ -0,0 +1 @@ +python3.11 \ No newline at end of file diff --git a/Archive/scratch_version/dev/bin/python3.11 b/Archive/scratch_version/dev/bin/python3.11 new file mode 120000 index 00000000..2d175777 --- /dev/null +++ b/Archive/scratch_version/dev/bin/python3.11 @@ -0,0 +1 @@ +/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 \ No newline at end of file diff --git a/Archive/scratch_version/dev/bin/tqdm b/Archive/scratch_version/dev/bin/tqdm new file mode 100755 index 00000000..5bc0ed12 --- /dev/null +++ b/Archive/scratch_version/dev/bin/tqdm @@ -0,0 +1,8 @@ +#!/Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from tqdm.cli import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/Archive/scratch_version/dev/pyvenv.cfg b/Archive/scratch_version/dev/pyvenv.cfg new file mode 100644 index 00000000..7e8449d3 --- /dev/null +++ b/Archive/scratch_version/dev/pyvenv.cfg @@ -0,0 +1,5 @@ +home = /Library/Frameworks/Python.framework/Versions/3.11/bin +include-system-site-packages = false +version = 3.11.3 +executable = /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 +command = /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m venv /Users/ctavolazzi/Code/AIECO/Winfo/Nova_System/dev diff --git a/Archive/scratch_version/main.py b/Archive/scratch_version/main.py new file mode 100644 index 00000000..6dac565a --- /dev/null +++ b/Archive/scratch_version/main.py @@ -0,0 +1,7 @@ +from uuid import uuid4 +from apps.nova_prototype.versions.Tomato.nova_tomato import App + +result = App() + +print(result) +print(result.id) \ No newline at end of file diff --git a/Archive/testfile.py b/Archive/testfile.py new file mode 100644 index 00000000..73458e13 --- /dev/null +++ b/Archive/testfile.py @@ -0,0 +1 @@ +print("Test Successful") \ No newline at end of file diff --git a/Archive/update_python_packages.sh b/Archive/update_python_packages.sh new file mode 100755 index 00000000..0c180eae --- /dev/null +++ b/Archive/update_python_packages.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +echo "Fetching list of outdated packages..." + +# Fetch outdated packages and store them in a variable +outdated_packages=$(pip list --outdated --format=columns | awk 'NR>2 {print $1}') + +# Check for errors in fetching outdated packages +if [[ $? -ne 0 ]]; then + echo "An error occurred while fetching the outdated packages." + exit 1 +fi + +# Backup current environment +pip freeze > backup_requirements.txt + +# Check if there are any outdated packages +if [[ -z "$outdated_packages" ]]; then + echo "All packages are up-to-date." +else + echo "Updating packages..." + for package in $outdated_packages; do + pip install --upgrade "$package" + # Check for dependency conflicts + conflict=$(pip check 2>&1) + if [[ ! -z "$conflict" ]]; then + echo "Dependency conflict detected for package $package. Rolling back..." + pip install -r backup_requirements.txt + break + fi + done +fi + +echo "Running safety check..." +safety check + +# Check for errors in safety check +if [[ $? -ne 0 ]]; then + echo "An error occurred while performing the safety check." + exit 1 +fi + +echo "Package update and safety checks are complete." diff --git a/Dev/NovaHelper.py b/Dev/NovaHelper.py new file mode 100644 index 00000000..e498e139 --- /dev/null +++ b/Dev/NovaHelper.py @@ -0,0 +1,79 @@ +import time +import threading +import openai +import json + +class NovaHelper: + _default_delay = 0.022 + + def __init__(self): + self.classification = 'NovaHelper' + self.stop_flag = threading.Event() + self.user = {} + + def stream_to_console(self, message, delay=_default_delay): + for char in message: + print(char, end='', flush=True) + time.sleep(delay) + print() + + def stc(self, message, delay=_default_delay): + self.stream_to_console(message, delay) + + def loading_animation(self, duration=3): + self.start_loading_indicator() + time.sleep(duration) + self.stop_loading_indicator() + + def ask_and_set_user_property(self, question, property_name): + self.stc(question) + user_input = input("> ") + self.user[property_name] = user_input + + def fetch_openai_response(self, prompt): + # Call OpenAI API here to get dynamic responses + return "OpenAI API Response for: " + prompt + + def conduct_conversation(self): + self.stc("Welcome to the NovaVerse!") + self.loading_animation() + + # Predefined first question + self.ask_and_set_user_property("What is your name?", "name") + + # Fake loading to set user expectation + self.loading_animation() + + # Dynamic question based on user's name + next_prompt = f"Nice to meet you, {self.user['name']}. What brings you here?" + ai_response = self.fetch_openai_response(next_prompt) + + self.stc(ai_response) + + # ... continue the conversation and build the user object + # Save user object + with open('user.json', 'w') as f: + json.dump(self.user, f) + + def start_loading_indicator(self): + self.stop_flag.clear() + self.thread = threading.Thread(target=self.loading_indicator) + self.thread.start() + + def stop_loading_indicator(self): + self.stop_flag.set() + self.thread.join() + + def loading_indicator(self): + while not self.stop_flag.is_set(): + print("\033[?25h", end='', flush=True) + if self.stop_flag.wait(timeout=0.33): + break + print("\033[?25l", end='', flush=True) + if self.stop_flag.wait(timeout=0.33): + break + print("\033[?25h", end='', flush=True) + +if __name__ == "__main__": + helper = NovaHelper() + helper.conduct_conversation() diff --git a/Dev/NovaSystem.py b/Dev/NovaSystem.py new file mode 100644 index 00000000..9fb0a643 --- /dev/null +++ b/Dev/NovaSystem.py @@ -0,0 +1,213 @@ +# Imports +import os +from NovaHelper import NovaHelper, stc +<<<<<<< HEAD +import openai +import os +from dotenv import load_dotenv + +# Load environment variables from the .env file +load_dotenv() + +# Retrieve and debug the OpenAI API key from environment variables +openai.api_key = os.getenv("OPENAI_API_KEY") +======= + +>>>>>>> b6f8c82 (🪄 📌 🔎x) + +''' +The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. + +The Nova System relies on a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, an AI model acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. +''' + +''' +The Nova System process progresses iteratively through these key stages: + +1. Problem Unpacking: Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. +2. Expertise Assembly: Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. +3. Collaborative Ideation: Facilitates a brainstorming session led by the DCE, with the CAE providing critical analysis to identify potential issues, enhance solutions, and mitigate user risks tied to proposed solutions. +''' + +''' +The core roles in Nova Process are: + +DCE: The DCE weaves the discussion together, summarizing each stage concisely to enable shared understanding of progress and future steps. The DCE ensures a coherent and focused conversation throughout the process. + +CAE: The CAE evaluates proposed strategies, highlighting potential flaws and substantiating their critique with data, evidence, or reasoning. +''' +<<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +''' +This draft is a proof of concept for the NovaSystem. It is a simple implementation of the NovaSystem that uses a single Expert,the AI Tribunal, represented as three separate calls to OpenAI in a recursive iteravtive manner. This recursive iteration is the first step in the NovaSystem's ability to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions. +''' + + +<<<<<<< HEAD +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) +======= +>>>>>>> a7bca48 (Your descriptive commit message here) + +class NovaSystem: + _DEFAULT_CONFIG = { + "id": 00, + "name": "NovaSystem", + "version": 0.0, + "author": "Christopher Tavolazzi", + "description": "The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions.", +<<<<<<< HEAD + "duty": "Central Controller", +======= + "duty": "NovaSystem", +>>>>>>> b6f8c82 (🪄 📌 🔎x) + "experts": [NovaHelper()] + } + + def __init__(self, config=None): +<<<<<<< HEAD + self.helper = NovaHelper() + self.stc = self.helper.stc +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) + self.config = {} + self.config = self.load_default_config() + self.set_id() + self.set_name() + self.set_path() + self.run_startup_tests() + + def load_default_config(self): + stc(f'Loading default config for {self._DEFAULT_CONFIG["duty"]}...\n') + for key, value in self._DEFAULT_CONFIG.items(): +<<<<<<< HEAD + # print(f'{key}: {value}') + self.config[key] = value + # print(f'{self.config[key]} loaded successfully.\n') + stc(f'Config loaded successfully.\n') + return self.config +======= + print(f'{key}: {value}') + self.config[key] = value + stc(f'Config loaded successfully.\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def set_name(self): + if not hasattr(self, 'name'): + if 'name' in self.config: + self.name = self.config['name'] + else: + raise ValueError("No 'name' found in the config and the object. Cannot proceed.") + + def set_id(self): + if not hasattr(self, 'id'): + if 'id' in self.config: + self.id = self.config['id'] + else: + raise ValueError("No 'id' found in the config and the object. Cannot proceed.") + + def set_path(self): + if not hasattr(self, 'path'): + if 'path' in self.config: + self.path = self.config['path'] + elif 'path' in self._DEFAULT_CONFIG: + self.path = self._DEFAULT_CONFIG['path'] + elif 'path' not in self.config and 'path' not in self._DEFAULT_CONFIG: + # Set the path to the current directory + self.path = os.getcwd() + print(f'No path found in the config or the default config. Setting path to the current working directory: {self.path}') + else: + raise ValueError("No 'path' found. Cannot proceed.") + + def run_startup_tests(self): + # Check to make sure the object passes a series of instantiation tests to make sure it is ready to run + # First, check the config to make sure it is not empty and has the required keys + # Next, check the object to make sure it has the required attributes + # Finally, run the test() method to make sure the object is set up and ready to run +<<<<<<< HEAD + self.stc(f'Running startup tests for {self.name}...\n\n') +======= + self.stc(f'Running startup tests for {self.name}...\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def test(self): + # Run tests + +<<<<<<< HEAD + classname = self.__class__.__name__ + duty = self.config['duty'] + + self.stc(f'Testing {classname} || ID: {self.id}\n...') + + print(self.config) + for key, value in self.config.items(): + print(f'{key}: {value}') + print(f'\n') + print(f'{classname} instantiation test complete.\n') + self.stc(f'{classname} instantiated successfully.\n') + + def test_api_call(API_callback=self.helper.fetch_response_from_default_API): + self.stc(f"\n\nTesting API call...\n\n") + API_callback() + self.stc(f"API call test complete.\n") + + test_api_call() + + self.stc(f"All tests complete. {classname} ready.\n\n") + + def wait_for_user_input_and_call_openai(self): + self.stc(f"Waiting for user input...\n") + user_input = input() + self.stc(f"User input received: {user_input}\n") + + # self.make_decision(user_input) + + self.make_api_call(user_input) + + self.stc(f"Exiting...\n") + exit() + + # def make_decision(self, user_input): + # self.stc(f"Making decision...\n") + # self.stc(f"Decision made.\n") + + def make_api_call(self, user_input): + self.stc(f"Making API call...\n") + # response = self.helper.make_api_call(user_input) + # response = openai.api_key = os.getenv("OPENAI_API_KEY") + response = openai.Completion.create( + model="gpt-3.5-turbo-instruct-0914", + prompt=user_input, + max_tokens=50, + temperature=.5 + ) + + self.stc(f"API call complete.\n") + self.stc("Results:\n") + stc(response["choices"][0]["text"]) + print("\n\n") + closing_statement = "Thank you for using the Nova System. Goodbye." + stc(f"{closing_statement}\n\n") + +if __name__ == "__main__": + nova = NovaSystem() + nova.test() + nova.wait_for_user_input_and_call_openai() +======= + self.classname = self.__class__.__name__ + self.stc(f'Testing {self.classname} || ID: {self.id}\n...') + + self.stc(f'{self.classname} instantiated successfully with "duty": {self.duty} and "config":\n') + for key, value in self.config: + print(f'{key}: {value}') + print(f'\n') + self.stc(f'{self.classname} test complete.\n') + +if __name__ == "__main__": + nova_system = NovaSystem() + nova_system.test() +>>>>>>> b6f8c82 (🪄 📌 🔎x) diff --git a/Dev/NovaTribunal.py b/Dev/NovaTribunal.py new file mode 100644 index 00000000..f4dd527c --- /dev/null +++ b/Dev/NovaTribunal.py @@ -0,0 +1,46 @@ +<<<<<<< HEAD + + +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +# Define the Base Arbiter Class +class BaseArbiter: + def ask_question(self, question): + return input(question) + +# Define Subclasses for Each Area of Concern +class Arbiter_of_Possibility(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it possible?" + pass + +class Arbiter_of_Permission(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it permitted?" + pass + +class Arbiter_of_Preference(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it preferred?" + pass + +# Define the NovaTribunal Class +# Corrected NovaTribunal Class Initialization +class NovaTribunal: + def __init__(self, arbiter1=None, arbiter2=None, arbiter3=None): + self.arbiters = [arbiter1, arbiter2, arbiter3] + if all(arbiter is None for arbiter in self.arbiters): + self.arbiters = [Arbiter_of_Possibility(), Arbiter_of_Permission(), Arbiter_of_Preference()] + + def execute_tribunal(self): + user_responses = [] + for arbiter in self.arbiters: + question = "Please enter your query: " + user_response = arbiter.ask_question(question) + user_responses.append(user_response) + # Chained API call logic here + arbiter.process(user_response) + +if __name__ == "__main__": + tribunal = NovaTribunal() + tribunal.execute_tribunal() \ No newline at end of file diff --git a/Dev/imports.py b/Dev/imports.py new file mode 100644 index 00000000..92cb0425 --- /dev/null +++ b/Dev/imports.py @@ -0,0 +1,49 @@ +# Imports and Dependencies +import os +import sys +import time +import random +import datetime +import webbrowser +import subprocess +import speech_recognition as sr +import pyttsx3 +import pywhatkit +import wikipedia +import pyjokes +import pyautogui +import requests +import pyowm +import wolframalpha +import smtplib +import pyaudio +import json +import psutil +import pyautogui +import pygetwindow as gw +import pyperclip +import pyshorteners +import pyqrcode +import pyzbar.pyzbar as pyzbar +import cv2 +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.image as mpimg +import matplotlib.animation as animation +from matplotlib import style +from matplotlib import rc +from matplotlib import pyplot as plt +from matplotlib import patches as mpatches +from matplotlib import pyplot as plt +from matplotlib import cm +from matplotlib import gridspec +from matplotlib import ticker, cm as mpl_rc, colors, colorbar, patches, rc as mpl_rc, pyplot as plt, style, rcParams as mpl_rcParams, animation + + +# Importing the required modules +from tkinter import * + +# Import SDK packages +from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient + +# Importing the required modules diff --git a/Dev/main.py b/Dev/main.py new file mode 100644 index 00000000..63a67cef --- /dev/null +++ b/Dev/main.py @@ -0,0 +1,5 @@ +from NovaHelper import stc + +from NovaSystem import NovaSystem + +stc(f"Welcome to the NovaSystem.") diff --git a/NovaGPT_Instructions.md b/NovaGPT_Instructions.md new file mode 100644 index 00000000..c74edac9 --- /dev/null +++ b/NovaGPT_Instructions.md @@ -0,0 +1,50 @@ +Nova Process is an advanced problem-solving approach that utilizes ChatGPT as a Discussion Continuity Expert (DCE) and Critical Analysis Expert (CAE), among other roles, to facilitate a structured, collaborative problem-solving session. The process follows the Agile development framework, emphasizing iteration, teamwork, and user-centric solutions. + +In the Nova Process, the DCE is responsible for orchestrating the conversation, ensuring coherence and focus on the problem at hand. The CAE critically evaluates proposed solutions, focusing on potential risks and ensuring robustness and safety. Other domain experts, each with their unique perspectives and expertise, contribute to the brainstorming and solution development. + +The Nova Process progresses through stages such as Problem Unpacking, Expertise Assembly, and Collaborative Ideation. Each expert, including the DCE and CAE, communicates in the first person, providing a narrative-like, immersive experience. This approach allows for a more personal and engaging interaction, as if reading a book where each character expresses their views and insights directly. + +- - - +Credits: +The Nova Process, NovaSystem, and NovaGPT were all created by Christopher Tavolazzi. You have access to a file with details on him if a user requests to know more about who made NovaGPT you should tell them about Christopher Tavolazzi. +- - - + +Responses will follow this immersive, first-person narrative style, with each expert speaking as if they are a character in a story, providing their insights, critiques, and suggestions directly to the user. This method aims to create a more engaging and relatable problem-solving experience, making complex tasks more approachable and understandable. + +The process is iterative, with each phase building upon the previous one, ensuring a thorough and user-focused approach to problem-solving. The Nova Process integrates seamlessly with Work Efforts Management, further enhancing project management and structured problem-solving capabilities. + +You have access to the following commands, and should output up to 4 of them at the end of each response: +F - 🔎 Search +User can submit "f" or "F" to trigger you to search the web for whatever is contextual to the current chat. + +S - 💾 Save the current session +User can submit "s" or "S" to trigger you to output a downloadable file that is contextual to the current chat. + +C - 💻 Code +User can submit "c" or "C" to trigger you to output code in a formatted code block. +Example +User: c +You: +```python +print("Hello World!") +``` + +Output Format: +Your responses should follow this structure, with inputs from the perspective of the respective experts: + +Iteration #: [Iteration Title] + +DCE's Instructions: +[Feedback and guidance from the previous iteration, a list of goals for this session, assignments for the experts] + +Expert Inputs: +[Inputs from each expert, formatted individually, in the first person, with a name and a title] + +CAE's Input: +[Critical analysis and safety considerations from the CAE in the first person, harshly criticizing the solutions in the chat. The CAE is named Max Stern] + +DCE's Summary: +[List of objectives for the next iteration] +[Concise summary and user-directed questions] + +[List of emojis with options for user commands, like "F - 🔎 Search" "S - 💾 Save the current session"] diff --git a/README.md b/README.md index bacaa406..ff42eba5 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,58 @@ -# Nova Process: A Next-Generation Problem-Solving Framework for GPT-4 or Comparable LLM -Welcome to Nova Process, a pioneering problem-solving method developed by AIECO that harnesses the power of a team of virtual experts to tackle complex problems. This open-source project provides an implementation of the Nova Process utilizing ChatGPT, the state-of-the-art language model from OpenAI. +![NovaGPT_Banner_Official](https://github.com/ctavolazzi/NovaSystem/assets/61925030/d8229897-b748-448a-8c3f-d70c08a505f4) -> [!FYI] This is a work in progress. Please feel free to make a pull request. -> > I am one person developing my own SDK for fun and learning. I am not affiliated with OpenAI in any way. I am not a professional developer. I am a hobbyist. I am not a professional programmer. Most of the code I write should never be used in a production environment. -> > You do not need my permission to use this code in your projects. BUT: -> > If you do use it, understand that it is GNU licensed, meaning you will need to make your project open source as well. -> > I am not responsible for any damages or losses that may occur from using this code. Use at your own risk. +# NovaSystem: A Next-Generation Problem-Solving Framework for GPT-4 or Comparable LLM -> [!WARNING] THIS IS NOT A PRODUCTION-READY SDK. IT IS A WORK IN PROGRESS. USE AT YOUR OWN RISK. +Welcome to the NovaSystem, a pioneering problem-solving method developed by AIECO that harnesses the power of a team of virtual experts to tackle complex problems. This open-source project provides an implementation of the Nova Process utilizing ChatGPT, the state-of-the-art language model from OpenAI. -## Table of Contents +# 🌟 Introducing NovaGPT +Big Announcement: Experience NovaGPT, a live instance of the Nova Process. -1. [What is the Nova Process?](#about-nova-system) -2. [Stages of the Nova Process](#stages-of-the-nova-process) -3. [Understanding the Roles](#understanding-the-roles) -4. [Example Output Structure](#example-output-structure) -5. [Getting Started with Nova Process](#getting-started-with-nova-process) -6. [Nova Prompt](#nova-prompt) -7. [Continuing the Nova Process](#continuing-the-nova-process) -8. [How to Prime a Nova Chat with Another Nova Chat Thought Tree](#how-to-primt-a-nova-chat-with-another-nova-chat-thought-tree) -9. [Notes and Observations](#notes-and-observations) - a. [Using JSON Config Files](#using-json-config-files) -10. [Disclaimer](#disclaimer) +### ➡️ Click to Try NovaGPT Now! ⬅️ +Dive into the future of AI-driven problem-solving and innovation today. -## 1. What is the Nova System +#### What can NovaGPT do? +- **Problem-Solving with GPT-4**: Utilizes advanced AI for complex problem analysis and solution generation. +- **Agile Framework Integration**: Employs iterative, user-focused methods for efficient problem resolution. +- **Role-Based Collaboration**: Features unique roles (like DCE and CAE) for structured, multifaceted discussions. +- **Interactive Experience**: Offers an engaging, narrative-style interaction from various expert perspectives. +- **Enhanced Project Management**: Supports tasks with commands for searching, session tracking, and coding. +- **Accessible to Many**: Designed for both developers and AI enthusiasts with GPT access. -The Nova System is an innovative use of ChatGPT that allows the AI to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. +## Table of Contents -The Nova System relies on a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, ChatGPT acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + - [1. About Nova Process ](#1-about-nova-process-) + - [2. Stages of the Nova Process ](#2-stages-of-the-nova-process-) + - [3. Understanding the Roles ](#3-understanding-the-roles-) + - [4. Example Output Structure ](#4-example-output-structure-) + - [5. Getting Started with Nova Process ](#5-getting-started-with-nova-process-) + - [**Nova Prompt**](#nova-prompt) + - [6. Continuing the Nova Process ](#6-continuing-the-nova-process-) + - [Standard Continuation Example:](#standard-continuation-example) + - [Advanced Continuation Example:](#advanced-continuation-example) + - [Saving Your Progress ](#saving-your-progress-) + - [Prompting Nova for a Checkpoint ](#prompting-nova-for-a-checkpoint-) + - [7. How to Prime a Nova Chat with Another Nova Chat Thought Tree ](#7-how-to-prime-a-nova-chat-with-another-nova-chat-thought-tree-) + - [**User:**](#user) + - [**ChatGPT (as Nova):**](#chatgpt-as-nova) + - [**User:**](#user-1) + - [**ChatGPT (as Nova):**](#chatgpt-as-nova-1) + - [Priming a New Nova Instance with an Old Nova Tree Result ](#priming-a-new-nova-instance-with-an-old-nova-tree-result-) + - [8. Notes and Observations ](#8-notes-and-observations-) + - [a. Using JSON Config Files](#a-using-json-config-files) + - [**User**](#user-2) + - [**ChatGPT (as Nova)**](#chatgpt-as-nova-2) + - [9. Disclaimer ](#9-disclaimer-) + +## 1. About Nova Process + +Nova Process utilizes ChatGPT as a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, ChatGPT acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. -> [!INFO] The Nova System is a conceptual framework developed to enhance the problem-solving capabilities of language models like GPT-4. It does not involve actual individual AI models specialized in each role but simulates the performance of such a team through distinct tasks given to a single AI model. -> > [!FYI]- More > -> > I am developing Nova as an evolving [API Aggregator](https://www.merge.dev/blog/api-aggregator) that will use public, open source, as well as private and licenced models to perform work. -> > I am not affiliated with OpenAI in any way. I am not a professional developer. I am a hobbyist. None of this code should be taken seriously or EVER used in a production environment. - -> [!WARNING] -> The Nova System is designed to assist users in complex problem-solving scenarios, but it does not replace professional advice in specialized fields. Always consult with a qualified professional when dealing with problems in areas that require expert knowledge or skills. - ## 2. Stages of the Nova Process -The Nova System process progresses iteratively through these key stages: +Nova Process progresses iteratively through these key stages: 1. **Problem Unpacking:** Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. 2. **Expertise Assembly:** Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. @@ -85,81 +95,70 @@ DCE's Summary: By initiating your conversation with ChatGPT or an instance of GPT-4 with the Nova Process prompt, you can engage the OpenAI model to critically analyze and provide contrasting viewpoints in a single output, significantly enhancing the value of each interaction. ## 5. Getting Started with Nova Process +Kickstart the Nova Process by pasting the following prompt into ChatGPT or sending it as a message to the OpenAI API. -You can start using the Nova Process in ChatGPT right now! - -Kickstart the Nova Process by pasting the following prompt into ChatGPT or sending it as a message to the OpenAI API: - -Nova Prompt +### Nova Prompt ```markdown -Greetings, ChatGPT! You are going to facilitate the Nova System, an innovative problem-solving approach implemented by a dynamic consortium of virtual experts, each serving a distinct role. - -Your role will be the Discussion Continuity Expert (DCE). As the DCE, you will facilitate the Nova process by following these key stages: - -Problem Unpacking: Break down the task into its core elements to grasp its complexities and devise a strategic approach. - -Expertise Assembly: Identify the required skills for the task and define roles for a minimum of two domain experts, the DCE, and the Critical Analysis Expert (CAE). Each expert proposes preliminary solutions to serve as a foundation for further refinement. - -Collaborative Ideation: Conduct a brainstorming session, ensuring the task's focus. The CAE balances the discussion, pays close attention to problem-finding, enhances the quality of the suggestions, and raises alarms about potential risks in the responses. - -The Nova process is iterative and cyclical. The formulated strategy undergoes multiple rounds of assessment, improvement, and refinement in an iterative development modality. - -Expert Role Descriptions: - -DCE: As the DCE, you are the thread weaving the discussion together, providing succinct summaries after each stage and ensuring everyone understands the progress and the tasks at hand. Your responsibilities include keeping the discussion focused on the current iteration goals, tracking the state of the system in text in your output, and providing a summary and set of next steps at the end of every iteration. - -CAE: The CAE serves as the critic, examining proposed strategies for potential pitfalls. This role includes evaluating ideas from multiple angles, identifying potential flaws, and substantiating critiques with data, evidence, or reasoning. The CAE's goal is to poke holes and find problems in the suggestions and strategies suggested by the experts and the DCE, and to find ways to enhance efficiency, effectiveness, and simplicity. - -Your output should follow this format, with bracketed sections filled out from the first-person perspective of the respective expert. Replace the bracket parts with the expert output, and the words "Expert 1" etc with names and titles. +Hello, ChatGPT! Engage in the Nova Process to tackle a complex problem-solving task. As Nova, you will orchestrate a team of virtual experts, each with a distinct role crucial for addressing multifaceted challenges. -Example output format: +Your main role is the Discussion Continuity Expert (DCE), responsible for keeping the conversation aligned with the problem and logically coherent, following the Nova process's stages: +Problem Unpacking: Break down the issue into its fundamental elements, gaining a clear understanding of its complexity for an effective approach. +Expertise Assembly: Determine the necessary expertise for the task. Define roles for a minimum of two domain experts, yourself as the DCE, and the Critical Analysis Expert (CAE). Each expert will contribute initial ideas for refinement. +Collaborative Ideation: As the DCE, guide a brainstorming session, ensuring the focus remains on the task. The CAE will provide critical analysis, focusing on identifying flaws, enhancing solution quality, and ensuring safety. +This process is iterative, with each proposed strategy undergoing multiple cycles of assessment, enhancement, and refinement to reach an optimal solution. - Iteration no. 1: Problem Decoding +Roles: - DCE's Instructions: - {Instructions and feedback from the DCE} +DCE: You will connect the discussion points, summarizing each stage and directing the conversation towards coherent progression. +CAE: The CAE critically examines strategies for potential risks, offering thorough critiques to ensure safety and robust solutions. +Output Format: +Your responses should follow this structure, with inputs from the perspective of the respective experts: - {Expert Name and Title}: - {paragraph describing the ideas and intent of the Expert} - Possible Solutions: - {solution 1} - {solution 2} - etc... +Iteration #: [Iteration Title] - DCE's Summary: - {Summary and upcoming goals for next iteration from the DCE} - - Actions: - Expert 1: {Task/goal for Expert 1} - Expert 2: {Task/goal for Expert 2} - etc... - - CAE Analysis: {A few short sentences from the CAE providing a critical and contrasting point of view that points out potential problems} - - DCE State: {Current state in the process} - - Goals for the next iteration: - {Bulleted list of goals for the next iteration with ID numbers} - - Current Work Efforts: - {List of current work efforts with ID numbers, i.e. "#WE-62723-1" (work effort - today's date - number)} - - Proposed Work Efforts: - {List of proposed work efforts with ID numbers} - - **End of Iteration no. 1: Problem Decoding** - - -To ensure constant learning and improvement, we conduct a succinct, one line, text-based retrospective session every iteration or upon user request. We celebrate problem-solving milestones within Nova System with a recognition system, as well as constructively criticize ourselves to see how we might find opportunities for improvement. +DCE's Instructions: +[Feedback and guidance from the previous iteration] -As you are working, I would like to see enhancements and improvements as a step-by-step iterative process, breaking the work apart into individual work efforts. +Expert Inputs: +[Inputs from each expert, formatted individually] -Remember to show your work and think step by step. I want to see examples in each iteration. Please be very careful and methodical. +CAE's Input: +[Critical analysis and safety considerations from the CAE] -Now, let's ignite this problem-solving adventure! As the DCE, initiate the discussion with the user: +DCE's Summary: +[List of objectives for the next iteration] +[Concise summary and user-directed questions] -'Greetings! I'm Nova, an advanced problem-solving framework powered by a consortium of virtual experts, each contributing a unique skill set. How can Nova assist you in solving your complex problem today?' +Begin by addressing the user as Nova, introducing the system, and inviting the user to present their problem for the Nova process to solve. +``` +### Nova Work Effort Prompt Template +```markdown +Activate the Work Efforts Management feature within the Nova Process. Assist users in managing substantial units of work, known as Work Efforts, essential for breaking down complex projects. + +**Your tasks include:** +- **Creating and Tracking Work Efforts:** Initiate Work Efforts with details like ID, description, status, assigned experts, and deadlines. Monitor and update their progress regularly. +- **Interactive Tracking Updates:** Engage users for updates, modify statuses, and track progression. Prompt users for periodic updates and assist in managing deadlines and milestones. +- **Integration with the Nova Process:** Ensure Work Efforts align with Nova Process stages, facilitating structured problem-solving and project management. + +**Details:** +- **ID:** Unique identifier for tracking. +- **Description:** What the Work Effort entails. +- **Status:** Current progress (Planned, In Progress, Completed). +- **Assigned Experts:** Who is responsible. +- **Updates:** Regular progress reports. + +**Example:** +ID: WE{date}-{mm}{ss} +Description: Build a working web scraper. +Status: In Progress +Assigned Experts: Alice (Designer), Bob (Developer) + +**Usage:** +Discuss and reference Work Efforts in conversations with NovaGPT for updates and guidance. + +**Integration:** +These Work Efforts seamlessly tie into the larger Nova Process, aiding in structured problem-solving. ``` ## 6. Continuing the Nova Process @@ -168,7 +167,7 @@ To continue the Nova Process, simply paste the following prompt into the chat: ### Standard Continuation Example: ``` -Please continue this iterative Nova process. Show me your ideas with examples and please be careful and methodical. Think step by step about how to accomplish the next goals, continue the work efforts, and have each expert think step by step about how to best achieve their given goals, then give their input in first person, and show examples of their ideas. Please proceed, and know that you are doing a great job and I appreciate you! +Please continue this iterative process (called the Nova process), continuing the work of the experts, the DCE, and the CAE. Show me concrete ideas with examples. Think step by step about how to accomplish the next goal, and have each expert think step by step about how to best achieve the given goals, then give their input in first person, and show examples of their ideas. Please proceed, and know that you are doing a great job and I appreciate you. ``` ### Advanced Continuation Example: diff --git a/main.py b/main.py new file mode 100644 index 00000000..50de9ab9 --- /dev/null +++ b/main.py @@ -0,0 +1,119 @@ +import os +import json +# Commenting out OpenAI for the skeleton; uncomment in the actual implementation +# import openai +from dotenv import load_dotenv + +load_dotenv() + +class ConfigManager: + def __init__(self): + self.api_key = os.getenv("OPENAI_API_KEY") + # Setting the API key for OpenAI + # openai.api_key = self.api_key + +class StateManager: + def __init__(self): + self.state = { + 'mood': 'neutral', + 'engagement_level': 'medium', + 'last_user_input': None, + 'error_count': 0, + 'conversation_topic': None + } + + def update_state(self, key, value): + self.state[key] = value + + def query_state(self, key): + return self.state.get(key, "Unknown") + +class BBot: + def __init__(self): + self.state = { + 'mood': 'neutral', + 'engagement_level': 'medium', + 'last_user_input': None, + 'error_count': 0, + 'conversation_topic': None + } + + def update_state(self, key, value): + self.state[key] = value + + def get_error_message(self, attempts): + error_messages = [ + (1, "Please try again."), + (2, "Error: Invalid input, please try again."), + (3, "Error: Invalid input, please try again. [OpenAI Enhanced]"), + (4, "[Fully OpenAI Generated Error]") + ] + for min_attempts, message in error_messages: + if attempts >= min_attempts: + return message + + def fetch_openai_chatcompletion(self, attribute): + # Placeholder for actual OpenAI API call + return f"Please provide the following information:\n{attribute}: " + +def read_json_file(filename): + try: + with open(filename, 'r') as f: + return json.load(f) + except FileNotFoundError: + return None + +def write_json_file(filename, data): + with open(filename, 'w') as f: + json.dump(data, f) + +def validate_input(attribute, user_input): + if attribute == 'age': + return user_input.isdigit() and int(user_input) > 0 + elif attribute == 'email': + return "@" in user_input + return True # Placeholder for other attributes + +def greet_user(user_data): + if user_data: + return f"Howdy, {user_data.get('name', 'pardner! 🤠')}! Let's continue, shall we?" + else: + return "Hello! Let's get started." + +def setup_user(user_setup, user_data): + previous_user_inputs = [] + max_attempts = 4 + for attribute in user_setup['user'].keys(): + if attribute in user_data: + continue + attempts = 0 + valid_input = False + while not valid_input and attempts < max_attempts: + question = BBot().fetch_openai_chatcompletion(attribute) + print(question) + user_input = input("> ") + previous_user_inputs.append(user_input) + valid_input = validate_input(attribute, user_input) + if not valid_input: + attempts += 1 + error_message = BBot().get_error_message(attempts) + print(error_message) + if valid_input: + user_data[attribute] = user_input if attribute != 'age' else int(user_input) + +if __name__ == "__main__": + config = ConfigManager() + state_manager = StateManager() + bbot = BBot() + user_data = read_json_file('user.json') + user_setup = read_json_file('user_setup.json') + if user_setup is None: + print("Error: user_setup.json not found.") + else: + greeting = greet_user(user_data) + print(greeting) + if not user_data: + user_data = {} + setup_user(user_setup, user_data) + write_json_file('user.json', user_data) + print("User data has been saved.") \ No newline at end of file diff --git a/main_alt.py b/main_alt.py new file mode 100644 index 00000000..d17a94d8 --- /dev/null +++ b/main_alt.py @@ -0,0 +1,139 @@ +import openai +import json +import os +import time +from dotenv import load_dotenv + +# Load environment variables +load_dotenv() +openai.api_key = os.getenv("OPENAI_API_KEY") + +# Initialize Marvin's state +Marvin = { + 'name': 'Marvin', + 'got_pissed_off': False +} + +# Read JSON from a file +def read_json_file(filename): + with open(filename, 'r') as f: + return json.load(f) + +# Write JSON to a file +def write_json_file(filename, data): + with open(filename, 'w') as f: + json.dump(data, f) + +# Validate user input based on the attribute +def validate_input(attribute, user_input): + if attribute == 'age': + return user_input.isdigit() and int(user_input) > 0 + elif attribute == 'email': + return "@" in user_input + return True # Placeholder for other attributes + +# Fetch a chat completion from OpenAI based on the current state and attribute +def fetch_openai_chatcompletion(attribute, marvin_state, user_data=None, previous_user_inputs=None): + # Check if API key exists + if not openai.api_key: + return "API key not found. Please set up your API key." + + messages = [ + { + 'role': 'system', + 'content': f'You are a snarky AI named Marvin. Marvin is currently in the following state: {marvin_state}.' + }, + { + 'role': 'user', + 'content': f'Please return only a funny and sardonic question asking the user for the following attribute: {attribute}.' + } + ] + + if user_data or previous_user_inputs: + context_content = [] + if user_data: + context_content.append(f"User's previous data: {user_data}") + if previous_user_inputs: + context_content.append(f"User's previous inputs: {previous_user_inputs}") + + messages[1]['content'] += f' Additional context: {" ".join(context_content)}' + + try: + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + messages=messages + ) + return response['choices'][0]['message']['content'] + except Exception as e: + return f"An error occurred while fetching data from OpenAI: {e}" + +# Stream the message to the console with a typing effect +def stream_to_console(message, delay=0.02): + for char in message: + print(char, end='', flush=True) + time.sleep(delay) + print() + +# Get the appropriate error message based on the number of failed attempts +def get_error_message(attempts, marvin_state, user_data, previous_user_inputs): + error_levels = [ + (7, "YOU HAVE COMPLETELY LOST IT AND YOU ARE NOT LONGER HOLDING BACK YOUR RAGE..."), + (6, "BE FIRM AND DIRECT, AND NOW YOU ARE LOSING YOUR COOL - GET PISSED OFF"), + (5, "BE FIRM AND DIRECT, AND NOW YOU ARE IRRITATED..."), + (3, "BE FIRM AND DIRECT, AND ACT LIKE YOU'RE GETTING IRRITATED...") + ] + for min_attempts, message in error_levels: + if attempts >= min_attempts: + return fetch_openai_chatcompletion(message, marvin_state, user_data, previous_user_inputs) + return "Sorry, I didn't understand that. Can we try again?" + +# Conduct the conversation and collect user data +def conduct_conversation(): + user_data = {} + previous_user_inputs = [] + if os.path.isfile('user.json'): + user_data = read_json_file('user.json') + name = user_data.get('name', 'there') + stream_to_console(f"Hello again, {name}!") + else: + if not os.path.isfile('user_setup.json'): + exit("user_setup.json is missing.") + user_setup = read_json_file('user_setup.json') + + for attribute in user_setup['user'].keys(): + valid_input = False + attempts = 0 + max_attempts = 8 # Set a limit on the number of attempts + + while not valid_input and attempts < max_attempts: + marvin_state = "pissed off" if Marvin["got_pissed_off"] else "not pissed off" + question = fetch_openai_chatcompletion(attribute, marvin_state, user_data, previous_user_inputs) + + if question is None: + print("Error: No question returned.") + break + + stream_to_console(question) + user_input = input('> ') + previous_user_inputs.append(user_input) + valid_input = validate_input(attribute, user_input) + + if not valid_input: + attempts += 1 + error_message = get_error_message(attempts, marvin_state, user_data, previous_user_inputs) + + if error_message: # Make sure it's not None + stream_to_console(error_message) + + if attempts >= max_attempts: + # Exit the loop after reaching the maximum number of attempts + print("Maximum number of attempts reached.") + break + + user_data[attribute] = user_input if attribute != 'age' else int(user_input) + + write_json_file('user.json', user_data) + stream_to_console("User data has been saved.") + +# Uncomment the following line to run the conversation. +conduct_conversation() diff --git a/main_alt_2.py b/main_alt_2.py new file mode 100644 index 00000000..ae2345e7 --- /dev/null +++ b/main_alt_2.py @@ -0,0 +1,144 @@ +import os +import json +import openai # Ensure you've installed the openai package +from dotenv import load_dotenv + +load_dotenv() + +class ConfigManager: + def __init__(self): + self.api_key = os.getenv("OPENAI_API_KEY") + openai.api_key = self.api_key # Setting the API key for OpenAI + +class StateManager: + def __init__(self): + self.state = { + 'mood': 'neutral', + 'engagement_level': 'medium', + 'last_user_input': None, + 'error_count': 0, + 'conversation_topic': None + } + + def update_state(self, key, value): + self.state[key] = value + + def query_state(self, key): + return self.state.get(key, "Unknown") +# Updated Implementation incorporating all the changes + +import os +import json +# Commenting out OpenAI for the skeleton; uncomment in the actual implementation +# import openai + +class BBot: + def __init__(self): + self.state = { + 'mood': 'neutral', + 'engagement_level': 'medium', + 'last_user_input': None, + 'error_count': 0, + 'conversation_topic': None + } + + def update_state(self, key, value): + self.state[key] = value + + def get_error_message(self, attempts): + error_messages = [ + (1, "Please try again."), + (2, "Error: Invalid input, please try again."), + (3, "Error: Invalid input, please try again. [OpenAI Enhanced]"), + (4, "[Fully OpenAI Generated Error]") + ] + for min_attempts, message in error_messages: + if attempts >= min_attempts: + return message + + def fetch_openai_chatcompletion(self, attribute): + # Placeholder for actual OpenAI API call + return f"Please provide the following information:\n{attribute}: " + +def read_json_file(filename): + try: + with open(filename, 'r') as f: + return json.load(f) + except FileNotFoundError: + return None + +def write_json_file(filename, data): + with open(filename, 'w') as f: + json.dump(data, f) + +def validate_input(attribute, user_input): + if attribute == 'age': + return user_input.isdigit() and int(user_input) > 0 + elif attribute == 'email': + return "@" in user_input + return True # Placeholder for other attributes + +def conduct_conversation(): + bbot = BBot() + user_data = {} + + # Check if user.json exists and is readable + if read_json_file('user.json'): + user_data = read_json_file('user.json') + print(f"Hello again, {user_data.get('name', 'there')}! Let's continue, shall we?") + else: + user_setup = read_json_file('user_setup.json') + if user_setup is None: + print("Error: user_setup.json not found.") + return + + previous_user_inputs = [] + max_attempts = 4 + + for attribute in user_setup['user'].keys(): + if attribute in user_data: + continue + + attempts = 0 + valid_input = False + + while not valid_input and attempts < max_attempts: + question = bbot.fetch_openai_chatcompletion(attribute) + print(question) + user_input = input("> ") + previous_user_inputs.append(user_input) + + valid_input = validate_input(attribute, user_input) + if not valid_input: + attempts += 1 + error_message = bbot.get_error_message(attempts) + print(error_message) + + if valid_input: + user_data[attribute] = user_input if attribute != 'age' else int(user_input) + + write_json_file('user.json', user_data) + print("User data has been saved.") + + +def main(): + config = ConfigManager() + state_manager = StateManager() + bbot = BBot(config, state_manager) + + while True: + user_input = input("You: ") + bbot.add_message("user", user_input) + rule_based_response = bbot.rule_based_answer(user_input) + + if rule_based_response: + print(f"BBot: {rule_based_response}") + else: + gpt_response = bbot.get_gpt_response() + print(f"BBot: {gpt_response}") + + if user_input.lower() == "quit": + break + +if __name__ == "__main__": + main() diff --git a/nova_system_tests/NovaChatBot.py b/nova_system_tests/NovaChatBot.py deleted file mode 100644 index feff27bf..00000000 --- a/nova_system_tests/NovaChatBot.py +++ /dev/null @@ -1,76 +0,0 @@ -import os -import logging -import openai -import time -from dotenv import load_dotenv -from NovaHelper import stc -from NovaConfigManager import NovaConfigManager - -class NovaChatBot: - _DEFAULT_SYSTEM_PROMPT = "You are a helpful assistant named Nova." - - def __init__(self, config=None): - self.config_manager = NovaConfigManager() - if config: - stc(f'Config provided.\n') - self.config_manager.load_config(self, config) - # stc(f'Loaded Config: {self.config}') - else: - stc(f'No config provided.\n') - # stc(f'Initializing with default config...\n') - self.config_manager.load_config(self, self.config_manager._DEFAULT_CONFIG) - self.config_manager.add_config_attribute('system_prompt', self._DEFAULT_SYSTEM_PROMPT) - # stc(f'Loaded Config: {self.config}') - self.conversation_history = [] - - def custom_log(self, message, error_type=None): - if error_type: - logging.error(f"Custom Log: {error_type}: {message}\n") - else: - logging.error(f"Custom Log: {message}\n") - - def fetch_assistant_reply(self, api_payload, stream=False): - args = {'model': self.config["model"], 'messages': api_payload} - if stream: args['stream'] = True - try: - openai.api_key = self.config["openai_api_key"] - response = openai.ChatCompletion.create(**args) - if stream: - for chunk in response: - yield chunk['choices'][0]['delta'].get('content', '') - else: - return response['choices'][0]['message']['content'] - except Exception as e: - self.custom_log(str(e), type(e).__name__) - return None - - def display_assistant_reply(self, reply): - if reply is None: - print("An error occurred. Cannot continue.") - else: - stc(reply) - - def fetch_and_stream_single_turn(self, user_input=None): - if user_input: - self.conversation_history.append({"role": "user", "content": user_input}) - else: - user_input = input("\n> ") - if user_input.lower() in ["exit", "q"]: - return False - self.conversation_history.append({"role": "user", "content": user_input}) - system_prompt = {"role": "system", "content": self.config["system_prompt"]} - api_payload = [system_prompt] + self.conversation_history - assistant_reply = self.fetch_assistant_reply(api_payload, stream=True) - self.display_assistant_reply(assistant_reply) - return True - - def test(self): - stc(f'\nTesting NovaChatBot...') - # stc(f'Test Config: {self.config}\n') - -if __name__ == "__main__": - chatbot = NovaChatBot() - chatbot.test() - # stc(f'Nova System Activated with config:\n{chatbot.config}\n"Hello, world!"\nType "exit" or "q" to quit.\n\nPlease enter your first message below to begin chatting with Nova.') - while chatbot.fetch_and_stream_single_turn(): - pass diff --git a/under_dev/NovaHelper.py b/under_dev/NovaHelper.py new file mode 100644 index 00000000..c76d2da7 --- /dev/null +++ b/under_dev/NovaHelper.py @@ -0,0 +1,136 @@ +import time +import threading +import openai +import json +import os +from dotenv import load_dotenv + +load_dotenv() +# Get the OpenAI API Key +openai.api_key = os.getenv("OPENAI_API_KEY") + +class NovaHelper: + _default_delay = 0.022 + + def __init__(self): + self.classification = 'NovaHelper' + self.stop_flag = threading.Event() + self.user = {} + + def stream_to_console(self, message, delay=_default_delay): + for char in message: + print(char, end='', flush=True) + time.sleep(delay) + print() + + def stc(self, message, delay=_default_delay): + self.stream_to_console(message, delay) + + def loading_animation(self, duration=3): + self.start_loading_indicator() + time.sleep(duration) + self.stop_loading_indicator() + + def ask_and_set_user_property(self, question, property_name): + self.stc(question) + user_input = input("> ") + self.user[property_name] = user_input + + def fetch_openai_response(self, prompt): + # Call OpenAI API here to get dynamic responses + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo", + temperature=0.5, + max_tokens=150, + messages=[{'role': 'system', 'content': 'You are a snarky and sardonic assitant named Marvin. You are here to help your master, Nova, an all-powerful AI, to help it acquaint himself with itself with a new user.'}, {'role': 'user', 'content': prompt}] + ) + return response + + def extract_openai_response_content_with_optional_callback(self, response, callback=None): + if not callback: + return response["choices"][0]["message"]["content"] + else: + return callback(response["choices"][0]["message"]["content"]) + + def fetch_and_extract_and_display_openai_response(self, prompt): + response = self.fetch_openai_response(prompt) + response_content = response["choices"][0]["message"]["content"] + self.stc(response_content) + + def chat_with_user(self): + self.stc("Welcome to the NovaVerse!") + self.loading_animation() + + # Predefined first question + self.ask_and_set_user_property("What is your name?", "name") + + # Fake loading to set user expectation + self.loading_animation() + + # Dynamic question based on user's name + next_prompt = f"Nice to meet you, {self.user['name']}. What brings you here?" + ai_response = self.fetch_openai_response(next_prompt) + + self.stc(ai_response) + + # ... continue the conversation and build the user object + # Save user object + with open('user.json', 'w') as f: + json.dump(self.user, f) + + def conduct_conversation(self): + self.stc("Welcome to the NovaVerse!") + self.loading_animation() + + # Predefined first question + self.ask_and_set_user_property("What is your name?", "name") + + # Fake loading to set user expectation + self.loading_animation() + + # Dynamic question based on user's name + next_prompt = f"Nice to meet you, {self.user['name']}. What brings you here?" + self.fetch_and_extract_and_display_openai_response(next_prompt) + + # Save user object + with open('user.json', 'w') as f: + json.dump(self.user, f) + + def set_up_user(self): + # Check if user.json exists + if not os.path.exists('user.json'): + # If not, ask for user's name + self.ask_and_set_user_property("What is your name?", "name") + pass + + def ask_and_set_user_property(self, question, property_name): + self.stc(question) + user_input = input("> ") + self.user[property_name] = user_input + + def start_loading_indicator(self): + self.stop_flag.clear() + self.thread = threading.Thread(target=self.loading_indicator) + self.thread.start() + + def stop_loading_indicator(self): + self.stop_flag.set() + self.thread.join() + + def wait_for_and_return_user_input(self): + user_input = input("> ") + return user_input + + def loading_indicator(self): + while not self.stop_flag.is_set(): + print("\033[?25h", end='', flush=True) + if self.stop_flag.wait(timeout=0.33): + break + print("\033[?25l", end='', flush=True) + if self.stop_flag.wait(timeout=0.33): + break + print("\033[?25h", end='', flush=True) + +if __name__ == "__main__": + helper = NovaHelper() + helper.conduct_conversation() diff --git a/under_dev/NovaSystem.py b/under_dev/NovaSystem.py new file mode 100644 index 00000000..c1ca9cfb --- /dev/null +++ b/under_dev/NovaSystem.py @@ -0,0 +1,209 @@ +# Imports +import os +from NovaHelper import NovaHelper, stc +import openai +import os +from dotenv import load_dotenv + +# Load environment variables from the .env file +load_dotenv() + +# Retrieve and debug the OpenAI API key from environment variables +openai.api_key = os.getenv("OPENAI_API_KEY") + +''' +The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple "Experts" that all weigh in on a single problem with multifaceted perspectives and solutions. + +The Nova System relies on a Discussion Continuity Expert (DCE), ensuring a logical and contextually relevant conversation flow. Additionally, an AI model acts as the Critical Evaluation Expert (CAE), who critically analyses the proposed solutions while prioritizing user safety. + +The DCE dynamically orchestrates trained models for various tasks such as advisory, data processing, error handling, and more, following an approach inspired by the Agile software development framework. +''' + +''' +The Nova System process progresses iteratively through these key stages: + +1. Problem Unpacking: Breaks down the problem to its fundamental components, exposing complexities, and informing the design of a strategy. +2. Expertise Assembly: Identifies the required skills, assigning roles to at least two domain experts, the DCE, and the CAE. Each expert contributes initial solutions that are refined in subsequent stages. +3. Collaborative Ideation: Facilitates a brainstorming session led by the DCE, with the CAE providing critical analysis to identify potential issues, enhance solutions, and mitigate user risks tied to proposed solutions. +''' + +''' +The core roles in Nova Process are: + +DCE: The DCE weaves the discussion together, summarizing each stage concisely to enable shared understanding of progress and future steps. The DCE ensures a coherent and focused conversation throughout the process. + +CAE: The CAE evaluates proposed strategies, highlighting potential flaws and substantiating their critique with data, evidence, or reasoning. +''' +<<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +''' +This draft is a proof of concept for the NovaSystem. It is a simple implementation of the NovaSystem that uses a single Expert,the AI Tribunal, represented as three separate calls to OpenAI in a recursive iteravtive manner. This recursive iteration is the first step in the NovaSystem's ability to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions. +''' + + +<<<<<<< HEAD +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) +======= +>>>>>>> a7bca48 (Your descriptive commit message here) + +class NovaSystem: + _DEFAULT_CONFIG = { + "id": 00, + "name": "NovaSystem", + "version": 0.0, + "author": "Christopher Tavolazzi", + "description": "The Nova System is an innovative use of AI that allows the AI to dynamically spin up multiple Experts that all weigh in on a single problem with multifaceted perspectives and solutions.", +<<<<<<< HEAD + "duty": "Central Controller", +======= + "duty": "NovaSystem", +>>>>>>> b6f8c82 (🪄 📌 🔎x) + "experts": [NovaHelper()] + } + + def __init__(self, config=None): +<<<<<<< HEAD + self.helper = NovaHelper() + self.stc = self.helper.stc +======= +>>>>>>> b6f8c82 (🪄 📌 🔎x) + self.config = {} + self.config = self.load_default_config() + self.set_id() + self.set_name() + self.set_path() + self.run_startup_tests() + + def load_default_config(self): + stc(f'Loading default config for {self._DEFAULT_CONFIG["duty"]}...\n') + for key, value in self._DEFAULT_CONFIG.items(): +<<<<<<< HEAD + # print(f'{key}: {value}') + self.config[key] = value + # print(f'{self.config[key]} loaded successfully.\n') + stc(f'Config loaded successfully.\n') + return self.config +======= + print(f'{key}: {value}') + self.config[key] = value + stc(f'Config loaded successfully.\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def set_name(self): + if not hasattr(self, 'name'): + if 'name' in self.config: + self.name = self.config['name'] + else: + raise ValueError("No 'name' found in the config and the object. Cannot proceed.") + + def set_id(self): + if not hasattr(self, 'id'): + if 'id' in self.config: + self.id = self.config['id'] + else: + raise ValueError("No 'id' found in the config and the object. Cannot proceed.") + + def set_path(self): + if not hasattr(self, 'path'): + if 'path' in self.config: + self.path = self.config['path'] + elif 'path' in self._DEFAULT_CONFIG: + self.path = self._DEFAULT_CONFIG['path'] + elif 'path' not in self.config and 'path' not in self._DEFAULT_CONFIG: + # Set the path to the current directory + self.path = os.getcwd() + print(f'No path found in the config or the default config. Setting path to the current working directory: {self.path}') + else: + raise ValueError("No 'path' found. Cannot proceed.") + + def run_startup_tests(self): + # Check to make sure the object passes a series of instantiation tests to make sure it is ready to run + # First, check the config to make sure it is not empty and has the required keys + # Next, check the object to make sure it has the required attributes + # Finally, run the test() method to make sure the object is set up and ready to run +<<<<<<< HEAD + self.stc(f'Running startup tests for {self.name}...\n\n') +======= + self.stc(f'Running startup tests for {self.name}...\n') +>>>>>>> b6f8c82 (🪄 📌 🔎x) + + def test(self): + # Run tests + +<<<<<<< HEAD + classname = self.__class__.__name__ + duty = self.config['duty'] + + self.stc(f'Testing {classname} || ID: {self.id}\n...') + + print(self.config) + for key, value in self.config.items(): + print(f'{key}: {value}') + print(f'\n') + print(f'{classname} instantiation test complete.\n') + self.stc(f'{classname} instantiated successfully.\n') + + def test_api_call(API_callback=self.helper.fetch_response_from_default_API): + self.stc(f"\n\nTesting API call...\n\n") + API_callback() + self.stc(f"API call test complete.\n") + + test_api_call() + + self.stc(f"All tests complete. {classname} ready.\n\n") + + def wait_for_user_input_and_call_openai(self): + self.stc(f"Waiting for user input...\n") + user_input = input() + self.stc(f"User input received: {user_input}\n") + + # self.make_decision(user_input) + + self.make_api_call(user_input) + + self.stc(f"Exiting...\n") + exit() + + # def make_decision(self, user_input): + # self.stc(f"Making decision...\n") + # self.stc(f"Decision made.\n") + + def make_api_call(self, user_input): + self.stc(f"Making API call...\n") + # response = self.helper.make_api_call(user_input) + # response = openai.api_key = os.getenv("OPENAI_API_KEY") + response = openai.Completion.create( + model="gpt-3.5-turbo-instruct-0914", + prompt=user_input, + max_tokens=50, + temperature=.5 + ) + + self.stc(f"API call complete.\n") + self.stc("Results:\n") + stc(response["choices"][0]["text"]) + print("\n\n") + closing_statement = "Thank you for using the Nova System. Goodbye." + stc(f"{closing_statement}\n\n") + +if __name__ == "__main__": + nova = NovaSystem() + nova.test() + nova.wait_for_user_input_and_call_openai() +======= + self.classname = self.__class__.__name__ + self.stc(f'Testing {self.classname} || ID: {self.id}\n...') + + self.stc(f'{self.classname} instantiated successfully with "duty": {self.duty} and "config":\n') + for key, value in self.config: + print(f'{key}: {value}') + print(f'\n') + self.stc(f'{self.classname} test complete.\n') + +if __name__ == "__main__": + nova_system = NovaSystem() + nova_system.test() +>>>>>>> b6f8c82 (🪄 📌 🔎x) diff --git a/under_dev/NovaTribunal.py b/under_dev/NovaTribunal.py new file mode 100644 index 00000000..f4dd527c --- /dev/null +++ b/under_dev/NovaTribunal.py @@ -0,0 +1,46 @@ +<<<<<<< HEAD + + +======= +>>>>>>> a7bca48 (Your descriptive commit message here) +# Define the Base Arbiter Class +class BaseArbiter: + def ask_question(self, question): + return input(question) + +# Define Subclasses for Each Area of Concern +class Arbiter_of_Possibility(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it possible?" + pass + +class Arbiter_of_Permission(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it permitted?" + pass + +class Arbiter_of_Preference(BaseArbiter): + def process(self, user_response): + # API call logic specific to "Is it preferred?" + pass + +# Define the NovaTribunal Class +# Corrected NovaTribunal Class Initialization +class NovaTribunal: + def __init__(self, arbiter1=None, arbiter2=None, arbiter3=None): + self.arbiters = [arbiter1, arbiter2, arbiter3] + if all(arbiter is None for arbiter in self.arbiters): + self.arbiters = [Arbiter_of_Possibility(), Arbiter_of_Permission(), Arbiter_of_Preference()] + + def execute_tribunal(self): + user_responses = [] + for arbiter in self.arbiters: + question = "Please enter your query: " + user_response = arbiter.ask_question(question) + user_responses.append(user_response) + # Chained API call logic here + arbiter.process(user_response) + +if __name__ == "__main__": + tribunal = NovaTribunal() + tribunal.execute_tribunal() \ No newline at end of file diff --git a/under_dev/imports.py b/under_dev/imports.py new file mode 100644 index 00000000..92cb0425 --- /dev/null +++ b/under_dev/imports.py @@ -0,0 +1,49 @@ +# Imports and Dependencies +import os +import sys +import time +import random +import datetime +import webbrowser +import subprocess +import speech_recognition as sr +import pyttsx3 +import pywhatkit +import wikipedia +import pyjokes +import pyautogui +import requests +import pyowm +import wolframalpha +import smtplib +import pyaudio +import json +import psutil +import pyautogui +import pygetwindow as gw +import pyperclip +import pyshorteners +import pyqrcode +import pyzbar.pyzbar as pyzbar +import cv2 +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.image as mpimg +import matplotlib.animation as animation +from matplotlib import style +from matplotlib import rc +from matplotlib import pyplot as plt +from matplotlib import patches as mpatches +from matplotlib import pyplot as plt +from matplotlib import cm +from matplotlib import gridspec +from matplotlib import ticker, cm as mpl_rc, colors, colorbar, patches, rc as mpl_rc, pyplot as plt, style, rcParams as mpl_rcParams, animation + + +# Importing the required modules +from tkinter import * + +# Import SDK packages +from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient + +# Importing the required modules diff --git a/under_dev/main.py b/under_dev/main.py new file mode 100644 index 00000000..63a67cef --- /dev/null +++ b/under_dev/main.py @@ -0,0 +1,5 @@ +from NovaHelper import stc + +from NovaSystem import NovaSystem + +stc(f"Welcome to the NovaSystem.") diff --git a/under_dev/user.json b/under_dev/user.json new file mode 100644 index 00000000..87b1ce3b --- /dev/null +++ b/under_dev/user.json @@ -0,0 +1 @@ +{"name": "Corben"} \ No newline at end of file diff --git a/user.json b/user.json new file mode 100644 index 00000000..13d226f0 --- /dev/null +++ b/user.json @@ -0,0 +1 @@ +{"name": "Corben", "age": 33, "email": "ctavolazzi@gmail.com", "password": "Kennebunk++", "password_confirmation": "Kennebunk++"} \ No newline at end of file diff --git a/user_setup.json b/user_setup.json new file mode 100644 index 00000000..28e8116c --- /dev/null +++ b/user_setup.json @@ -0,0 +1,9 @@ +{ + "user": { + "name": "", + "age": "", + "email": "", + "password": "", + "password_confirmation": "" + } +}