Fix model discovery: skip wildcard '*' model IDs from LiteLLM proxy
Browse files- inference.py +7 -3
inference.py
CHANGED
|
@@ -41,9 +41,13 @@ if not MODEL_NAME and API_BASE_URL and API_KEY:
|
|
| 41 |
)
|
| 42 |
if resp.status_code == 200:
|
| 43 |
models_data = resp.json().get("data", [])
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
except Exception as e:
|
| 48 |
print(f"[DEBUG] Model discovery failed: {e}", flush=True)
|
| 49 |
|
|
|
|
| 41 |
)
|
| 42 |
if resp.status_code == 200:
|
| 43 |
models_data = resp.json().get("data", [])
|
| 44 |
+
# Filter out wildcards and pick a real model name
|
| 45 |
+
for m in models_data:
|
| 46 |
+
mid = m.get("id", "")
|
| 47 |
+
if mid and mid != "*" and not mid.startswith("*"):
|
| 48 |
+
MODEL_NAME = mid
|
| 49 |
+
print(f"[DEBUG] Auto-discovered model: {MODEL_NAME}", flush=True)
|
| 50 |
+
break
|
| 51 |
except Exception as e:
|
| 52 |
print(f"[DEBUG] Model discovery failed: {e}", flush=True)
|
| 53 |
|