Skip to content
Draft
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
33 changes: 14 additions & 19 deletions src/guidellm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,13 @@ def benchmark():
# Data configuration
@click.option(
"--request-type",
default=BenchmarkGenerativeTextArgs.get_default("data_request_formatter"),
default=BenchmarkGenerativeTextArgs.get_default("request_type"),
type=click.Choice(list(get_literal_vals(GenerativeRequestType))),
help=(
f"Request type to create for each data sample. "
f"Options: {', '.join(get_literal_vals(GenerativeRequestType))}."
),
)
@click.option(
"--request-formatter-kwargs",
default=None,
callback=cli_tools.parse_json,
help="JSON string of arguments to pass to the request formatter.",
)
@click.option(
"--processor",
default=BenchmarkGenerativeTextArgs.get_default("processor"),
Expand Down Expand Up @@ -230,6 +224,19 @@ def benchmark():
callback=cli_tools.parse_json,
help="JSON string of column mappings to apply to the dataset.",
)
@click.option(
"--data-preprocessors",
default=BenchmarkGenerativeTextArgs.get_default("data_preprocessors"),
callback=cli_tools.parse_json,
multiple=True,
help="JSON string of preprocessors to apply to the dataset.",
)
@click.option(
"--data-finalizer",
default=BenchmarkGenerativeTextArgs.get_default("data_finalizer"),
callback=cli_tools.parse_json,
help="JSON string of finalizer to convert dataset rows to requests.",
)
@click.option(
"--data-sampler",
default=BenchmarkGenerativeTextArgs.get_default("data_sampler"),
Expand Down Expand Up @@ -408,18 +415,6 @@ def run(**kwargs): # noqa: C901
# Only set CLI args that differ from click defaults
kwargs = cli_tools.set_if_not_default(click.get_current_context(), **kwargs)

# Handle remapping for request params
request_type = kwargs.pop("request_type", None)
request_formatter_kwargs = kwargs.pop("request_formatter_kwargs", None)
if request_type is not None:
kwargs["data_request_formatter"] = (
request_type
if not request_formatter_kwargs
else {"request_type": request_type, **request_formatter_kwargs}
)
elif request_formatter_kwargs is not None:
kwargs["data_request_formatter"] = request_formatter_kwargs

# Handle output path remapping
if (output_path := kwargs.pop("output_path", None)) is not None:
if kwargs.get("outputs_dir", None) is not None:
Expand Down
6 changes: 2 additions & 4 deletions src/guidellm/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
handlers for processing streaming and non-streaming API responses.
"""

from __future__ import annotations

from .backend import Backend, BackendType
from .openai import OpenAIHTTPBackend
from .response_handlers import (
from .openai import (
AudioResponseHandler,
ChatCompletionsResponseHandler,
GenerationResponseHandler,
GenerationResponseHandlerFactory,
OpenAIHTTPBackend,
TextCompletionsResponseHandler,
)

Expand Down
17 changes: 17 additions & 0 deletions src/guidellm/backends/openai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .openai import OpenAIHTTPBackend
from .response_handlers import (
AudioResponseHandler,
ChatCompletionsResponseHandler,
GenerationResponseHandler,
GenerationResponseHandlerFactory,
TextCompletionsResponseHandler,
)

__all__ = [
"AudioResponseHandler",
"ChatCompletionsResponseHandler",
"GenerationResponseHandler",
"GenerationResponseHandlerFactory",
"OpenAIHTTPBackend",
"TextCompletionsResponseHandler",
]
Loading
Loading