Skip to content

Conversation

git-jxj
Copy link
Contributor

@git-jxj git-jxj commented Sep 11, 2025

Summary

This PR fixes a PydanticSerializationUnexpectedValue warning that is raised when generating a benchmark report (e.g., in HTML format).

The warning Expected float - serialized value may not be as expected [input_value='p50', input_type=str] occurs because the percentile_rows method in the TabularDistributionSummary class has an incorrect return type hint.

The method generates a list of dictionaries, where each dictionary contains a string value for the 'percentile' key (e.g., 'p50') and a float value for the 'value' key. The type hint list[dict[str, float]] incorrectly stated that all dictionary values would be floats.

Details

Test Plan

guidellm benchmark run --target --output-path=benchmarks.html

Related Issues

#314

  • Resolves #

This fix corrects the type hint for the percentile_rows method to list[dict[str, Union[str, float]]], accurately describing the data being returned. This resolves the serialization warning from Pydantic without changing any runtime logic.

Before:
1 def percentile_rows(self) -> list[dict[str, float]]:
After:
1 def percentile_rows(self) -> list[dict[str, Union[str, float]]]:

  • "I certify that all code in this PR is my own, except as noted below."

Use of AI

  • Includes AI-assisted code completion
  • Includes code generated by an AI application
  • Includes AI-generated tests (NOTE: AI written tests should have a docstring that includes ## WRITTEN BY AI ##)

Copy link
Collaborator

@sjmonson sjmonson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but needs signoff

Signed-off-by: xinjun.jiang <[email protected]>
@git-jxj git-jxj force-pushed the fix-pydantic-report-warning branch from e8818d5 to 0bad7c4 Compare September 12, 2025 02:28
@sjmonson sjmonson merged commit f7731ec into vllm-project:main Sep 12, 2025
17 checks passed
@git-jxj git-jxj deleted the fix-pydantic-report-warning branch September 13, 2025 00:24
tukwila pushed a commit to tukwila/guidellm that referenced this pull request Sep 17, 2025
…rning (vllm-project#317)

## Summary

This PR fixes a PydanticSerializationUnexpectedValue warning that is
raised when generating a benchmark report (e.g., in HTML format).

The warning Expected float - serialized value may not be as expected
[input_value='p50', input_type=str] occurs because the percentile_rows
method in the TabularDistributionSummary class has an incorrect return
type hint.

The method generates a list of dictionaries, where each dictionary
contains a string value for the 'percentile' key (e.g., 'p50') and a
float value for the 'value' key. The type hint list[dict[str, float]]
incorrectly stated that all dictionary values would be floats.

## Details


## Test Plan

guidellm benchmark run --target <any-target>
--output-path=benchmarks.html

## Related Issues

vllm-project#314

- Resolves #

This fix corrects the type hint for the percentile_rows method to
list[dict[str, Union[str, float]]], accurately describing the data being
returned. This resolves the serialization warning from Pydantic without
changing any runtime logic.

  Before:
   1 def percentile_rows(self) -> list[dict[str, float]]:
  After:
   1 def percentile_rows(self) -> list[dict[str, Union[str, float]]]:

- [x] "I certify that all code in this PR is my own, except as noted
below."

## Use of AI

- [ ] Includes AI-assisted code completion
- [ ] Includes code generated by an AI application
- [ ] Includes AI-generated tests (NOTE: AI written tests should have a
docstring that includes `## WRITTEN BY AI ##`)

Signed-off-by: xinjun.jiang <[email protected]>
Co-authored-by: Samuel Monson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants