Skip to content

Commit

Permalink
Merge pull request #6 from YeetCode-devs/staging/pranayadmn
Browse files Browse the repository at this point in the history
Verbosify pytest for Bing
  • Loading branch information
prathamdby authored Mar 17, 2024
2 parents 1f63b8d + 9f12e7e commit 10b2abb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = -p no:warnings
17 changes: 13 additions & 4 deletions tests/test_bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,24 @@
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


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")

0 comments on commit 10b2abb

Please sign in to comment.