diff --git a/python/semantic_kernel/agents/open_ai/assistant_content_generation.py b/python/semantic_kernel/agents/open_ai/assistant_content_generation.py index 1c4a79f3e5eb..483586fedf02 100644 --- a/python/semantic_kernel/agents/open_ai/assistant_content_generation.py +++ b/python/semantic_kernel/agents/open_ai/assistant_content_generation.py @@ -216,7 +216,7 @@ def generate_function_call_content(agent_name: str, fccs: list[FunctionCallConte Returns: ChatMessageContent: The chat message content containing the function call content as the items. """ - return ChatMessageContent(role=AuthorRole.TOOL, name=agent_name, items=fccs) # type: ignore + return ChatMessageContent(role=AuthorRole.ASSISTANT, name=agent_name, items=fccs) # type: ignore @experimental_function diff --git a/python/tests/unit/agents/test_open_ai_assistant_base.py b/python/tests/unit/agents/test_open_ai_assistant_base.py index 411102270286..da982d23ae3f 100644 --- a/python/tests/unit/agents/test_open_ai_assistant_base.py +++ b/python/tests/unit/agents/test_open_ai_assistant_base.py @@ -1670,4 +1670,20 @@ def test_generate_options(azure_openai_assistant_agent: AzureAssistantAgent, ope assert options == expected_options, f"Expected {expected_options}, but got {options}" +def test_generate_function_call_content_sets_assistant_role(): + fcc1 = FunctionCallContent(name="function_name1", arguments={"input": "some input"}) + fcc2 = FunctionCallContent(name="function_name2", arguments={"input": "other input"}) + agent_name = "TestAgent" + + result = generate_function_call_content(agent_name=agent_name, fccs=[fcc1, fcc2]) + + assert result.role == AuthorRole.ASSISTANT + assert result.name == agent_name + assert len(result.items) == 2 + assert isinstance(result.items[0], FunctionCallContent) + assert isinstance(result.items[1], FunctionCallContent) + assert result.items[0].name == "function_name1" + assert result.items[1].name == "function_name2" + + # endregion