mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
refactor: add black formatting
This commit is contained in:
parent
b87d630b0a
commit
4905929de3
156 changed files with 19723 additions and 10869 deletions
|
@ -1,5 +1,5 @@
|
|||
#### What this tests ####
|
||||
# This tests mock request calls to litellm
|
||||
# This tests mock request calls to litellm
|
||||
|
||||
import sys, os
|
||||
import traceback
|
||||
|
@ -9,6 +9,7 @@ sys.path.insert(
|
|||
) # Adds the parent directory to the system path
|
||||
import litellm
|
||||
|
||||
|
||||
def test_mock_request():
|
||||
try:
|
||||
model = "gpt-3.5-turbo"
|
||||
|
@ -19,18 +20,20 @@ def test_mock_request():
|
|||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
# test_mock_request()
|
||||
def test_streaming_mock_request():
|
||||
try:
|
||||
try:
|
||||
model = "gpt-3.5-turbo"
|
||||
messages = [{"role": "user", "content": "Hey, I'm a mock request"}]
|
||||
response = litellm.mock_completion(model=model, messages=messages, stream=True)
|
||||
complete_response = ""
|
||||
for chunk in response:
|
||||
complete_response = ""
|
||||
for chunk in response:
|
||||
complete_response += chunk["choices"][0]["delta"]["content"]
|
||||
if complete_response == "":
|
||||
if complete_response == "":
|
||||
raise Exception("Empty response received")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
test_streaming_mock_request()
|
||||
|
||||
test_streaming_mock_request()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue