Skip to content

Commit ece8c0e

Browse files
fix: only print unexpected api keys once
1 parent fc8ace0 commit ece8c0e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

DocToolsLLM/utils/misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def language_detector(text: str) -> None:
7878
max_lines = 100_000
7979
min_lang_prob = 0.50
8080

81-
printed_unexpected_api_keys = False # to print it only once
81+
printed_unexpected_api_keys = [False] # to print it only once
8282

8383
# loader specific arguments
8484
loader_specific_keys = {
@@ -214,12 +214,12 @@ def wrapped_model_name_matcher(model: str) -> str:
214214
for k, v in dict(os.environ).items():
215215
if k.endswith("_API_KEY"):
216216
backend = k.split("_API_KEY")[0].lower()
217-
if backend not in all_backends and is_verbose and not printed_unexpected_api_keys:
217+
if backend not in all_backends and is_verbose and not printed_unexpected_api_keys[0]:
218218
yel(f"Found API_KEY for backend {backend} that is not a known backend for litellm.")
219219
else:
220220
backends.append(backend)
221221
if is_verbose:
222-
printed_unexpected_api_keys = True
222+
printed_unexpected_api_keys[0] = True
223223
assert backends, "No API keys found in environnment"
224224

225225
# filter by providers

0 commit comments

Comments
 (0)