Skip to content

Commit 3e9472c

Browse files
committed
feat(utils): add model id getter util
1 parent cf6ec1a commit 3e9472c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/strands_env/utils/sglang.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from functools import lru_cache
2020
from typing import Any
2121

22+
import httpx
2223
from strands_sglang import SGLangClient
2324

2425
_SGLANG_CLIENT_CONFIG = {
@@ -45,3 +46,10 @@ def get_cached_client_from_slime_args(args: Any) -> SGLangClient:
4546
def clear_clients() -> None:
4647
"""Clear all cached `SGLangClient` instances."""
4748
get_cached_client.cache_clear()
49+
50+
51+
def get_model_id(base_url: str) -> str:
52+
"""Get the model ID from the SGLang server."""
53+
response = httpx.get(f"{base_url}/get_model_info", timeout=5)
54+
response.raise_for_status()
55+
return response.json()["model_path"]

0 commit comments

Comments
 (0)