llm-proxy-cli 0.5.4__tar.gz → 0.5.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/PKG-INFO +2 -1
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/PKG-INFO +2 -1
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/requires.txt +1 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.py +9 -5
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/pyproject.toml +2 -1
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/LICENSE +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/README.md +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/SOURCES.txt +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/dependency_links.txt +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/entry_points.txt +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/llm_proxy_cli.egg-info/top_level.txt +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/setup.cfg +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/tests/test_circuit.py +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/tests/test_discovery.py +0 -0
- {llm_proxy_cli-0.5.4 → llm_proxy_cli-0.5.5}/tests/test_query_ai.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: llm-proxy-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: A lightweight CLI tool for delegating LLM tasks to expert models across multiple providers.
|
|
5
5
|
Author-email: Kerem Barbaros Karnabat <kbarbaros@hotmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -9,6 +9,7 @@ Classifier: Operating System :: OS Independent
|
|
|
9
9
|
Requires-Python: >=3.8
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: platformdirs
|
|
12
13
|
Requires-Dist: openai>=1.0.0
|
|
13
14
|
Requires-Dist: filelock>=3.12.0
|
|
14
15
|
Requires-Dist: anthropic>=0.30.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: llm-proxy-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: A lightweight CLI tool for delegating LLM tasks to expert models across multiple providers.
|
|
5
5
|
Author-email: Kerem Barbaros Karnabat <kbarbaros@hotmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -9,6 +9,7 @@ Classifier: Operating System :: OS Independent
|
|
|
9
9
|
Requires-Python: >=3.8
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: platformdirs
|
|
12
13
|
Requires-Dist: openai>=1.0.0
|
|
13
14
|
Requires-Dist: filelock>=3.12.0
|
|
14
15
|
Requires-Dist: anthropic>=0.30.0
|
|
@@ -5,11 +5,12 @@ import time
|
|
|
5
5
|
import random
|
|
6
6
|
import re
|
|
7
7
|
import argparse
|
|
8
|
+
import platformdirs
|
|
8
9
|
import logging
|
|
9
10
|
from openai import OpenAI
|
|
10
11
|
from filelock import FileLock, Timeout
|
|
11
12
|
|
|
12
|
-
__version__ = "0.5.
|
|
13
|
+
__version__ = "0.5.5"
|
|
13
14
|
|
|
14
15
|
# Optional import for anthropic
|
|
15
16
|
try:
|
|
@@ -27,12 +28,12 @@ logger.addHandler(handler)
|
|
|
27
28
|
logger.setLevel(logging.INFO)
|
|
28
29
|
|
|
29
30
|
def get_config_dir():
|
|
30
|
-
d =
|
|
31
|
+
d = platformdirs.user_config_dir("llm-proxy-cli")
|
|
31
32
|
os.makedirs(d, exist_ok=True)
|
|
32
33
|
return d
|
|
33
34
|
|
|
34
35
|
def get_cache_dir():
|
|
35
|
-
d =
|
|
36
|
+
d = platformdirs.user_cache_dir("llm-proxy-cli")
|
|
36
37
|
os.makedirs(d, exist_ok=True)
|
|
37
38
|
return d
|
|
38
39
|
|
|
@@ -246,7 +247,7 @@ def discover_best_model(provider, mode="smart", force_refresh=False):
|
|
|
246
247
|
|
|
247
248
|
provider_config = PROVIDERS.get(provider)
|
|
248
249
|
if not provider_config or not provider_config.get("api_key"):
|
|
249
|
-
logger.
|
|
250
|
+
logger.error(f"{provider}: API key not found. Set {provider.upper()}_API_KEY or add it to {get_config_dir()}/keys.json")
|
|
250
251
|
return None
|
|
251
252
|
|
|
252
253
|
try:
|
|
@@ -382,7 +383,6 @@ def parse_model(model_string, force_refresh_auto=False):
|
|
|
382
383
|
resolved = discover_best_model(provider, mode=mode, force_refresh=force_refresh_auto)
|
|
383
384
|
if resolved:
|
|
384
385
|
return provider, resolved
|
|
385
|
-
logger.error(f"Auto-discovery unavailable for '{provider}' ({mode}) and no static fallback was given.")
|
|
386
386
|
return provider, None
|
|
387
387
|
|
|
388
388
|
return provider, model
|
|
@@ -392,6 +392,7 @@ def query_ai(models_list, prompt, cb: CircuitBreaker, max_retries=2, base_timeou
|
|
|
392
392
|
if isinstance(models_list, str):
|
|
393
393
|
models_list = [m.strip() for m in models_list.split(',')]
|
|
394
394
|
|
|
395
|
+
models_attempted = 0
|
|
395
396
|
for current_model_str in models_list:
|
|
396
397
|
provider, current_model = parse_model(current_model_str, force_refresh_auto=force_refresh_auto)
|
|
397
398
|
if not current_model:
|
|
@@ -411,6 +412,7 @@ def query_ai(models_list, prompt, cb: CircuitBreaker, max_retries=2, base_timeou
|
|
|
411
412
|
|
|
412
413
|
is_nemotron = "nemotron" in current_model.lower()
|
|
413
414
|
model_timeout = 90 if is_nemotron else base_timeout
|
|
415
|
+
models_attempted += 1
|
|
414
416
|
|
|
415
417
|
for attempt in range(max_retries):
|
|
416
418
|
try:
|
|
@@ -476,6 +478,8 @@ def query_ai(models_list, prompt, cb: CircuitBreaker, max_retries=2, base_timeou
|
|
|
476
478
|
if attempt == max_retries - 1: break
|
|
477
479
|
time.sleep((2 ** attempt) + random.uniform(0.1, 1.5))
|
|
478
480
|
|
|
481
|
+
if models_attempted == 0:
|
|
482
|
+
raise RuntimeError("No models could be used. Check your API keys and configuration.")
|
|
479
483
|
raise RuntimeError("All fallback models failed, timed out, or are in cooldown.")
|
|
480
484
|
|
|
481
485
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "llm-proxy-cli"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.5"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Kerem Barbaros Karnabat", email="kbarbaros@hotmail.com" }
|
|
10
10
|
]
|
|
@@ -17,6 +17,7 @@ classifiers = [
|
|
|
17
17
|
"Operating System :: OS Independent",
|
|
18
18
|
]
|
|
19
19
|
dependencies = [
|
|
20
|
+
"platformdirs",
|
|
20
21
|
"openai>=1.0.0",
|
|
21
22
|
"filelock>=3.12.0",
|
|
22
23
|
"anthropic>=0.30.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|