Skip to content

Commit 70725df

Browse files
committed
Revert changes to large text
1 parent 33c0f9c commit 70725df

File tree

6 files changed

+128
-136
lines changed

6 files changed

+128
-136
lines changed

tests/conftest.py

-121
This file was deleted.

tests/large_text.py

+112
Large diffs are not rendered by default.

tests/litellm/litellm_core_utils/test_token_counter.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from litellm import create_pretrained_tokenizer, decode, encode, get_modified_max_tokens
2424
from litellm import token_counter as token_counter_old
2525
from litellm.litellm_core_utils.token_counter import token_counter as token_counter_new
26+
from tests.large_text import text
2627

2728

2829
def token_counter_both_assert_same(**args):
@@ -276,21 +277,22 @@ def test_gpt_vision_token_counting():
276277
@pytest.mark.parametrize(
277278
"model",
278279
[
280+
"gpt-4-vision-preview",
279281
"gpt-4o",
280282
"claude-3-opus-20240229",
281283
"command-nightly",
282284
"mistral/mistral-tiny",
283285
],
284286
)
285-
def test_load_test_token_counter(model, large_text):
287+
def test_load_test_token_counter(model):
286288
"""
287289
Token count large prompt 100 times.
288290
289291
Assert time taken is < 1.5s.
290292
"""
291293
import tiktoken
292294

293-
messages = [{"role": "user", "content": large_text}] * 10
295+
messages = [{"role": "user", "content": text}] * 10
294296

295297
start_time = time.time()
296298
for _ in range(10):

tests/local_testing/test_router.py

+10-13
Original file line numberDiff line numberDiff line change
@@ -683,15 +683,15 @@ async def test2():
683683

684684
@pytest.mark.asyncio
685685
@pytest.mark.parametrize("sync_mode", [True, False])
686-
async def test_async_router_context_window_fallback(sync_mode, large_text):
686+
async def test_async_router_context_window_fallback(sync_mode):
687687
"""
688688
- Give a gpt-4 model group with different context windows (8192k vs. 128k)
689689
- Send a 10k prompt
690690
- Assert it works
691691
"""
692692
import os
693693

694-
text = large_text
694+
from large_text import text
695695

696696
litellm.set_verbose = False
697697
litellm._turn_on_debug()
@@ -775,17 +775,15 @@ def test_router_rpm_pre_call_check():
775775
pytest.fail(f"Got unexpected exception on router! - {str(e)}")
776776

777777

778-
def test_router_context_window_check_pre_call_check_in_group_custom_model_info(
779-
large_text,
780-
):
778+
def test_router_context_window_check_pre_call_check_in_group_custom_model_info():
781779
"""
782780
- Give a gpt-3.5-turbo model group with different context windows (4k vs. 16k)
783781
- Send a 5k prompt
784782
- Assert it works
785783
"""
786784
import os
787785

788-
text = large_text
786+
from large_text import text
789787

790788
litellm.set_verbose = False
791789

@@ -831,15 +829,15 @@ def test_router_context_window_check_pre_call_check_in_group_custom_model_info(
831829
pytest.fail(f"Got unexpected exception on router! - {str(e)}")
832830

833831

834-
def test_router_context_window_check_pre_call_check(large_text):
832+
def test_router_context_window_check_pre_call_check():
835833
"""
836834
- Give a gpt-3.5-turbo model group with different context windows (4k vs. 16k)
837835
- Send a 5k prompt
838836
- Assert it works
839837
"""
840838
import os
841839

842-
text = large_text
840+
from large_text import text
843841

844842
litellm.set_verbose = False
845843

@@ -885,15 +883,15 @@ def test_router_context_window_check_pre_call_check(large_text):
885883
pytest.fail(f"Got unexpected exception on router! - {str(e)}")
886884

887885

888-
def test_router_context_window_check_pre_call_check_out_group(large_text):
886+
def test_router_context_window_check_pre_call_check_out_group():
889887
"""
890888
- Give 2 gpt-3.5-turbo model groups with different context windows (4k vs. 16k)
891889
- Send a 5k prompt
892890
- Assert it works
893891
"""
894892
import os
895893

896-
text = large_text
894+
from large_text import text
897895

898896
litellm.set_verbose = False
899897

@@ -1138,7 +1136,7 @@ async def test_aimg_gen_on_router():
11381136
"api_base": os.getenv("AZURE_SWEDEN_API_BASE"),
11391137
"api_key": os.getenv("AZURE_SWEDEN_API_KEY"),
11401138
},
1141-
},
1139+
}
11421140
]
11431141
router = Router(model_list=model_list, num_retries=3)
11441142
response = await router.aimage_generation(
@@ -2789,5 +2787,4 @@ def test_router_get_model_group_info():
27892787
assert model_group_info is not None
27902788
assert model_group_info.model_group == "gpt-4"
27912789
assert model_group_info.input_cost_per_token > 0
2792-
2793-
assert model_group_info.output_cost_per_token > 0
2790+
assert model_group_info.output_cost_per_token > 0

tests/old_proxy_tests/tests/load_test_completion.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from openai import AsyncOpenAI, AsyncAzureOpenAI
55
import uuid
66
import traceback
7+
from large_text import text
78
from dotenv import load_dotenv
89
from statistics import mean, median
910

tests/test_fallbacks.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44
import asyncio
55
import aiohttp
6+
from large_text import text
67
import time
78
from typing import Optional
89

0 commit comments

Comments
 (0)