Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nemo_deploy/llm/query_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def query_llm(
inputs = {"prompts": prompts}

if min_output_len is not None:
inputs["min_output_len"] = np.full(prompts.shape, max_output_len, dtype=np.int_)
inputs["min_output_len"] = np.full(prompts.shape, min_output_len, dtype=np.int_)

if max_output_len is not None:
inputs["max_output_len"] = np.full(prompts.shape, max_output_len, dtype=np.int_)
Expand Down
5 changes: 4 additions & 1 deletion tests/unit_tests/deploy/test_query_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,14 @@ def test_query_llm_with_min_output_len(self, mock_client, query):
mock_instance.infer_batch.return_value = {"outputs": np.array([b"test response"])}
mock_instance.model_config.outputs = [MagicMock(dtype=np.bytes_)]

# Test query with min_output_len
# Test query with min_output_len distinct from max_output_len
response = query.query_llm(prompts=["test prompt"], min_output_len=10, max_output_len=100)

assert isinstance(response[0], str)
assert response[0] == "test response"
call_kwargs = mock_instance.infer_batch.call_args.kwargs
assert call_kwargs["min_output_len"][0] == 10
assert call_kwargs["max_output_len"][0] == 100

@patch("nemo_deploy.llm.query_llm.ModelClient")
def test_query_llm_with_logits_output(self, mock_client, query):
Expand Down
Loading