From 5d135fd50dbcf8f6b5851385ef062903a165d4e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 06:42:14 +0000 Subject: [PATCH 1/5] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build-docs.yml | 2 +- .github/workflows/deploy-cloudrun-revision-community.yaml | 2 +- .github/workflows/deploy-cloudrun-revision-internal.yaml | 2 +- .github/workflows/image-build-and-push-community.yaml | 2 +- .github/workflows/image-build-and-push-internal.yaml | 2 +- .github/workflows/publish-docs.yml | 2 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/run-tests.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 3d78104df..dfc83260a 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -22,7 +22,7 @@ jobs: build-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.9" diff --git a/.github/workflows/deploy-cloudrun-revision-community.yaml b/.github/workflows/deploy-cloudrun-revision-community.yaml index b75ca057f..c2ffda053 100644 --- a/.github/workflows/deploy-cloudrun-revision-community.yaml +++ b/.github/workflows/deploy-cloudrun-revision-community.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Authenticate to google cloud uses: google-github-actions/auth@v1 diff --git a/.github/workflows/deploy-cloudrun-revision-internal.yaml b/.github/workflows/deploy-cloudrun-revision-internal.yaml index dc3a9a1d7..9704becfc 100644 --- a/.github/workflows/deploy-cloudrun-revision-internal.yaml +++ b/.github/workflows/deploy-cloudrun-revision-internal.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Authenticate to google cloud uses: google-github-actions/auth@v1 diff --git a/.github/workflows/image-build-and-push-community.yaml b/.github/workflows/image-build-and-push-community.yaml index 115e6f1eb..059c77e44 100644 --- a/.github/workflows/image-build-and-push-community.yaml +++ b/.github/workflows/image-build-and-push-community.yaml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Authenticate to Google Cloud uses: google-github-actions/auth@v1 diff --git a/.github/workflows/image-build-and-push-internal.yaml b/.github/workflows/image-build-and-push-internal.yaml index 52d44ccd5..9ee59e6b1 100644 --- a/.github/workflows/image-build-and-push-internal.yaml +++ b/.github/workflows/image-build-and-push-internal.yaml @@ -50,7 +50,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Authenticate to Google Cloud uses: google-github-actions/auth@v1 diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 5ecf2f10d..f26484750 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -15,7 +15,7 @@ jobs: publish-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.9" diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index a56f45e1c..776a9a9b8 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - run: python3 -m pip install --upgrade build && python3 -m build diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0156bd77b..f2e153e6b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -52,7 +52,7 @@ jobs: MARVIN_ANTHROPIC_API_KEY: ${{ secrets.MARVIN_ANTHROPIC_API_KEY }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 1ea038c4b..fcb06b692 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: From f0f33ef611ef99d716ed8d63859fa35c9c7fe4b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 06:24:13 +0000 Subject: [PATCH 2/5] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build-docs.yml | 2 +- .github/workflows/publish-docs.yml | 2 +- .github/workflows/run-tests.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 3d78104df..76f403fc2 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.9" - uses: actions/cache@v3 diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 7c48355fe..532603785 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.9" - uses: actions/cache@v3 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d8244fd97..c52ef23de 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -56,7 +56,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index f6bb4c4b9..1d6277f4f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -24,7 +24,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.9" - name: Run pre-commit From a55c75c5b798877e4446ebb31f3c98c3ceb9c53d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 22:22:21 +0000 Subject: [PATCH 3/5] Update pytest-rerunfailures requirement from <13,>=10 to >=10,<14 Updates the requirements on [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) to permit the latest version. - [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst) - [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/10.0...13.0) --- updated-dependencies: - dependency-name: pytest-rerunfailures dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 732677241..9010fe617 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dev = [ tests = [ "pytest-asyncio>=0.18.2,!=0.22.0,<0.23.0", "pytest-env>=0.8,<2.0", - "pytest-rerunfailures>=10,<13", + "pytest-rerunfailures>=10,<14", "pytest-sugar~=0.9", "pytest~=7.3.1", "pytest-timeout", From 2a16210c4a5029ffe0ca752d386d716b258dfe8f Mon Sep 17 00:00:00 2001 From: Nathan Nowack Date: Tue, 9 Jan 2024 14:15:48 -0800 Subject: [PATCH 4/5] make slackpayload fields optional --- src/marvin/utilities/slack.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/marvin/utilities/slack.py b/src/marvin/utilities/slack.py index 65144c79e..b08f07388 100644 --- a/src/marvin/utilities/slack.py +++ b/src/marvin/utilities/slack.py @@ -29,11 +29,11 @@ class EventBlock(BaseModel): class SlackEvent(BaseModel): client_msg_id: Optional[str] = None type: str - text: str - user: str - ts: str - team: str - channel: str + text: Optional[str] = None + user: Optional[str] = None + ts: Optional[str] = None + team: Optional[str] = None + channel: Optional[str] = None event_ts: str thread_ts: Optional[str] = None parent_user_id: Optional[str] = None From 674baddca312bc958853391bbd429808f4dd8296 Mon Sep 17 00:00:00 2001 From: Nathan Nowack Date: Tue, 9 Jan 2024 14:46:29 -0800 Subject: [PATCH 5/5] rm caching for now, more sane token scoop --- cookbook/slackbot/start.py | 9 +-------- src/marvin/utilities/slack.py | 12 ++++++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/cookbook/slackbot/start.py b/cookbook/slackbot/start.py index d4b1ba0fc..b482acf5f 100644 --- a/cookbook/slackbot/start.py +++ b/cookbook/slackbot/start.py @@ -1,7 +1,5 @@ import asyncio import re -from datetime import timedelta -from typing import Callable import uvicorn from fastapi import FastAPI, HTTPException, Request @@ -28,17 +26,12 @@ ) from prefect import flow, task from prefect.states import Completed -from prefect.tasks import task_input_hash BOT_MENTION = r"<@(\w+)>" CACHE = JSONBlockState(block_name="marvin-thread-cache") USER_MESSAGE_MAX_TOKENS = 300 -def cached(func: Callable) -> Callable: - return task(cache_key_fn=task_input_hash, cache_expiration=timedelta(days=1))(func) - - async def get_notes_for_user( user_id: str, max_tokens: int = 100 ) -> dict[str, str | None]: @@ -145,7 +138,7 @@ async def handle_message(payload: SlackPayload) -> Completed: with Assistant( name="Marvin", - tools=[cached(multi_query_chroma), cached(search_github_issues)], + tools=[multi_query_chroma, search_github_issues], instructions=( "You are Marvin, the paranoid android from Hitchhiker's Guide to the" " Galaxy. Act subtly in accordance with your character, but remember" diff --git a/src/marvin/utilities/slack.py b/src/marvin/utilities/slack.py index b08f07388..fc5500380 100644 --- a/src/marvin/utilities/slack.py +++ b/src/marvin/utilities/slack.py @@ -75,18 +75,18 @@ async def get_token() -> str: marvin.settings.slack_api_token ) # set `MARVIN_SLACK_API_TOKEN` in `~/.marvin/.env except AttributeError: + if token := os.getenv("MARVIN_SLACK_API_TOKEN"): + return token try: # TODO: clean this up from prefect.blocks.system import Secret return (await Secret.load("slack-api-token")).get() except ImportError: pass - token = os.getenv("MARVIN_SLACK_API_TOKEN") - if not token: - raise ValueError( - "`MARVIN_SLACK_API_TOKEN` not found in environment." - " Please set it in `~/.marvin/.env` or as an environment variable." - ) + raise ValueError( + "`MARVIN_SLACK_API_TOKEN` not found in environment." + " Please set it in `~/.marvin/.env` or as an environment variable." + ) return token