Somuai12 commited on
Commit
9c3ced0
·
1 Parent(s): 9e34c41

Fix model discovery: skip wildcard '*' model IDs from LiteLLM proxy

Browse files
Files changed (1) hide show
  1. 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
- if models_data:
45
- MODEL_NAME = models_data[0].get("id", "gpt-4o-mini")
46
- print(f"[DEBUG] Auto-discovered model: {MODEL_NAME}", flush=True)
 
 
 
 
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