Skip to content

Commit

Permalink
ran poetry fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyydu committed Oct 31, 2024
1 parent 350544c commit c6a5f06
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
1 change: 1 addition & 0 deletions python/packages/ai/teams/ai/planners/assistants_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
24 changes: 6 additions & 18 deletions python/packages/ai/tests/ai/models/test_openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down

0 comments on commit c6a5f06

Please sign in to comment.