Fix config tests (#343)

Co-authored-by: Vivian Fang <hi@vivi.sh>
This commit is contained in:
Sarah Wooders
2023-11-06 18:43:23 -08:00
committed by GitHub
parent 8700158222
commit e07a7ac1ef
5 changed files with 11 additions and 54 deletions

View File

@@ -1,40 +0,0 @@
name: sarah-test
on:
release:
types: [published]
workflow_dispatch:
env:
EXAMPLE_VAR: "hello_world"
PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.10.10 # Set this to your Python version
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies using Poetry
run: |
poetry install
- name: Install pexpect for testing the interactive CLI
run: |
poetry add --dev pexpect
- name: Run tests with pytest
env:
EXAMPLE_VAR: "hello_world"
PGVECTOR_TEST_DB_URL: ${{ secrets.PGVECTOR_TEST_DB_URL }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
PGVECTOR_TEST_DB_URL=${{ secrets.PGVECTOR_TEST_DB_URL }} OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} poetry run pytest -s -vv tests

View File

@@ -24,14 +24,13 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Install poetry
run: pip install poetry
- name: Set Poetry config
run: |

View File

@@ -76,18 +76,11 @@ def configure():
endpoint_options += ["openai"]
assert len(endpoint_options) > 0, "No endpoints found. Please enable OpenAI, Azure, or set OPENAI_API_BASE."
if len(endpoint_options) == 1:
default_endpoint = endpoint_options[0]
else:
default_endpoint = questionary.select("Select default inference endpoint:", endpoint_options).ask()
default_endpoint = questionary.select("Select default inference endpoint:", endpoint_options).ask()
# configure embedding provider
endpoint_options.append("local") # can compute embeddings locally
if len(endpoint_options) == 1:
default_embedding_endpoint = endpoint_options[0]
print(f"Using embedding endpoint {default_embedding_endpoint}")
else:
default_embedding_endpoint = questionary.select("Select default embedding endpoint:", endpoint_options).ask()
default_embedding_endpoint = questionary.select("Select default embedding endpoint:", endpoint_options).ask()
# configure embedding dimentions
default_embedding_dim = 1536

View File

@@ -22,7 +22,6 @@ def test_save_load():
child.expect("Empty input received. Try again!", timeout=TIMEOUT)
child.sendline("/save")
child.expect("Saved local", timeout=TIMEOUT)
child.expect("Enter your message:", timeout=TIMEOUT)
child.sendline("/exit")

View File

@@ -18,6 +18,12 @@ def configure_memgpt(enable_openai=True, enable_azure=False):
else:
child.sendline("n")
child.expect("Select default inference endpoint:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default embedding endpoint:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default preset:", timeout=TIMEOUT)
child.sendline()