Skip to content

Commit 6379f42

Browse files
jackcookmarkurtz
andauthored
Add backend_kwargs to generate_benchmark_report (#78)
This PR adds support for passing additional keyword arguments to the backend used in the `generate_benchmark_report` function. This allows us to use the already-implemented [`request_args` parameter](https://github.com/neuralmagic/guidellm/blob/ecf2984645202eea022cc7c9f245947e2dd5457d/src/guidellm/backend/openai.py#L37) on `OpenAIBackend`, which is needed in order to pass [custom headers/query params/etc](https://github.com/openai/openai-python/blob/3e69750d47df4f0759d4a28ddc68e4b38756d9ca/src/openai/resources/beta/chat/completions.py#L100) to OpenAI chat completion requests. --------- Co-authored-by: Mark Kurtz <mark.kurtz@neuralmagic.com>
1 parent 7f611a5 commit 6379f42

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/guidellm/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import Literal, Optional, Union, get_args
2+
from typing import Any, Literal, Mapping, Optional, Union, get_args
33

44
import click
55
from loguru import logger
@@ -197,6 +197,7 @@ def generate_benchmark_report(
197197
max_requests: Union[Literal["dataset"], int, None],
198198
output_path: str,
199199
cont_refresh_table: bool,
200+
backend_kwargs: Optional[Mapping[str, Any]] = None,
200201
) -> GuidanceReport:
201202
"""
202203
Generate a benchmark report for a specified backend and dataset.
@@ -218,6 +219,7 @@ def generate_benchmark_report(
218219
:param output_path: Path to save the output report file.
219220
:param cont_refresh_table: Continually refresh the table in the CLI
220221
until the user exits.
222+
:param backend_kwargs: Additional keyword arguments for the backend.
221223
"""
222224
logger.info(
223225
"Generating benchmark report with target: {}, backend: {}", target, backend
@@ -228,6 +230,7 @@ def generate_benchmark_report(
228230
backend_type=backend,
229231
target=target,
230232
model=model,
233+
**(backend_kwargs or {}),
231234
)
232235

233236
request_generator: RequestGenerator

0 commit comments

Comments
 (0)