Skip to content

Commit

Permalink
Clean up references to IMAGE_RETRIEVAL in openai_chat_completions_con…
Browse files Browse the repository at this point in the history
…verter.py and associated unit tests
  • Loading branch information
djwhatle committed Nov 14, 2024
1 parent 8aecdab commit 6d4cfff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@
class OpenAIChatCompletionsConverter(BaseConverter):

def check_config(self, config: InputsConfig) -> None:
if config.output_format == OutputFormat.IMAGE_RETRIEVAL:
if config.add_stream:
raise GenAIPerfException(
f"The --streaming option is not supported for {config.output_format.to_lowercase()}."
)
elif (
if (
config.output_format == OutputFormat.OPENAI_CHAT_COMPLETIONS
or config.output_format == OutputFormat.OPENAI_VISION
):
Expand Down Expand Up @@ -96,10 +91,7 @@ def _retrieve_content(
content: Union[str, List[Dict[Any, Any]]] = ""
if config.output_format == OutputFormat.OPENAI_CHAT_COMPLETIONS:
content = row.texts[0]
elif (
config.output_format == OutputFormat.OPENAI_VISION
or config.output_format == OutputFormat.IMAGE_RETRIEVAL
):
elif config.output_format == OutputFormat.OPENAI_VISION:
content = self._add_multi_modal_content(row)
else:
raise GenAIPerfException(
Expand Down
18 changes: 13 additions & 5 deletions genai-perf/tests/test_openai_chat_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,31 @@ def test_convert_with_request_parameters(self):
),
(
[
{"image": "test_image_1"},
{"image": "test_image_2"},
{"text": "test input A", "image": "test_image_A1"},
{"text": "test input B", "image": "test_image_B2"},
],
OutputFormat.IMAGE_RETRIEVAL,
OutputFormat.OPENAI_VISION,
[
{
"type": "text",
"text": "test input A",
},
{
"type": "image_url",
"image_url": {
"url": "test_image_1",
"url": "test_image_A1",
},
},
],
[
{
"type": "text",
"text": "test input B",
},
{
"type": "image_url",
"image_url": {
"url": "test_image_2",
"url": "test_image_B2",
},
},
],
Expand Down

0 comments on commit 6d4cfff

Please sign in to comment.