Skip to content

Commit

Permalink
tests: bing: Add error handling during prompt creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pranayadmn authored Mar 17, 2024
1 parent afa6853 commit 5d46daa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/test_bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5d46daa

Please sign in to comment.