From afa68531cf50b8da78f97b5f8a2d8cb54b68c519 Mon Sep 17 00:00:00 2001 From: Pranaya Deomani Date: Sun, 17 Mar 2024 17:38:17 +0000 Subject: [PATCH 1/3] Silence warnings from g4f during pytest --- pytest.ini | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..1ceab94 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = -p no:warnings From 5d46daaa5288d8029ccf31c7098e355f95bf0604 Mon Sep 17 00:00:00 2001 From: Pranaya Deomani Date: Sun, 17 Mar 2024 17:54:54 +0000 Subject: [PATCH 2/3] tests: bing: Add error handling during prompt creation --- tests/test_bing.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_bing.py b/tests/test_bing.py index c33b482..d965f6b 100644 --- a/tests/test_bing.py +++ b/tests/test_bing.py @@ -21,10 +21,13 @@ def generate_response() -> str: client = Client(provider=Bing) - response = client.chat.completions.create( - model="gpt-4.0-turbo", - messages=[{"role": "user", "content": "Say hi, with your response starting with START and ending with END"}], - ) + try: + response = client.chat.completions.create( + model="gpt-4.0-turbo", + messages=[{"role": "user", "content": "Say hi, with your response starting with START and ending with END"}], + ) + except: + print("ERROR: Could not create a prompt!") return response.choices[0].message.content From 9f12e7e6ee575b54487c44e69b3ac7b03b9bf4cf Mon Sep 17 00:00:00 2001 From: Pranaya Deomani Date: Sun, 17 Mar 2024 18:05:41 +0000 Subject: [PATCH 3/3] tests: bing: Log the status of the model --- tests/test_bing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_bing.py b/tests/test_bing.py index d965f6b..b30337d 100644 --- a/tests/test_bing.py +++ b/tests/test_bing.py @@ -35,4 +35,10 @@ def generate_response() -> str: class TestOutput: def test_output(self): response = generate_response() + + if (len(response) > 0): + print("✅ Bing is up!") + else: + print("❌ Bing is down...") + assert response.startswith("START") and response.endswith("END")