Skip to content

Commit

Permalink
Merge branch 'main' into add-mike
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz authored Dec 11, 2023
2 parents 5500bdc + fd84a44 commit a799315
Show file tree
Hide file tree
Showing 139 changed files with 5,116 additions and 8,211 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,26 @@ permissions:

jobs:
run_tests:
name: ${{ matrix.test-type }} w/ python ${{ matrix.python-version }} | pydantic ${{ matrix.pydantic_version }} on ${{ matrix.os }}
name: ${{ matrix.test-type }} w/ python ${{ matrix.python-version }} on ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11']
test-type: ['not llm']
llm_model: ['openai/gpt-3.5-turbo']
pydantic_version: ['>=2.4.2']

include:
- python-version: '3.9'
os: 'ubuntu-latest'
test-type: 'llm'
llm_model: 'openai/gpt-3.5-turbo'
pydantic_version: '>=2.4.2'

- python-version: '3.9'
os: 'ubuntu-latest'
test-type: 'llm'
llm_model: 'openai/gpt-3.5-turbo'
pydantic_version: '<2'

- python-version: '3.9'
os: 'ubuntu-latest'
test-type: 'not llm'
llm_model: 'openai/gpt-3.5-turbo'
pydantic_version: '<2'

runs-on: ${{ matrix.os }}

Expand All @@ -75,12 +67,6 @@ jobs:
- name: Install Marvin
run: pip install ".[tests]"

- name: Install pydantic
run: pip install "pydantic${{ matrix.pydantic_version }}"


- name: Run ${{ matrix.test-type }} tests (${{ matrix.llm_model }})
- name: Run ${{ matrix.test-type }} tests
run: pytest -vv -m "${{ matrix.test-type }}"
env:
MARVIN_LLM_MODEL: ${{ matrix.llm_model }}
if: ${{ !(github.event.pull_request.head.repo.fork && matrix.test-type == 'llm') }}
171 changes: 0 additions & 171 deletions _mkdocs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion cookbook/slackbot/Dockerfile.slackbot
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN pip install 'git+https://github.com/PrefectHQ/marvin-recipes.git@main#egg=marvin_recipes[chroma, prefect, serpapi, slackbot]'
RUN pip install ".[slackbot]"

EXPOSE 4200

Expand Down
44 changes: 44 additions & 0 deletions cookbook/slackbot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## SETUP
it doesn't take much to run the slackbot locally

from a fresh environment you can do:
```console
# install marvin and slackbot dependencies
pip install git+https://github.com/PrefectHQ/marvin.git fastapi cachetools

# set necessary env vars
cat ~/.marvin/.env
│ File: /Users/nate/.marvin/.env
┼──────────────────────────────────────
│ MARVIN_OPENAI_API_KEY=sk-xxx
│ MARVIN_SLACK_API_TOKEN=xoxb-xxx
│ MARVIN_OPENAI_ORGANIZATION=org-xx
│ MARVIN_LOG_LEVEL=DEBUG
│ MARVIN_CHROMA_SERVER_HOST=localhost
│ MARVIN_CHROMA_SERVER_HTTP_PORT=8000
│ MARVIN_GITHUB_TOKEN=ghp_xxx
```

### hook up to slack
- create a slack app
- add a bot user, adding as many scopes as you want
- set event subscription url e.g. https://{NGROK_SUBDOMAIN}.ngrok.io/chat

see ngrok docs for easiest start https://ngrok.com/docs/getting-started/

tl;dr:
```console
brew install ngrok/ngrok/ngrok
ngrok http 4200 # optionally, --subdomain $NGROK_SUBDOMAIN
python cookbook/slackbot/start.py # in another terminal
```

#### test it out

<img width="719" alt="image" src="https://github.com/PrefectHQ/marvin/assets/31014960/a5948f7f-9aeb-4df0-b536-d61bb57dd1ab">

to deploy this to cloudrun, see:
- [Dockerfile.slackbot](/cookbook/slackbot/Dockerfile.slackbot)
- [image build CI](/.github/workflows/image-build-and-push-community.yaml)
Loading

0 comments on commit a799315

Please sign in to comment.