Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
singhk97 committed Oct 21, 2024
1 parent adbec0e commit 5440ac8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
25 changes: 12 additions & 13 deletions python/packages/ai/teams/ai/models/openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,20 @@ class OpenAIModel(PromptCompletionModel):
The model has been updated to support calling OpenAI's new o1 family of models. That currently
comes with a few constraints. These constraints are mostly handled for you but are worth noting:
- The o1 models introduce a new `max_completion_tokens` parameter and they've deprecated the
`max_tokens` parameter. The model will automatically convert the incoming `max_tokens` parameter
to `max_completion_tokens` for you. But you should be aware that o1 has hidden token usage and costs
that aren't constrained by the `max_completion_tokens` parameter. This means that you may see an
increase in token usage and costs when using the o1 models.
- The o1 models introduce a new `max_completion_tokens` parameter and they've deprecated
the `max_tokens` parameter. The model will automatically convert the incoming `max_tokens
` parameter to `max_completion_tokens` for you. But you should be aware that o1 has hidden
token usage and costs that aren't constrained by the `max_completion_tokens` parameter.
This means that you may see an increase in token usage and costs when using the o1 models.
- The o1 models do not currently support the sending of system message so the model will map them to user message
in this case.
- The o1 models do not currently support the sending of system message so the model will
map them to user message in this case.
- The o1 models do not currently support setting the `temperature`, `top_p`, and `presence_penalty`
parameters so they will be ignored.
- The o1 models do not currently support setting the `temperature`, `top_p`, and
`presence_penalty` parameters so they will be ignored.
- The o1 models do not currently support the use of tools so you will need to use the "monologue"
augmentation to call actions.
- The o1 models do not currently support the use of tools so you will need to use the
"monologue" augmentation to call actions.
"""

_options: Union[OpenAIModelOptions, AzureOpenAIModelOptions]
Expand Down Expand Up @@ -294,8 +294,7 @@ async def complete_prompt(

# Handle tools flow
action_calls = []
response_message = completion.choices[0].message
tool_calls = response_message.tool_calls
tool_calls = completion.choices[0].message.tool_calls

if is_tools_aug and tool_calls:
for curr_tool_call in tool_calls:
Expand Down
4 changes: 3 additions & 1 deletion python/packages/ai/tests/ai/models/test_openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ 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")
self.assertEqual(mock_async_openai.return_value.chat.completions.messages[0]["role"], "user")
self.assertEqual(
mock_async_openai.return_value.chat.completions.messages[0]["role"], "user"
)

@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 @@ -73,7 +73,7 @@ async def create(
"sexual/minors": ["text"],
"violence": ["text"],
"violence/graphic": ["text"],
}
},
),
categories=cast(
openai.types.moderation.Categories,
Expand Down

0 comments on commit 5440ac8

Please sign in to comment.