Skip to content

Commit 7f244e2

Browse files
Move FunctionChoiceBehavior imports to top of test files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 47f4447 commit 7f244e2

4 files changed

Lines changed: 4 additions & 16 deletions

File tree

python/tests/unit/agents/azure_ai_agent/test_agent_thread_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from semantic_kernel.agents.azure_ai.agent_thread_actions import AgentThreadActions
2828
from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent
29+
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
2930
from semantic_kernel.contents import FunctionCallContent, FunctionResultContent, TextContent
3031
from semantic_kernel.contents.chat_message_content import ChatMessageContent
3132
from semantic_kernel.contents.utils.author_role import AuthorRole
@@ -362,7 +363,6 @@ async def test_agent_thread_actions_invoke_stream(ai_project_client, ai_agent_de
362363

363364
import pytest
364365

365-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
366366
from semantic_kernel.exceptions.agent_exceptions import AgentInvokeException
367367

368368

python/tests/unit/agents/azure_ai_agent/test_azure_ai_agent.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from semantic_kernel.agents.agent import AgentResponseItem
1010
from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent, AzureAIAgentThread
1111
from semantic_kernel.agents.channels.agent_channel import AgentChannel
12+
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
1213
from semantic_kernel.contents.chat_history import ChatHistory
1314
from semantic_kernel.contents.chat_message_content import ChatMessageContent
1415
from semantic_kernel.contents.function_call_content import FunctionCallContent
@@ -401,8 +402,6 @@ def test_create_client_raises_if_no_endpoint():
401402

402403

403404
async def test_azure_ai_agent_get_response_passes_function_choice_behavior(ai_project_client, ai_agent_definition):
404-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
405-
406405
agent = AzureAIAgent(client=ai_project_client, definition=ai_agent_definition)
407406
thread = AsyncMock(spec=AzureAIAgentThread)
408407
fcb = FunctionChoiceBehavior.Auto()
@@ -422,8 +421,6 @@ async def fake_invoke(*args, **kwargs):
422421

423422

424423
async def test_azure_ai_agent_invoke_passes_function_choice_behavior(ai_project_client, ai_agent_definition):
425-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
426-
427424
agent = AzureAIAgent(client=ai_project_client, definition=ai_agent_definition)
428425
thread = AsyncMock(spec=AzureAIAgentThread)
429426
fcb = FunctionChoiceBehavior.Auto()
@@ -444,8 +441,6 @@ async def fake_invoke(*args, **kwargs):
444441

445442

446443
async def test_azure_ai_agent_invoke_stream_passes_function_choice_behavior(ai_project_client, ai_agent_definition):
447-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
448-
449444
agent = AzureAIAgent(client=ai_project_client, definition=ai_agent_definition)
450445
thread = AsyncMock(spec=AzureAIAgentThread)
451446
fcb = FunctionChoiceBehavior.Auto()

python/tests/unit/agents/openai_assistant/test_assistant_thread_actions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from semantic_kernel.agents.open_ai.function_action_result import FunctionActionResult
5656
from semantic_kernel.agents.open_ai.openai_assistant_agent import OpenAIAssistantAgent
5757
from semantic_kernel.agents.open_ai.run_polling_options import RunPollingOptions
58+
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
5859
from semantic_kernel.contents.chat_message_content import ChatMessageContent
5960
from semantic_kernel.contents.file_reference_content import FileReferenceContent
6061
from semantic_kernel.contents.function_call_content import FunctionCallContent
@@ -858,9 +859,6 @@ async def test_handle_streaming_requires_action_returns_none():
858859
# region Security tests for tools override and function_choice_behavior
859860

860861

861-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
862-
863-
864862
async def test_validate_function_choice_behavior_rejects_required():
865863
"""Required FCB is not supported for agent invocations."""
866864
with pytest.raises(AgentInvokeException, match="not supported"):

python/tests/unit/agents/openai_assistant/test_openai_assistant_agent.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from semantic_kernel.agents import AgentRegistry, AgentResponseItem, OpenAIAssistantAgent
1111
from semantic_kernel.agents.open_ai.openai_assistant_agent import AssistantAgentThread
1212
from semantic_kernel.agents.open_ai.run_polling_options import RunPollingOptions
13+
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
1314
from semantic_kernel.contents.chat_history import ChatHistory
1415
from semantic_kernel.contents.chat_message_content import ChatMessageContent
1516
from semantic_kernel.contents.function_call_content import FunctionCallContent
@@ -502,8 +503,6 @@ async def test_openai_assistant_agent_from_yaml_invalid_type():
502503
async def test_openai_assistant_agent_get_response_passes_function_choice_behavior(
503504
openai_client, assistant_definition
504505
):
505-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
506-
507506
agent = OpenAIAssistantAgent(client=openai_client, definition=assistant_definition)
508507
thread = AsyncMock(spec=AssistantAgentThread)
509508
fcb = FunctionChoiceBehavior.Auto()
@@ -523,8 +522,6 @@ async def fake_invoke(*args, **kwargs):
523522

524523

525524
async def test_openai_assistant_agent_invoke_passes_function_choice_behavior(openai_client, assistant_definition):
526-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
527-
528525
agent = OpenAIAssistantAgent(client=openai_client, definition=assistant_definition)
529526
thread = AsyncMock(spec=AssistantAgentThread)
530527
fcb = FunctionChoiceBehavior.Auto()
@@ -547,8 +544,6 @@ async def fake_invoke(*args, **kwargs):
547544
async def test_openai_assistant_agent_invoke_stream_passes_function_choice_behavior(
548545
openai_client, assistant_definition
549546
):
550-
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
551-
552547
agent = OpenAIAssistantAgent(client=openai_client, definition=assistant_definition)
553548
thread = AsyncMock(spec=AssistantAgentThread)
554549
fcb = FunctionChoiceBehavior.Auto()

0 commit comments

Comments
 (0)