Skip to content

Commit 852b06e

Browse files
authored
Add max_parallel_tool_calls to .act() API (#102)
* default to running multiple tool calls sequentially * set max_parallel_tool_calls to opt back in to parallel execution
1 parent 6f8b68e commit 852b06e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "lmstudio"
3-
version = "1.3.3.dev0"
3+
version = "1.4.0.dev0"
44
description = "LM Studio Python SDK"
55
authors = [
66
{name = "LM Studio", email = "[email protected]"},

src/lmstudio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""LM Studio Python SDK."""
22

3-
__version__ = "1.3.3.dev0"
3+
__version__ = "1.4.0.dev0"
44

55

66
# In addition to publishing the main SDK client API,

src/lmstudio/sync_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ def act(
12811281
tools: Iterable[ToolDefinition],
12821282
*,
12831283
max_prediction_rounds: int | None = None,
1284+
max_parallel_tool_calls: int | None = 1,
12841285
config: LlmPredictionConfig | LlmPredictionConfigDict | None = None,
12851286
preset: str | None = None,
12861287
on_message: Callable[[AssistantResponse | ToolResultMessage], Any]
@@ -1351,7 +1352,7 @@ def _wrapped_on_prompt_processing_progress(progress: float) -> None:
13511352
on_prompt_processing_for_endpoint = _wrapped_on_prompt_processing_progress
13521353
# Request predictions until no more tool call requests are received in response
13531354
# (or the maximum number of prediction rounds is reached)
1354-
with ThreadPoolExecutor() as pool:
1355+
with ThreadPoolExecutor(max_parallel_tool_calls) as pool:
13551356
for round_index in round_counter:
13561357
self._logger.debug(
13571358
"Starting .act() prediction round", round_index=round_index

0 commit comments

Comments
 (0)