Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: test.yaml
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

container:
image: python

steps:
- name: Check out git repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fix
run: git config --global --add safe.directory '*'

- name: Install dependencies
run: pip3 install poetry flake8 black && poetry config virtualenvs.create ${USE_VENV} && poetry install
#
# - name: flake8
# run: flake8 --max-line-length=120 .

- name: black
run: black --preview --check .

test_fields:
needs:
- lint

runs-on: ubuntu-latest

container:
image: python:3.8

steps:
- name: Check out git repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fix
run: git config --global --add safe.directory '*'

- name: Install dependencies
run: pip3 install poetry pytest-asyncio && poetry config virtualenvs.create false && poetry install

- name: Test
env:
FMA_APIKEY: ${{ secrets.FMA_APIKEY }}
run: pytest tests/test_fields.py --tb=short

test_flymyai_client:
needs:
- lint

runs-on: ubuntu-latest

container:
image: python:3.8

steps:
- name: Check out git repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fix
run: git config --global --add safe.directory '*'

- name: Install dependencies
run: pip3 install poetry pytest-asyncio && poetry config virtualenvs.create false && poetry install

- name: Test
env:
FMA_APIKEY: ${{ secrets.FMA_APIKEY }}
run: pytest tests/test_flymyai_client.py --tb=short

test_stream:
needs:
- lint

runs-on: ubuntu-latest

container:
image: python:3.8

steps:
- name: Check out git repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fix
run: git config --global --add safe.directory '*'

- name: Install dependencies
run: pip3 install poetry pytest-asyncio && poetry config virtualenvs.create false && poetry install

- name: Test
env:
FMA_APIKEY: ${{ secrets.FMA_APIKEY }}
run: pytest tests/test_stream.py --tb=short

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ dmypy.json
.pyre/
# media files
*.csv
*.png
*.jpg
*.rar
*.jpeg
Expand All @@ -142,5 +141,4 @@ dmypy.json
.dir
.idea/*
poetry.lock
tests/fixtures*/
venv*
Binary file added tests/fixtures/Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tests/fixtures/test_fields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"binary_field_path": "tests/fixtures/Untitled.png",
"simple_field_inputs": [
"123", 2, 2.0, [222, 22.0]
]
}
11 changes: 11 additions & 0 deletions tests/fixtures/test_flymyai_client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"client_auth_fixture": {
"model": "flymyai/perf_cpn-1",
"apikey_environ": "FMA_APIKEY"
},
"address_fixture": "https://dev-api.flymy.ai",
"fake_payload_fixture": {
"prompt": "2w432442"
},
"binary_file_paths": {}
}
18 changes: 18 additions & 0 deletions tests/fixtures/test_stream.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"address_fixture": "https://dev-api.flymy.ai",
"stream_payload": {
"prompt": "You discover the last library in the world, hidden in a forgotten city. What secrets does it hold, and why is it protected by ancient guardians?",
"best_of": 1,
"max_tokens": 128,
"stop": "\"<|im_end|>\", \"<|user|>\"",
"temperature": 0.7,
"top_k": 10,
"top_p": 0.9,
"stream": true
},
"auth": {
"model": "flymyai/vllm_stream",
"apikey_environ": "FMA_APIKEY"
},
"output_field": "output"
}