From 4d40a54edfee9e28ddbbd1c0783ebe1e6f30169f Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Wed, 25 Oct 2023 14:07:45 -0700 Subject: [PATCH] (test) proxy server, add new caching test --- openai_proxy/tests/test_caching.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/openai_proxy/tests/test_caching.py b/openai_proxy/tests/test_caching.py index 5151752ad..36843e7d2 100644 --- a/openai_proxy/tests/test_caching.py +++ b/openai_proxy/tests/test_caching.py @@ -56,6 +56,25 @@ try: except: print(f"response: {response3}") +openai.api_key = os.getenv("ANTHROPIC_API_KEY") # this gets passed as a header +# switch caching off using cache flag +response4 = openai.ChatCompletion.create( + model = "claude-instant-1", + messages = [ + { + "role": "user", + "content": "write a short poem about litellm" + } + ], + caching = False, +) + +try: + print(f"response: {response4['choices'][0]['message']['content']}") +except: + print(f"response: {response4}") + assert response1["choices"][0]["message"]["content"] == response2["choices"][0]["message"]["content"] +assert response1["choices"][0]["message"]["content"] != response4["choices"][0]["message"]["content"] assert response1["choices"][0]["message"]["content"] != response3["choices"][0]["message"]["content"] \ No newline at end of file