Skip to content

Commit

Permalink
Fix re-rankings payload schema for NIMs (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyastremsky authored Dec 16, 2024
1 parent 7db2604 commit bc5220e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
6 changes: 2 additions & 4 deletions genai-perf/genai_perf/inputs/converters/rankings_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ def convert(
passages = passage_entry.texts
payload = {"query": query, "texts": passages}
else:
passages = [
{"text_input": p} for p in passage_entry.texts if p is not None
]
passages = [{"text": p} for p in passage_entry.texts if p is not None]
payload = {
"query": query,
"query": {"text": query},
"passages": passages,
"model": model_name,
}
Expand Down
36 changes: 18 additions & 18 deletions genai-perf/tests/test_rankings_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def test_convert_default(self):
{
"payload": [
{
"query": "query 1",
"query": {"text": "query 1"},
"passages": [
{"text_input": "passage 1"},
{"text_input": "passage 2"},
{"text": "passage 1"},
{"text": "passage 2"},
],
"model": "test_model",
}
Expand All @@ -93,10 +93,10 @@ def test_convert_default(self):
{
"payload": [
{
"query": "query 2",
"query": {"text": "query 2"},
"passages": [
{"text_input": "passage 3"},
{"text_input": "passage 4"},
{"text": "passage 3"},
{"text": "passage 4"},
],
"model": "test_model",
}
Expand Down Expand Up @@ -135,10 +135,10 @@ def test_convert_with_request_parameters(self):
{
"payload": [
{
"query": "query 1",
"query": {"text": "query 1"},
"passages": [
{"text_input": "passage 1"},
{"text_input": "passage 2"},
{"text": "passage 1"},
{"text": "passage 2"},
],
"model": "test_model",
"encoding_format": "base64",
Expand All @@ -150,10 +150,10 @@ def test_convert_with_request_parameters(self):
{
"payload": [
{
"query": "query 2",
"query": {"text": "query 2"},
"passages": [
{"text_input": "passage 3"},
{"text_input": "passage 4"},
{"text": "passage 3"},
{"text": "passage 4"},
],
"model": "test_model",
"encoding_format": "base64",
Expand Down Expand Up @@ -266,17 +266,17 @@ def test_convert_missing_files(self, queries_data, passages_data, expected_error
{
"payload": [
{
"query": "query 1",
"passages": [{"text_input": "passage 1"}],
"query": {"text": "query 1"},
"passages": [{"text": "passage 1"}],
"model": "test_model",
}
]
},
{
"payload": [
{
"query": "query 2",
"passages": [{"text_input": "passage 2"}],
"query": {"text": "query 2"},
"passages": [{"text": "passage 2"}],
"model": "test_model",
}
]
Expand All @@ -293,8 +293,8 @@ def test_convert_missing_files(self, queries_data, passages_data, expected_error
{
"payload": [
{
"query": "query 1",
"passages": [{"text_input": "passage 1"}],
"query": {"text": "query 1"},
"passages": [{"text": "passage 1"}],
"model": "test_model",
}
]
Expand Down

0 comments on commit bc5220e

Please sign in to comment.