fix(proxy_server): returns better error messages for invalid api errors

This commit is contained in:
Krrish Dholakia 2023-10-09 14:56:05 -07:00
parent 262f874621
commit 42e0d7cf68
3 changed files with 67 additions and 72 deletions

View file

@ -54,17 +54,19 @@ def test_completion_invalid_param_cohere():
else:
pytest.fail(f'An error occurred {e}')
test_completion_invalid_param_cohere()
# test_completion_invalid_param_cohere()s
def test_completion_function_call_cohere():
try:
response = completion(model="command-nightly", messages=messages, function_call="TEST-FUNCTION")
response = completion(model="command-nightly", messages=messages, functions=["TEST-FUNCTION"])
except Exception as e:
if "Function calling is not supported by this provider" in str(e):
pass
else:
pytest.fail(f'An error occurred {e}')
test_completion_function_call_cohere()
def test_completion_function_call_openai():
try:
messages = [{"role": "user", "content": "What is the weather like in Boston?"}]