From b7e59e8d842dcdc1ed7c6db3762fc7dca8a18d34 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:04:17 -0800 Subject: [PATCH 01/23] add CI --- .github/workflows/CI.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..a616425 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + + uses: actions/checkout@v2 + + - name: Install + run: ./install.sh From 15ee54821f3fbf04ce7e34b017e65747ad82ce48 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:05:56 -0800 Subject: [PATCH 02/23] fix typo --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a616425..e10bb97 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,8 +15,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 - name: Install - run: ./install.sh + run: ./install From 66e9026f57959880bc70e6bb236714828dcaf5e3 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:06:59 -0800 Subject: [PATCH 03/23] chmod +x --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e10bb97..9773a9f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,4 +18,4 @@ jobs: uses: actions/checkout@v2 - name: Install - run: ./install + run: chmod +x ./install && ./install From 4b10ac56f090428a232d1a89453da9d32c9bb0c9 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:10:19 -0800 Subject: [PATCH 04/23] hack --- .github/workflows/CI.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9773a9f..add0a66 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,6 +9,10 @@ on: - main workflow_dispatch: +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest @@ -18,4 +22,4 @@ jobs: uses: actions/checkout@v2 - name: Install - run: chmod +x ./install && ./install + run: . ./install From b7c8a9184f58e50df5b261d9f31579a3677e475b Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:11:44 -0800 Subject: [PATCH 05/23] syntax correction --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 7e2386c..d1066ed 100644 --- a/install +++ b/install @@ -6,7 +6,7 @@ PYTHON="python3.12" # deps DEPS="$PYTHON $PYTHON-venv $PYTHON-tk unzip curl" # check what flavor of linux and install deps -FAIL(){"echo 'Unsupported Linux distribution $1'; exit 1"} +FAIL() { echo "Unsupported Linux distribution $1"; exit 1; } if [ -f /etc/os-release ]; then . /etc/os-release if [ "$ID" == "ubuntu" ]; then From 4de6a10e75ab68bf867563c51133844ac945197b Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:12:47 -0800 Subject: [PATCH 06/23] correction --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index d1066ed..90f3304 100644 --- a/install +++ b/install @@ -21,7 +21,7 @@ if [ -f /etc/os-release ]; then elif [ "$ID" == "manjaro" ]; then sudo pacman -SU --noconfirm $DEPS || exit 1 else - FAIL() $ID + FAIL($ID) fi else FAIL() From e0902425367f2d775b4eeac0ad82caed6402772b Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:14:24 -0800 Subject: [PATCH 07/23] syntax fix --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 90f3304..d5dce6a 100644 --- a/install +++ b/install @@ -21,10 +21,10 @@ if [ -f /etc/os-release ]; then elif [ "$ID" == "manjaro" ]; then sudo pacman -SU --noconfirm $DEPS || exit 1 else - FAIL($ID) + FAIL "$ID" fi else - FAIL() + FAIL "$ID" fi # create virtual environment From dac6973d3b61d53395524b5b3cf39fb5fabc9f3a Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:16:38 -0800 Subject: [PATCH 08/23] permissions --- install | 1 + 1 file changed, 1 insertion(+) diff --git a/install b/install index d5dce6a..c3564f2 100644 --- a/install +++ b/install @@ -33,4 +33,5 @@ $PYTHON -m venv --symlinks --clear venv || exit 1 python -m pip install -r requirements.txt || exit 1 # download databases +chmod +x download_imdb_data.sh || exit 1 ./download_imdb_data.sh || exit 1 From 7dfb174635090765cb26754d2a1f7cb6fca622bf Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:32:46 -0800 Subject: [PATCH 09/23] front-end instantiation test --- .github/workflows/CI.yml | 5 +++++ MosaicAI/MosaicAI.py | 4 ++++ MosaicAI/test.py | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 MosaicAI/test.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index add0a66..ed4d573 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,3 +23,8 @@ jobs: - name: Install run: . ./install + + - name: Import MosaicAI + run: | + . ./activate + python MosaicAI/test.py diff --git a/MosaicAI/MosaicAI.py b/MosaicAI/MosaicAI.py index ecd0e63..54e56bd 100644 --- a/MosaicAI/MosaicAI.py +++ b/MosaicAI/MosaicAI.py @@ -3,4 +3,8 @@ def launch(): FrontEnd().run() +def test(): + FrontEnd() + return True + __name__ == "__main__" and launch() diff --git a/MosaicAI/test.py b/MosaicAI/test.py new file mode 100644 index 0000000..b3db2d2 --- /dev/null +++ b/MosaicAI/test.py @@ -0,0 +1,2 @@ +import MosaicAI +assert(MosaicAI.test()) From 8cd9c9481be13fc94e37b3b5f16338e93463abfb Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:37:01 -0800 Subject: [PATCH 10/23] instantiation tests --- MosaicAI/MosaicAI.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MosaicAI/MosaicAI.py b/MosaicAI/MosaicAI.py index 54e56bd..cb9e9e2 100644 --- a/MosaicAI/MosaicAI.py +++ b/MosaicAI/MosaicAI.py @@ -4,7 +4,12 @@ def launch(): FrontEnd().run() def test(): - FrontEnd() + from Agent import Agent + from IMDBot import IMDBot + from RQE import RouterQueryEngine + Agent() + IMDBot() + RouterQueryEngine() return True __name__ == "__main__" and launch() From 19325167a93f23cb858dbcea9583270ac14b57be Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:41:14 -0800 Subject: [PATCH 11/23] headless display error --- MosaicAI/MosaicAI.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MosaicAI/MosaicAI.py b/MosaicAI/MosaicAI.py index cb9e9e2..906a810 100644 --- a/MosaicAI/MosaicAI.py +++ b/MosaicAI/MosaicAI.py @@ -1,6 +1,5 @@ -from FrontEnd import FrontEnd - def launch(): + from FrontEnd import FrontEnd FrontEnd().run() def test(): From a65f4fa360d05534160fdafb34a1ce5a27909329 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:53:22 -0800 Subject: [PATCH 12/23] add keys --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ed4d573..92e511d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,6 +25,9 @@ jobs: run: . ./install - name: Import MosaicAI + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | . ./activate python MosaicAI/test.py From bd0a95bcc4287fc5eb45b2c30b023f0577260177 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:55:27 -0800 Subject: [PATCH 13/23] read env vars --- MosaicAI/Agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index c826b13..3c00aa1 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -19,7 +19,11 @@ def __init__(self, openai_key_path=_DEFAULTS["OpenAI API key path"], model=_DEFA self.openai = OpenAI(api_key=open(openai_key_path).read().strip()) else: self.openai = OpenAI() # backup option: read env vars - self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) + if os.path.exists(mem0_key_path): + # read key from local file and connect to the mem0 API + self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) + else: + self.mem0 = MemoryClient() self.user_id = 42 ## TODO return From 1b9d9a6e9163b2e7835b787d2ff4952c02cfd9e0 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 13:58:53 -0800 Subject: [PATCH 14/23] read env vars --- MosaicAI/Agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index 3c00aa1..d806542 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -23,7 +23,7 @@ def __init__(self, openai_key_path=_DEFAULTS["OpenAI API key path"], model=_DEFA # read key from local file and connect to the mem0 API self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) else: - self.mem0 = MemoryClient() + self.mem0 = MemoryClient(mem0=os.getenv("MEM0_API_KEY")) self.user_id = 42 ## TODO return From 4fcf3451103ce5227618f78e5e4e7ca1d90c8851 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 14:01:25 -0800 Subject: [PATCH 15/23] syntax --- MosaicAI/Agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index d806542..2c9ed78 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -23,7 +23,7 @@ def __init__(self, openai_key_path=_DEFAULTS["OpenAI API key path"], model=_DEFA # read key from local file and connect to the mem0 API self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) else: - self.mem0 = MemoryClient(mem0=os.getenv("MEM0_API_KEY")) + self.mem0 = MemoryClient(api_key=os.getenv("MEM0_API_KEY")) self.user_id = 42 ## TODO return From 06fa1b43ee5dc0d8126ed5894750a972aaf9a085 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 14:07:31 -0800 Subject: [PATCH 16/23] ci debug --- MosaicAI/test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MosaicAI/test.py b/MosaicAI/test.py index b3db2d2..d30d71f 100644 --- a/MosaicAI/test.py +++ b/MosaicAI/test.py @@ -1,2 +1,4 @@ import MosaicAI assert(MosaicAI.test()) +import os +print(os.getenv("MEM0_API_KEY")) From 0403132f80a561ec2de703101461349a856f0856 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 14:16:51 -0800 Subject: [PATCH 17/23] ? --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 92e511d..0f16a5b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,4 +30,5 @@ jobs: MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | . ./activate + export MEM0_API_KEY=${{ env.MEM0_API_KEY }} python MosaicAI/test.py From 3fec42fde00e3f80c693dc415614b1c0d3741317 Mon Sep 17 00:00:00 2001 From: eahenle Date: Tue, 28 Jan 2025 14:19:24 -0800 Subject: [PATCH 18/23] bogus plaintext key --- MosaicAI/Agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index 2c9ed78..1695226 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -23,7 +23,7 @@ def __init__(self, openai_key_path=_DEFAULTS["OpenAI API key path"], model=_DEFA # read key from local file and connect to the mem0 API self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) else: - self.mem0 = MemoryClient(api_key=os.getenv("MEM0_API_KEY")) + self.mem0 = MemoryClient(api_key="m0-kHH4QkCctKs5YtqCtIB4KeolaYfTRKfeHNqpPCcZ") self.user_id = 42 ## TODO return From 941617deecbfc30b1ad64b70a595c42792c0ced9 Mon Sep 17 00:00:00 2001 From: eahenle Date: Wed, 29 Jan 2025 09:22:02 -0800 Subject: [PATCH 19/23] jank --- .github/workflows/CI.yml | 2 +- MosaicAI/Agent.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0f16a5b..28a5e44 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,5 +30,5 @@ jobs: MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | . ./activate - export MEM0_API_KEY=${{ env.MEM0_API_KEY }} + cat $MEM0_API_KEY > .mem0_api_key python MosaicAI/test.py diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index 1695226..c2e9010 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -23,7 +23,8 @@ def __init__(self, openai_key_path=_DEFAULTS["OpenAI API key path"], model=_DEFA # read key from local file and connect to the mem0 API self.mem0 = MemoryClient(api_key=open(mem0_key_path).read().strip()) else: - self.mem0 = MemoryClient(api_key="m0-kHH4QkCctKs5YtqCtIB4KeolaYfTRKfeHNqpPCcZ") + print("Error: mem0 API key not found.") + exit(1) self.user_id = 42 ## TODO return From 11a10bc9445e9d4cb2bdccbccbfe2dfdb12e86e2 Mon Sep 17 00:00:00 2001 From: eahenle Date: Wed, 29 Jan 2025 09:28:08 -0800 Subject: [PATCH 20/23] bad AI --- .github/workflows/CI.yml | 2 +- MosaicAI/test.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 28a5e44..96f3660 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,5 +30,5 @@ jobs: MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | . ./activate - cat $MEM0_API_KEY > .mem0_api_key + cat $MEM0_API_KEY > .mem0 python MosaicAI/test.py diff --git a/MosaicAI/test.py b/MosaicAI/test.py index d30d71f..8417e77 100644 --- a/MosaicAI/test.py +++ b/MosaicAI/test.py @@ -1,4 +1,4 @@ +import os +print(os.getcwd()) import MosaicAI assert(MosaicAI.test()) -import os -print(os.getenv("MEM0_API_KEY")) From 271147d9000fbc0e0187e75e4dd86855946b381b Mon Sep 17 00:00:00 2001 From: eahenle Date: Wed, 29 Jan 2025 10:35:30 -0800 Subject: [PATCH 21/23] test --- .github/workflows/CI.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 96f3660..7d49315 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,16 +19,28 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install run: . ./install + - name: testtest + env: + FOO : ${{ secrets.FOO }} # try to load a secret the right way + BAR : ${{ secrets.BAZ }} # test what happens when you ask for a secret that doesn't exist + run: | + echo $FOO # should print the secret + echo ::add-mask::$FOO # should print a mask + echo $BAR # should print nothing + - name: Import MosaicAI env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | + echo $FOO # should print the secret + echo ::add-mask::$FOO # should print a mask + echo $BAR # should print nothing . ./activate - cat $MEM0_API_KEY > .mem0 + echo ${{ secrets.MEM0_API_KEY }} > .mem0 python MosaicAI/test.py From d282098f2d5a60362859cca82f1f519789f66fd4 Mon Sep 17 00:00:00 2001 From: eahenle Date: Wed, 29 Jan 2025 10:42:50 -0800 Subject: [PATCH 22/23] CI environment --- .github/workflows/CI.yml | 16 ++-------------- MosaicAI/test.py | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7d49315..e9f1e8d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,7 +16,8 @@ concurrency: jobs: build: runs-on: ubuntu-latest - + environment: + name: CI steps: - name: Checkout uses: actions/checkout@v4 @@ -24,23 +25,10 @@ jobs: - name: Install run: . ./install - - name: testtest - env: - FOO : ${{ secrets.FOO }} # try to load a secret the right way - BAR : ${{ secrets.BAZ }} # test what happens when you ask for a secret that doesn't exist - run: | - echo $FOO # should print the secret - echo ::add-mask::$FOO # should print a mask - echo $BAR # should print nothing - - name: Import MosaicAI env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | - echo $FOO # should print the secret - echo ::add-mask::$FOO # should print a mask - echo $BAR # should print nothing . ./activate - echo ${{ secrets.MEM0_API_KEY }} > .mem0 python MosaicAI/test.py diff --git a/MosaicAI/test.py b/MosaicAI/test.py index 8417e77..b3db2d2 100644 --- a/MosaicAI/test.py +++ b/MosaicAI/test.py @@ -1,4 +1,2 @@ -import os -print(os.getcwd()) import MosaicAI assert(MosaicAI.test()) From 677885fffce49bc896c6d35e403d5efe8759ffe4 Mon Sep 17 00:00:00 2001 From: eahenle Date: Wed, 29 Jan 2025 10:44:36 -0800 Subject: [PATCH 23/23] . --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e9f1e8d..b0b4d39 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,4 +31,5 @@ jobs: MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} run: | . ./activate + echo $MEM0_API_KEY > .mem0 python MosaicAI/test.py