diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..b0b4d39 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: CI + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install + run: . ./install + + - name: Import MosaicAI + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + MEM0_API_KEY: ${{ secrets.MEM0_API_KEY }} + run: | + . ./activate + echo $MEM0_API_KEY > .mem0 + python MosaicAI/test.py diff --git a/MosaicAI/Agent.py b/MosaicAI/Agent.py index c826b13..c2e9010 100644 --- a/MosaicAI/Agent.py +++ b/MosaicAI/Agent.py @@ -19,7 +19,12 @@ 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: + print("Error: mem0 API key not found.") + exit(1) self.user_id = 42 ## TODO return diff --git a/MosaicAI/MosaicAI.py b/MosaicAI/MosaicAI.py index ecd0e63..906a810 100644 --- a/MosaicAI/MosaicAI.py +++ b/MosaicAI/MosaicAI.py @@ -1,6 +1,14 @@ -from FrontEnd import FrontEnd - def launch(): + from FrontEnd import FrontEnd FrontEnd().run() +def test(): + from Agent import Agent + from IMDBot import IMDBot + from RQE import RouterQueryEngine + Agent() + IMDBot() + RouterQueryEngine() + 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()) diff --git a/install b/install index 7e2386c..c3564f2 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 @@ -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 @@ -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