Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
novaturient95 committed Sep 17, 2024
1 parent 5dd1e8f commit abb1b75
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ requests>=2.28.1
tiktoken>=0.3.3
StrEnum>=0.4.15
pyDispatcher>=2.0.7
setuptools>=72.1.0

# batch_score requirements
-r ../src/batch_score_oss/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
(f"{constants.BATCH_SCORE_USER_AGENT}:{TEST_COMPONENT_VERSION}"
f"/Run:{TEST_RUN_ID}",
None),
(f"{constants.BATCH_SCORE_USER_AGENT}:{TEST_COMPONENT_VERSION}/Run:{TEST_RUN_ID}/{TEST_UA_SEGMENT}", TEST_UA_SEGMENT),
(f"{constants.BATCH_SCORE_USER_AGENT}:{TEST_COMPONENT_VERSION}/Run:{TEST_RUN_ID}/{TEST_UA_SEGMENT}",
TEST_UA_SEGMENT),
(f"{constants.BATCH_SCORE_USER_AGENT}:{TEST_COMPONENT_VERSION}/Run:{TEST_RUN_ID}", None),
])
def test_get_headers(expected_user_agent_string, user_agent_segment):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,46 @@ def test_get_input_type():
"""Test input type detection."""
assert InputTypeModifier.get_input_type(request_obj={"messages": []}) == InputType.Unknown
assert InputTypeModifier.get_input_type(request_obj={"no_messages": []}) == InputType.Unknown
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": "just text"}, {"content": [{"type": "text"}]}]}) == InputType.TextOnly
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": [{"type": "image"}, "just text"]}, {"content": [{"type": "text"}]}]}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": "just text"}, {"content": [{"type": "text"}]}, {"content": [{"type": "image"}]}]}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": [{"type": "image_url"}, "just text"]}, {"content": [{"type": "text"}]}]}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": "just text"}, {"content": [{"type": "text"}]}, {"content": [{"type": "image_url"}]}]}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": [{"type": "image"}]}, {"content": [{"type": "image_url"}]}]}) == InputType.Image
assert InputTypeModifier.get_input_type(request_obj={"messages": [{"content": [{"type": "image"}, {"type": "image_url"}]}]}) == InputType.Image
assert InputTypeModifier.get_input_type(request_obj={
"messages": [{"content": "just text"}, {"content": [{"type": "text"}]}]
}) == InputType.TextOnly
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": [{"type": "image"}, "just text"]},
{"content": [{"type": "text"}]}
]
}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": "just text"},
{"content": [{"type": "text"}]},
{"content": [{"type": "image"}]}
]
}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": [{"type": "image_url"}, "just text"]},
{"content": [{"type": "text"}]}
]
}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": "just text"},
{"content": [{"type": "text"}]},
{"content": [{"type": "image_url"}]}
]
}) == InputType.ImageAndText
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": [{"type": "image"}]},
{"content": [{"type": "image_url"}]}
]
}) == InputType.Image
assert InputTypeModifier.get_input_type(request_obj={
"messages": [
{"content": [{"type": "image"}, {"type": "image_url"}]}
]
}) == InputType.Image


def test_modify():
Expand Down

0 comments on commit abb1b75

Please sign in to comment.