Skip to content

Commit 41ce710

Browse files
committed
Improve model service info
1 parent efb5dc0 commit 41ce710

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

agentic/web_ui/gradio_chat.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _fetch_models():
3030
if not api_key:
3131
return [], {}, "No OPENAI_API_KEY set"
3232

33-
# ALCF: use their list-endpoints API (returns models grouped by cluster)
33+
# ALCF: use list-endpoints to get registered models per cluster
3434
if "alcf" in base_url.lower():
3535
try:
3636
resp = requests.get(
@@ -49,10 +49,10 @@ def _fetch_models():
4949
choices = []
5050
model_map = {}
5151
for cluster, info in data.get("clusters", {}).items():
52-
cluster_url = f"{ALCF_API_BASE}{info['base_url']}/api/v1"
53-
for fw in info.get("frameworks", {}).values():
52+
for fw_name, fw in info.get("frameworks", {}).items():
5453
if "/v1/chat/completions" not in fw.get("endpoints", []):
5554
continue
55+
cluster_url = f"{ALCF_API_BASE}{info['base_url']}/{fw_name}/v1"
5656
for model in fw.get("models", []):
5757
if any(s in model.lower() for s in skip):
5858
continue
@@ -215,18 +215,14 @@ async def _run():
215215
_init_tests = scan_script_dirs(str(DEFAULT_TESTS_DIR))
216216
_init_versions = scan_versions(str(DEFAULT_AGENT_DIR))
217217

218-
# Determine endpoint label for title
218+
# Determine service label for title
219219
_cur_base = os.environ.get("OPENAI_BASE_URL", "")
220-
if "metis" in _cur_base:
221-
_endpoint_label = "ALCF Metis"
222-
elif "sophia" in _cur_base:
223-
_endpoint_label = "ALCF Sophia"
224-
elif "alcf" in _cur_base.lower():
225-
_endpoint_label = "ALCF"
220+
if "alcf" in _cur_base.lower():
221+
_service_label = "ALCF"
226222
elif _cur_base:
227-
_endpoint_label = _cur_base.split("//")[-1].split("/")[0]
223+
_service_label = _cur_base.split("//")[-1].split("/")[0]
228224
else:
229-
_endpoint_label = "OpenAI"
225+
_service_label = "OpenAI"
230226

231227
# Fetch available models (one quick call at startup)
232228
_init_model_label = _current_model_label()
@@ -243,7 +239,7 @@ async def _run():
243239

244240
with gr.Blocks() as demo:
245241
with gr.Row():
246-
gr.Markdown(f"### libEnsemble Agent   ·   `{_endpoint_label}`")
242+
gr.Markdown(f"### libEnsemble Agent   ·   Service: `{_service_label}`")
247243
model_dropdown = gr.Dropdown(
248244
choices=_init_model_choices, value=_init_model_label,
249245
show_label=False, allow_custom_value=True, scale=2, min_width=300

0 commit comments

Comments
 (0)