diff --git a/python/packages/ai/teams/ai/planners/assistants_planner.py b/python/packages/ai/teams/ai/planners/assistants_planner.py index 057d6de46..877490114 100644 --- a/python/packages/ai/teams/ai/planners/assistants_planner.py +++ b/python/packages/ai/teams/ai/planners/assistants_planner.py @@ -49,6 +49,7 @@ class AzureOpenAIAssistantsOptions: """ Options for configuring the AssistantsPlanner for AzureOpenAI. """ + default_model: str "Default name of the Azure OpenAI deployment (model) to use." diff --git a/python/packages/ai/tests/ai/models/test_openai_model.py b/python/packages/ai/tests/ai/models/test_openai_model.py index f385d6485..0cf3525ed 100644 --- a/python/packages/ai/tests/ai/models/test_openai_model.py +++ b/python/packages/ai/tests/ai/models/test_openai_model.py @@ -102,9 +102,7 @@ class MockAsyncCompletions: has_tool_calls = False create_params = None - def __init__( - self, should_error=False, has_tool_call=False, has_tool_calls=False - ) -> None: + def __init__(self, should_error=False, has_tool_call=False, has_tool_calls=False) -> None: self.should_error = should_error self.has_tool_call = has_tool_call self.has_tool_calls = has_tool_calls @@ -315,9 +313,7 @@ async def test_o1_model_should_use_user_message_over_system_message(self, mock_a self.assertTrue(mock_async_openai.called) self.assertEqual(res.status, "success") create_params = mock_async_openai.return_value.chat.completions.create_params - self.assertEqual( - create_params["messages"][0]["role"], "user" - ) + self.assertEqual(create_params["messages"][0]["role"], "user") @mock.patch("openai.AsyncOpenAI", return_value=MockAsyncOpenAI) async def test_o1_model_should_use_max_completion_tokens_param(self, mock_async_openai): @@ -348,12 +344,8 @@ async def test_o1_model_should_use_max_completion_tokens_param(self, mock_async_ self.assertTrue(mock_async_openai.called) self.assertEqual(res.status, "success") create_params = mock_async_openai.return_value.chat.completions.create_params - self.assertEqual( - create_params["max_completion_tokens"], 1000 - ) - self.assertEqual( - create_params["max_tokens"], openai.NOT_GIVEN - ) + self.assertEqual(create_params["max_completion_tokens"], 1000) + self.assertEqual(create_params["max_tokens"], openai.NOT_GIVEN) @mock.patch("openai.AsyncOpenAI", return_value=MockAsyncOpenAI) async def test_non_o1_model_should_use_max_tokens_param(self, mock_async_openai): @@ -384,12 +376,8 @@ async def test_non_o1_model_should_use_max_tokens_param(self, mock_async_openai) self.assertTrue(mock_async_openai.called) self.assertEqual(res.status, "success") create_params = mock_async_openai.return_value.chat.completions.create_params - self.assertEqual( - create_params["max_tokens"], 1000 - ) - self.assertEqual( - create_params["max_completion_tokens"], openai.NOT_GIVEN - ) + self.assertEqual(create_params["max_tokens"], 1000) + self.assertEqual(create_params["max_completion_tokens"], openai.NOT_GIVEN) @mock.patch("openai.AsyncOpenAI", return_value=MockAsyncOpenAI) async def test_should_succeed_on_prev_tool_calls(self, mock_async_openai): diff --git a/python/packages/ai/tests/ai/planners/test_assistants_planner.py b/python/packages/ai/tests/ai/planners/test_assistants_planner.py index 94d020f50..118f8b62a 100644 --- a/python/packages/ai/tests/ai/planners/test_assistants_planner.py +++ b/python/packages/ai/tests/ai/planners/test_assistants_planner.py @@ -565,7 +565,7 @@ async def test_create_openai_assistant(self, mock_async_openai): api_version="", organization="", endpoint="", - request=params + request=params, ) self.assertTrue(mock_async_openai.called) @@ -588,9 +588,11 @@ async def test_create_azure_openai_assistant(self, mock_async_azure_openai): self.assertTrue(mock_async_azure_openai.called) self.assertEqual(assistant.id, ASSISTANT_ID) self.assertEqual(assistant.model, ASSISTANT_MODEL) - + @mock.patch("openai.AsyncAzureOpenAI", return_value=MockAsyncOpenAI()) - async def test_create_azure_openai_assistant_with_az_token_provider(self, mock_async_azure_openai): + async def test_create_azure_openai_assistant_with_az_token_provider( + self, mock_async_azure_openai + ): params = beta.AssistantCreateParams(model="123") assistant = await AssistantsPlanner.create_assistant(