Skip to content

Commit 9cb067e

Browse files
authored
Add parallel_tool_call to openai model client config (#6888)
1 parent 3e30f9e commit 9cb067e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

python/packages/autogen-agentchat/src/autogen_agentchat/tools/_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class AgentTool(TaskRunnerTool, Component[AgentToolConfig]):
5050
5151
5252
async def main() -> None:
53-
model_client = OpenAIChatCompletionClient(model="gpt-4")
53+
model_client = OpenAIChatCompletionClient(model="gpt-4.1")
5454
writer = AssistantAgent(
5555
name="writer",
5656
description="A writer agent for generating text.",
@@ -60,7 +60,7 @@ async def main() -> None:
6060
writer_tool = AgentTool(agent=writer)
6161
6262
# Create model client with parallel tool calls disabled for the main agent
63-
main_model_client = OpenAIChatCompletionClient(model="gpt-4", parallel_tool_calls=False)
63+
main_model_client = OpenAIChatCompletionClient(model="gpt-4.1", parallel_tool_calls=False)
6464
assistant = AssistantAgent(
6565
name="assistant",
6666
model_client=main_model_client,

python/packages/autogen-agentchat/src/autogen_agentchat/tools/_team.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class TeamTool(TaskRunnerTool, Component[TeamToolConfig]):
5151
from autogen_agentchat.teams import RoundRobinGroupChat
5252
from autogen_agentchat.tools import TeamTool
5353
from autogen_agentchat.ui import Console
54-
from autogen_ext.models.ollama import OllamaChatCompletionClient
54+
from autogen_ext.models.openai import OpenAIChatCompletionClient
5555
5656
5757
async def main() -> None:
5858
# Disable parallel tool calls when using TeamTool
59-
model_client = OllamaChatCompletionClient(model="llama3.2")
59+
model_client = OpenAIChatCompletionClient(model="gpt-4.1")
6060
6161
writer = AssistantAgent(name="writer", model_client=model_client, system_message="You are a helpful assistant.")
6262
reviewer = AssistantAgent(
@@ -80,7 +80,7 @@ async def main() -> None:
8080
)
8181
8282
# Create model client with parallel tool calls disabled for the main agent
83-
main_model_client = OllamaChatCompletionClient(model="llama3.2", parallel_tool_calls=False)
83+
main_model_client = OpenAIChatCompletionClient(model="gpt-4.1", parallel_tool_calls=False)
8484
main_agent = AssistantAgent(
8585
name="main_agent",
8686
model_client=main_model_client,

python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ class OpenAIChatCompletionClient(BaseOpenAIChatCompletionClient, Component[OpenA
12361236
stop (optional, str | List[str]):
12371237
temperature (optional, float):
12381238
top_p (optional, float):
1239+
parallel_tool_calls (optional, bool): Whether to allow parallel tool calls. When not set, defaults to server behavior.
12391240
user (optional, str):
12401241
default_headers (optional, dict[str, str]): Custom headers; useful for authentication or other custom requirements.
12411242
add_name_prefixes (optional, bool): Whether to prepend the `source` value
@@ -1576,6 +1577,7 @@ class AzureOpenAIChatCompletionClient(
15761577
stop (optional, str | List[str]):
15771578
temperature (optional, float):
15781579
top_p (optional, float):
1580+
parallel_tool_calls (optional, bool): Whether to allow parallel tool calls. When not set, defaults to server behavior.
15791581
user (optional, str):
15801582
default_headers (optional, dict[str, str]): Custom headers; useful for authentication or other custom requirements.
15811583
add_name_prefixes (optional, bool): Whether to prepend the `source` value

python/packages/autogen-ext/src/autogen_ext/models/openai/config/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class CreateArguments(TypedDict, total=False):
4949
top_p: Optional[float]
5050
user: str
5151
stream_options: Optional[StreamOptions]
52+
parallel_tool_calls: Optional[bool]
5253

5354

5455
AsyncAzureADTokenProvider = Callable[[], Union[str, Awaitable[str]]]
@@ -97,6 +98,7 @@ class CreateArgumentsConfigModel(BaseModel):
9798
top_p: float | None = None
9899
user: str | None = None
99100
stream_options: StreamOptions | None = None
101+
parallel_tool_calls: bool | None = None
100102

101103

102104
class BaseOpenAIClientConfigurationConfigModel(CreateArgumentsConfigModel):

0 commit comments

Comments
 (0)