feat(utils.py): accept context window fallback dictionary

This commit is contained in:
Krrish Dholakia 2023-10-31 22:32:29 -07:00
parent 2f6fed30ad
commit 7762ae7762
4 changed files with 32 additions and 12 deletions

View file

@ -44,7 +44,16 @@ def test_context_window(model):
with pytest.raises(ContextWindowExceededError):
completion(model=model, messages=messages)
test_context_window(model="command-nightly")
@pytest.mark.parametrize("model", models)
def test_context_window_with_fallbacks(model):
ctx_window_fallback_dict = {"command-nightly": "claude-2"}
sample_text = "how does a court case get to the Supreme Court?" * 1000
messages = [{"content": sample_text, "role": "user"}]
completion(model=model, messages=messages, context_window_fallback_dict=ctx_window_fallback_dict)
# test_context_window(model="command-nightly")
test_context_window_with_fallbacks(model="command-nightly")
# Test 2: InvalidAuth Errors
@pytest.mark.parametrize("model", models)
def invalid_auth(model): # set the model key to an invalid key, depending on the model