Skip to content

Commit

Permalink
fixes for handling OutputFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
mwawrzos committed Jul 4, 2024
1 parent f0a87f0 commit 60b658a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def _get_profile_metadata(self, data: dict) -> None:
self._service_kind = data["service_kind"]
if self._service_kind == "openai":
if data["endpoint"] == "v1/chat/completions":
self._response_format = ResponseFormat.OPENAI_CHAT_COMPLETIONS
self._response_format = (
ResponseFormat.OPENAI_VISION
if self.output_format == OutputFormat.OPENAI_VISION
else ResponseFormat.OPENAI_CHAT_COMPLETIONS
)
elif data["endpoint"] == "v1/completions":
self._response_format = ResponseFormat.OPENAI_COMPLETIONS
elif data["endpoint"] == "v1/embeddings":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import pytest
from genai_perf.metrics import Metrics
from genai_perf.profile_data_parser import ProfileDataParser
from genai_perf.llm_inputs.llm_inputs import OutputFormat


def ns_to_sec(ns: int) -> Union[int, float]:
Expand Down Expand Up @@ -132,7 +133,7 @@ def test_embedding_profile_data(self, mock_read_write: pytest.MonkeyPatch) -> No
* request throughputs
- [2 / (5e-9 - 1e-9)] = [5e8]
"""
pd = ProfileDataParser(filename=Path("embedding_profile_export.json"))
pd = ProfileDataParser(filename=Path("embedding_profile_export.json"), output_format=OutputFormat.OPENAI_EMBEDDINGS)

# experiment 1 statistics
stats = pd.get_statistics(infer_mode="concurrency", load_level="10")
Expand Down Expand Up @@ -202,7 +203,7 @@ def test_ranking_profile_data(self, mock_read_write: pytest.MonkeyPatch) -> None
* request throughputs
- [2 / (5e-9 - 1e-9)] = [5e8]
"""
pd = ProfileDataParser(filename=Path("ranking_profile_export.json"))
pd = ProfileDataParser(filename=Path("ranking_profile_export.json"), output_format=OutputFormat.RANKINGS)

# experiment 1 statistics
stats = pd.get_statistics(infer_mode="concurrency", load_level="10")
Expand Down

0 comments on commit 60b658a

Please sign in to comment.