-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore: Fixup main pre commit #3204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ | |
|
|
||
|
|
||
| class TestConvertChatChoiceToResponseMessage: | ||
| @pytest.mark.asyncio | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how did this sneak in 🤔 |
||
| async def test_convert_string_content(self): | ||
| choice = OpenAIChoice( | ||
| message=OpenAIAssistantMessageParam(content="Test message"), | ||
|
|
@@ -61,7 +60,6 @@ async def test_convert_string_content(self): | |
| assert isinstance(result.content[0], OpenAIResponseOutputMessageContentOutputText) | ||
| assert result.content[0].text == "Test message" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_text_param_content(self): | ||
| choice = OpenAIChoice( | ||
| message=OpenAIAssistantMessageParam( | ||
|
|
@@ -78,12 +76,10 @@ async def test_convert_text_param_content(self): | |
|
|
||
|
|
||
| class TestConvertResponseContentToChatContent: | ||
| @pytest.mark.asyncio | ||
| async def test_convert_string_content(self): | ||
| result = await convert_response_content_to_chat_content("Simple string") | ||
| assert result == "Simple string" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_text_content_parts(self): | ||
| content = [ | ||
| OpenAIResponseInputMessageContentText(text="First part"), | ||
|
|
@@ -98,7 +94,6 @@ async def test_convert_text_content_parts(self): | |
| assert isinstance(result[1], OpenAIChatCompletionContentPartTextParam) | ||
| assert result[1].text == "Second part" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_image_content(self): | ||
| content = [OpenAIResponseInputMessageContentImage(image_url="https://example.com/image.jpg", detail="high")] | ||
|
|
||
|
|
@@ -111,15 +106,13 @@ async def test_convert_image_content(self): | |
|
|
||
|
|
||
| class TestConvertResponseInputToChatMessages: | ||
| @pytest.mark.asyncio | ||
| async def test_convert_string_input(self): | ||
| result = await convert_response_input_to_chat_messages("User message") | ||
|
|
||
| assert len(result) == 1 | ||
| assert isinstance(result[0], OpenAIUserMessageParam) | ||
| assert result[0].content == "User message" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_function_tool_call_output(self): | ||
| input_items = [ | ||
| OpenAIResponseInputFunctionToolCallOutput( | ||
|
|
@@ -135,7 +128,6 @@ async def test_convert_function_tool_call_output(self): | |
| assert result[0].content == "Tool output" | ||
| assert result[0].tool_call_id == "call_123" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_function_tool_call(self): | ||
| input_items = [ | ||
| OpenAIResponseOutputMessageFunctionToolCall( | ||
|
|
@@ -154,7 +146,6 @@ async def test_convert_function_tool_call(self): | |
| assert result[0].tool_calls[0].function.name == "test_function" | ||
| assert result[0].tool_calls[0].function.arguments == '{"param": "value"}' | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_response_message(self): | ||
| input_items = [ | ||
| OpenAIResponseMessage( | ||
|
|
@@ -173,22 +164,19 @@ async def test_convert_response_message(self): | |
|
|
||
|
|
||
| class TestConvertResponseTextToChatResponseFormat: | ||
| @pytest.mark.asyncio | ||
| async def test_convert_text_format(self): | ||
| text = OpenAIResponseText(format=OpenAIResponseTextFormat(type="text")) | ||
| result = await convert_response_text_to_chat_response_format(text) | ||
|
|
||
| assert isinstance(result, OpenAIResponseFormatText) | ||
| assert result.type == "text" | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_json_object_format(self): | ||
| text = OpenAIResponseText(format={"type": "json_object"}) | ||
| result = await convert_response_text_to_chat_response_format(text) | ||
|
|
||
| assert isinstance(result, OpenAIResponseFormatJSONObject) | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_convert_json_schema_format(self): | ||
| schema_def = {"type": "object", "properties": {"test": {"type": "string"}}} | ||
| text = OpenAIResponseText( | ||
|
|
@@ -204,7 +192,6 @@ async def test_convert_json_schema_format(self): | |
| assert result.json_schema["name"] == "test_schema" | ||
| assert result.json_schema["schema"] == schema_def | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_default_text_format(self): | ||
| text = OpenAIResponseText() | ||
| result = await convert_response_text_to_chat_response_format(text) | ||
|
|
@@ -214,27 +201,22 @@ async def test_default_text_format(self): | |
|
|
||
|
|
||
| class TestGetMessageTypeByRole: | ||
| @pytest.mark.asyncio | ||
| async def test_user_role(self): | ||
| result = await get_message_type_by_role("user") | ||
| assert result == OpenAIUserMessageParam | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_system_role(self): | ||
| result = await get_message_type_by_role("system") | ||
| assert result == OpenAISystemMessageParam | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_assistant_role(self): | ||
| result = await get_message_type_by_role("assistant") | ||
| assert result == OpenAIAssistantMessageParam | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_developer_role(self): | ||
| result = await get_message_type_by_role("developer") | ||
| assert result == OpenAIDeveloperMessageParam | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_unknown_role(self): | ||
| result = await get_message_type_by_role("unknown") | ||
| assert result is None | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franciscojavierarceo what's a better way to ensure prettier & next are available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should be sufficient.