Skip to content

Commit 68d1319

Browse files
authored
Add default client access to convenience API (#12)
Exposing `lm.get_default_client()` means that *all* API operations are available in the convenience API, even if they don't have dedicated convenience API functions defined.
1 parent 400b276 commit 68d1319

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/lmstudio/sync_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
"LLM",
138138
"SyncModelHandle",
139139
"PredictionStream",
140+
"get_default_client",
140141
"embedding_model",
141142
"list_downloaded_models",
142143
"list_loaded_models",

tests/test_convenience_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
)
1616

1717

18+
@pytest.mark.lmstudio
19+
def test_get_default_client() -> None:
20+
client = lm.get_default_client()
21+
assert isinstance(client, lm.Client)
22+
23+
1824
@pytest.mark.lmstudio
1925
def test_llm_any() -> None:
2026
model = lm.llm()

0 commit comments

Comments
 (0)