guidellm.schemas
Pydantic schema models for GuideLLM operations.
Provides standardized data models and type definitions for generation requests, responses, timing measurements, and statistics aggregation. These schemas ensure type safety and consistent data handling across the benchmarking pipeline, from request submission through backend processing to results compilation.
DistributionSummary
Bases: StandardBaseModel
Comprehensive statistical summary of a probability distribution.
Captures central tendency (mean, median, mode), spread (variance, std_dev), extrema (min, max), and percentile information with optional probability density function. Supports creation from raw values, PDFs, or time-based event data for rate and concurrency analysis in benchmark metrics.
Source code in src/guidellm/schemas/statistics.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
concurrency_distribution_from_timings(event_intervals, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create concurrency distribution from event time intervals.
Tracks overlapping events to compute concurrency levels over time for analyzing request processing patterns and resource utilization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_intervals | Sequence[tuple[float, float] | tuple[float, float, float]] | ndarray | Event (start, end) or (start, end, weight) tuples | required |
start_time | float | None | Analysis window start | None |
end_time | float | None | Analysis window end | None |
threshold | float | None | Time threshold for merging nearby transitions; 1/10th millisecond | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
DistributionSummary | Distribution summary of concurrency levels over time |
Source code in src/guidellm/schemas/statistics.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | |
from_pdf(pdf, count=None, include_pdf=False, epsilon=1e-06, validate=True) classmethod
Create distribution summary from a probability density function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pdf | ndarray | 2D array (N, 2) with values in column 0 and probabilities in column 1 | required |
count | int | None | Number of original observations; defaults to PDF length | None |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
validate | bool | Whether to validate probabilities sum to 1 and are non-negative | True |
Returns:
| Type | Description |
|---|---|
DistributionSummary | Complete distribution summary with statistics |
Raises:
| Type | Description |
|---|---|
ValueError | If PDF shape is invalid or probabilities are invalid |
Source code in src/guidellm/schemas/statistics.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
from_values(values, count=None, include_pdf=False, epsilon=1e-06) classmethod
Create distribution summary from raw values with optional weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values | Sequence[float | tuple[float, float]] | ndarray | Values or (value, weight) tuples, or numpy array | required |
count | int | None | Number of original observations; defaults to sum of weights | None |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
DistributionSummary | Distribution summary computed from the values |
Raises:
| Type | Description |
|---|---|
ValueError | If total weight is zero or invalid |
Source code in src/guidellm/schemas/statistics.py
rate_distribution_from_timings(event_times, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create rate distribution from event timestamps.
Computes event rates over time intervals weighted by interval duration for analyzing request throughput patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_times | Sequence[float | tuple[float, float]] | ndarray | Event timestamps or (timestamp, weight) tuples | required |
start_time | float | None | Analysis window start; filters earlier events | None |
end_time | float | None | Analysis window end; filters later events | None |
threshold | float | None | Time threshold for merging nearby events; 1/10th millisecond | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
DistributionSummary | Distribution summary of event rates over time |
Source code in src/guidellm/schemas/statistics.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
GenerationRequest
Bases: StandardBaseModel
Complete request specification for backend generation operations.
Encapsulates all components needed to execute a generation request including unique identification, request type specification, HTTP arguments, and input/output usage metrics. Serves as the primary interface between the scheduler and backend services for coordinating AI generation tasks.
Example:: request = GenerationRequest( arguments=GenerationRequestArguments( method="POST", body={"prompt": "Hello world", "max_tokens": 100} ) )
Source code in src/guidellm/schemas/request.py
GenerationRequestArguments
Bases: StandardBaseDict
HTTP request arguments for generation operations.
Encapsulates all necessary HTTP request components including method, headers, parameters, and payload data required to execute generation requests against backend services. Supports file uploads and streaming responses.
Source code in src/guidellm/schemas/request.py
model_combine(additional)
Merge additional request arguments into the current instance.
Combines method and stream fields by overwriting, while merging collection fields like headers, params, body, and files by extending existing values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
additional | GenerationRequestArguments | dict[str, Any] | Additional arguments to merge with current instance | required |
Returns:
| Type | Description |
|---|---|
GenerationRequestArguments | Updated instance with merged arguments |
Source code in src/guidellm/schemas/request.py
GenerationResponse
Bases: StandardBaseModel
Response model for backend generation operations.
Captures the output and metrics from a generation request, providing structured data for text output, tool call payloads, token usage statistics, and compilation of detailed request statistics for analysis and monitoring purposes.
Example: :: response = GenerationResponse( request_id="req-123", text="Generated response text", input_metrics=UsageMetrics(token_count=50), output_metrics=UsageMetrics(token_count=25) ) stats = response.compile_stats(request, info)
Source code in src/guidellm/schemas/response.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
compile_stats(request, info, prefer_response=True)
Compile and return comprehensive request statistics.
Merges metrics from the request and response objects to create a complete statistical record, with preference given to response-level metrics when available to ensure accuracy of actual execution data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request | GenerationRequest | The original generation request containing input data | required |
info | RequestInfo | Metadata and timing information for the request execution | required |
prefer_response | bool | Whether to prefer response metrics over request metrics when both are available | True |
Returns:
| Type | Description |
|---|---|
GenerativeRequestStats | A GenerativeRequestStats object containing detailed statistics |
Raises:
| Type | Description |
|---|---|
ValueError | When request IDs don't match between objects |
Source code in src/guidellm/schemas/response.py
GenerativeRequestStats
Bases: StandardBaseDict
Request statistics for generative AI text generation workloads.
Captures comprehensive performance metrics for individual generative requests, including token counts, timing measurements, and derived performance statistics. Provides computed properties for latency analysis, throughput calculations, and token generation metrics essential for benchmark evaluation.
Example: :: stats = GenerativeRequestStats( request_id="req_123", info=request_info, input_metrics=input_usage, output_metrics=output_usage ) throughput = stats.output_tokens_per_second
Source code in src/guidellm/schemas/request_stats.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
first_output_token_iteration property
Returns:
| Type | Description |
|---|---|
float | None | Timestamp of first token generation, or None if unavailable |
first_token_iteration property
Returns:
| Type | Description |
|---|---|
float | None | Timestamp of first token generation, or None if unavailable |
inter_token_latency_ms property
Average inter-token latency in milliseconds excluding first token.
Returns:
| Type | Description |
|---|---|
float | None | Average milliseconds between token generations, or None if unavailable |
iter_tokens_per_iteration property
Returns:
| Type | Description |
|---|---|
float | None | Average tokens per iteration excluding first token, or None if unavailable |
iter_tokens_timings property
Returns:
| Type | Description |
|---|---|
list[tuple[float, float]] | List of (timestamp, token_count) tuples for iterations excluding first token |
last_token_iteration property
Returns:
| Type | Description |
|---|---|
float | None | Timestamp of last token generation, or None if unavailable |
output_tokens property
Returns:
| Type | Description |
|---|---|
int | None | Number of tokens in the generated output, or None if unavailable |
output_tokens_per_iteration property
Returns:
| Type | Description |
|---|---|
float | None | Average output tokens per iteration, or None if unavailable |
output_tokens_per_second property
Returns:
| Type | Description |
|---|---|
float | None | Output token generation throughput, or None if unavailable |
output_tokens_timings property
Returns:
| Type | Description |
|---|---|
list[tuple[float, float]] | List of (timestamp, token_count) tuples for output token generations |
Raises:
| Type | Description |
|---|---|
ValueError | If resolve_end timings are not set |
prompt_tokens property
Returns:
| Type | Description |
|---|---|
int | None | Number of tokens in the input prompt, or None if unavailable |
prompt_tokens_timing property
Returns:
| Type | Description |
|---|---|
tuple[float, float] | Tuple of (timestamp, token_count) for prompt processing |
Raises:
| Type | Description |
|---|---|
ValueError | If resolve_end timings are not set |
request_end_time property
Returns:
| Type | Description |
|---|---|
float | Timestamp when the request ended, or None if unavailable |
request_latency property
End-to-end request processing latency in seconds.
Returns:
| Type | Description |
|---|---|
float | None | Duration from request start to completion, or None if unavailable |
request_start_time property
Returns:
| Type | Description |
|---|---|
float | None | Timestamp when the request started, or None if unavailable |
time_per_output_token_ms property
Average time per output token in milliseconds including first token.
Returns:
| Type | Description |
|---|---|
float | None | Average milliseconds per output token, or None if unavailable |
time_to_first_output_token_ms property
Time to first content (non-reasoning) token in milliseconds.
When no reasoning tokens are emitted this equals TTFT.
Returns:
| Type | Description |
|---|---|
float | None | Milliseconds from request start to first content token, or None if unavailable |
time_to_first_token_ms property
Returns:
| Type | Description |
|---|---|
float | None | Time to first token generation in milliseconds, or None if unavailable |
token_iterations property
Returns:
| Type | Description |
|---|---|
int | Total number of token generation iterations |
tokens_per_second property
Returns:
| Type | Description |
|---|---|
float | None | Total tokens per second throughput, or None if unavailable |
total_tokens property
Returns:
| Type | Description |
|---|---|
int | None | Sum of prompt and output tokens, or None if both unavailable |
total_tokens_timings property
Returns:
| Type | Description |
|---|---|
list[tuple[float, float]] | List of (timestamp, token_count) tuples for all token generations |
Percentiles
Bases: StandardBaseModel
Standard percentile values for probability distributions.
Captures key percentile points from 0.1th to 99.9th percentile for comprehensive distribution analysis, enabling assessment of central tendency, spread, and tail behavior in benchmark metrics.
Source code in src/guidellm/schemas/statistics.py
from_pdf(pdf, epsilon=1e-06, validate=True) classmethod
Create percentiles from a probability density function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pdf | ndarray | 2D array (N, 2) with values in column 0 and probabilities in column 1 | required |
epsilon | float | Tolerance for probability sum validation | 1e-06 |
validate | bool | Whether to validate probabilities sum to 1 and are non-negative | True |
Returns:
| Type | Description |
|---|---|
Percentiles | Percentiles object with computed values |
Raises:
| Type | Description |
|---|---|
ValueError | If PDF shape is invalid, probabilities are negative, or probabilities don't sum to 1 |
Source code in src/guidellm/schemas/statistics.py
PydanticClassRegistryMixin
Bases: ReloadableBaseModel, RegistryMixin[type[BaseModelT]], ABC, Generic[BaseModelT]
Polymorphic Pydantic model mixin enabling registry-based dynamic instantiation.
Integrates Pydantic validation with the registry system to enable polymorphic serialization and deserialization based on a discriminator field. Automatically instantiates the correct subclass during validation based on registry mappings, providing a foundation for extensible plugin-style architectures.
Example: :: from speculators.utils import PydanticClassRegistryMixin
class BaseConfig(PydanticClassRegistryMixin["BaseConfig"]):
schema_discriminator: ClassVar[str] = "config_type"
config_type: str = Field(description="Configuration type identifier")
@classmethod
def __pydantic_schema_base_type__(cls) -> type["BaseConfig"]:
return BaseConfig
@BaseConfig.register("database")
class DatabaseConfig(BaseConfig):
config_type: str = "database"
connection_string: str = Field(description="Database connection string")
# Dynamic instantiation based on discriminator
config = BaseConfig.model_validate({
"config_type": "database",
"connection_string": "postgresql://localhost:5432/db"
})
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name used for polymorphic type discrimination |
Source code in src/guidellm/schemas/base.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
__get_pydantic_core_schema__(source_type, handler) classmethod
Generate polymorphic validation schema for dynamic type instantiation.
Creates a tagged union schema that enables Pydantic to automatically instantiate the correct subclass based on the discriminator field value. Falls back to base schema generation when no registry is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type | Any | Type being processed for schema generation | required |
handler | GetCoreSchemaHandler | Pydantic core schema generation handler | required |
Returns:
| Type | Description |
|---|---|
CoreSchema | Tagged union schema for polymorphic validation or base schema |
Source code in src/guidellm/schemas/base.py
__new__(*args, **kwargs)
Prevent direct instantiation of base classes that use this mixin.
Only allows instantiation of concrete subclasses, not the base class.
Source code in src/guidellm/schemas/base.py
__pydantic_generate_base_schema__(handler) classmethod
Generate fallback schema for polymorphic models without registry.
Provides a base schema that accepts any valid input when no registry is available for polymorphic validation. Used as fallback during schema generation when the registry has not been populated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler | GetCoreSchemaHandler | Pydantic core schema generation handler | required |
Returns:
| Type | Description |
|---|---|
CoreSchema | Base CoreSchema that accepts any valid input |
Source code in src/guidellm/schemas/base.py
__pydantic_schema_base_type__() abstractmethod classmethod
Define the base type for polymorphic validation hierarchy.
Must be implemented by subclasses to specify which type serves as the root of the polymorphic hierarchy for schema generation and validation.
Returns:
| Type | Description |
|---|---|
type[BaseModelT] | Base class type for the polymorphic model hierarchy |
Source code in src/guidellm/schemas/base.py
auto_populate_registry() classmethod
Initialize registry with auto-discovery and reload validation schema.
Triggers automatic population of the class registry through the parent RegistryMixin functionality and ensures the Pydantic validation schema is updated to include all discovered types for polymorphic validation.
Returns:
| Type | Description |
|---|---|
bool | True if registry was populated, False if already populated |
Raises:
| Type | Description |
|---|---|
ValueError | If called when registry_auto_discovery is disabled |
Source code in src/guidellm/schemas/base.py
register_decorator(clazz, name=None) classmethod
Register a Pydantic model class with type validation and schema reload.
Validates that the class is a proper Pydantic BaseModel subclass before registering it in the class registry. Automatically triggers schema reload to incorporate the new type into polymorphic validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clazz | RegisterClassT | Pydantic model class to register in the polymorphic hierarchy | required |
name | str | list[str] | None | Registry identifier for the class. Uses class name if None | None |
Returns:
| Type | Description |
|---|---|
RegisterClassT | The registered class unchanged for decorator chaining |
Raises:
| Type | Description |
|---|---|
TypeError | If clazz is not a Pydantic BaseModel subclass |
Source code in src/guidellm/schemas/base.py
registered_classes() classmethod
Get all registered pydantic classes from the registry.
Automatically triggers auto-discovery if registry_auto_discovery is enabled to ensure all available implementations are included.
Returns:
| Type | Description |
|---|---|
tuple[type[BaseModelT], ...] | Tuple of all registered classes including auto-discovered ones |
Raises:
| Type | Description |
|---|---|
ValueError | If called before any objects have been registered |
Source code in src/guidellm/schemas/base.py
ReloadableBaseModel
Bases: BaseModel
Base Pydantic model with schema reloading capabilities.
Provides dynamic schema rebuilding functionality for models that need to update their validation schemas at runtime, particularly useful when working with registry-based polymorphic models where new types are registered after initial class definition.
Source code in src/guidellm/schemas/base.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
reload_parent_schemas() classmethod
Recursively reload schemas for all Pydantic models that reference this class in their field annotations.
Walks the subclass trees of guidellm's own model roots (ReloadableBaseModel and StandardBaseModel) rather than all BaseModel subclasses, so third-party Pydantic models loaded in the same process are not visited.
Source code in src/guidellm/schemas/base.py
reload_schema(parents=False) classmethod
Reload the class schema with updated registry information.
Forces a complete rebuild of the Pydantic model schema to incorporate any changes made to associated registries or validation rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parents | bool | Whether to also rebuild schemas for any pydantic parent types that reference this model. | False |
Source code in src/guidellm/schemas/base.py
RequestInfo
Bases: StandardBaseModel
Complete information about a request in the scheduler system.
Encapsulates all metadata, status tracking, and timing information for requests processed through the distributed scheduler. Provides comprehensive lifecycle tracking from initial queuing through final completion, including error handling and node identification for debugging and performance analysis.
Example: :: request = RequestInfo() request.status = "in_progress" start_time = request.started_at completion_time = request.completed_at
Source code in src/guidellm/schemas/info.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
completed_at property
Get the effective request processing completion time.
Returns:
| Type | Description |
|---|---|
float | None | Unix timestamp when processing completed, or None if not completed |
started_at property
Get the effective request processing start time.
Returns:
| Type | Description |
|---|---|
float | None | Unix timestamp when processing began, or None if not started |
model_copy(**_kwargs)
Create a deep copy of the request info with copied timing objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs | Additional keyword arguments for model copying | required |
Returns:
| Type | Description |
|---|---|
RequestInfo | New RequestInfo instance with independent timing objects |
Source code in src/guidellm/schemas/info.py
RequestSettings
Bases: StandardBaseDict
Per-request scheduling metadata attached at enqueue, before worker dequeue.
Populated by dataset finalizers (for example from trace relative_timestamp columns). Scheduling strategies read these fields at dequeue. For trace replay, a non-null relative_timestamp becomes an absolute start time at dequeue: start_time + time_scale * relative_timestamp. When relative_timestamp is null, trace replay schedules the request at benchmark start (no trace offset).
Source code in src/guidellm/schemas/info.py
RequestTimings
Bases: StandardBaseDict
Timing measurements for tracking request lifecycle events.
Provides comprehensive timing data for distributed request processing, capturing key timestamps from initial targeting through final completion. Essential for performance analysis, SLA monitoring, and debugging request processing bottlenecks across scheduler workers and backend systems.
Source code in src/guidellm/schemas/info.py
last_reported property
Get the most recent timing measurement available.
Returns:
| Type | Description |
|---|---|
float | None | The latest Unix timestamp from the timing fields, or None if none |
StandardBaseDict
Bases: StandardBaseModel
Base Pydantic model allowing arbitrary additional fields.
Extends StandardBaseModel to accept extra fields beyond those explicitly defined in the model schema. Useful for flexible data structures that need to accommodate varying or unknown field sets while maintaining type safety for known fields.
Source code in src/guidellm/schemas/base.py
StandardBaseModel
Bases: BaseModel
Base Pydantic model with standardized configuration for GuideLLM.
Provides consistent validation behavior and configuration settings across all Pydantic models in the application, including field validation, attribute conversion, and default value handling.
Example: :: class MyModel(StandardBaseModel): name: str value: int = 42
# Access default values
default_value = MyModel.get_default("value") # Returns 42
Source code in src/guidellm/schemas/base.py
get_default(field) classmethod
Get default value for a model field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field | str | Name of the field to get the default value for | required |
Returns:
| Type | Description |
|---|---|
Any | Default value of the specified field |
Raises:
| Type | Description |
|---|---|
KeyError | If the field does not exist in the model |
Source code in src/guidellm/schemas/base.py
StatusBreakdown
Bases: BaseModel, Generic[SuccessfulT, ErroredT, IncompleteT, TotalT]
Generic model for organizing results by processing status.
Provides structured categorization of results into successful, errored, incomplete, and total status groups. Supports flexible typing for each status category to accommodate different result types while maintaining consistent organization patterns across the application.
Example: :: from guidellm.utils import StatusBreakdown
# Define a breakdown for request counts
breakdown = StatusBreakdown[int, int, int, int](
successful=150,
errored=5,
incomplete=10,
total=165
)
Source code in src/guidellm/schemas/base.py
StatusDistributionSummary
Bases: StatusBreakdown[DistributionSummary, DistributionSummary, DistributionSummary, DistributionSummary]
Distribution summaries broken down by request status categories.
Provides separate statistical analysis for successful, incomplete, and errored requests with total aggregate statistics. Enables status-aware performance analysis and SLO validation across different request outcomes in benchmark results.
Source code in src/guidellm/schemas/statistics.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |
count property
Returns:
| Type | Description |
|---|---|
int | Total count of samples across all status categories |
total_sum property
Returns:
| Type | Description |
|---|---|
float | Total sum of values across all status categories |
concurrency_distribution_from_timings(successful, incomplete, errored, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create status-broken-down concurrency distribution from event intervals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
successful | Sequence[tuple[float, float] | tuple[float, float, float]] | ndarray | Event intervals for successful requests | required |
incomplete | Sequence[tuple[float, float] | tuple[float, float, float]] | ndarray | Event intervals for incomplete requests | required |
errored | Sequence[tuple[float, float] | tuple[float, float, float]] | ndarray | Event intervals for errored requests | required |
start_time | float | None | Analysis window start | None |
end_time | float | None | Analysis window end | None |
threshold | float | None | Time threshold for merging nearby transitions | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of concurrency distribution summaries |
Source code in src/guidellm/schemas/statistics.py
concurrency_distribution_from_timings_function(function, successful, incomplete, errored, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create concurrency distribution by extracting intervals from objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function | Callable[[FunctionObjT], tuple[float, float] | tuple[float, float, float] | Sequence[tuple[float, float] | tuple[float, float, float]] | None] | Function to extract time interval(s) from each object | required |
successful | Sequence[FunctionObjT] | Successful request objects | required |
incomplete | Sequence[FunctionObjT] | Incomplete request objects | required |
errored | Sequence[FunctionObjT] | Errored request objects | required |
start_time | float | None | Analysis window start | None |
end_time | float | None | Analysis window end | None |
threshold | float | None | Time threshold for merging nearby transitions | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of concurrency distribution summaries |
Source code in src/guidellm/schemas/statistics.py
from_values(successful, incomplete, errored, include_pdf=False, epsilon=1e-06) classmethod
Create status-broken-down distribution from values by status category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
successful | Sequence[float | tuple[float, float]] | ndarray | Values or (value, weight) tuples for successful requests | required |
incomplete | Sequence[float | tuple[float, float]] | ndarray | Values or (value, weight) tuples for incomplete requests | required |
errored | Sequence[float | tuple[float, float]] | ndarray | Values or (value, weight) tuples for errored requests | required |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of distribution summaries |
Source code in src/guidellm/schemas/statistics.py
from_values_function(function, successful, incomplete, errored, include_pdf=False, epsilon=1e-06) classmethod
Create distribution summary by extracting values from objects via function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function | Callable[[FunctionObjT], float | tuple[float, float] | Sequence[float | tuple[float, float]] | None] | Function to extract value(s) from each object | required |
successful | Sequence[FunctionObjT] | Successful request objects | required |
incomplete | Sequence[FunctionObjT] | Incomplete request objects | required |
errored | Sequence[FunctionObjT] | Errored request objects | required |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of distribution summaries |
Source code in src/guidellm/schemas/statistics.py
rate_distribution_from_timings(successful, incomplete, errored, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create status-broken-down rate distribution from event timestamps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
successful | Sequence[float | tuple[float, float]] | ndarray | Timestamps for successful request events | required |
incomplete | Sequence[float | tuple[float, float]] | ndarray | Timestamps for incomplete request events | required |
errored | Sequence[float | tuple[float, float]] | ndarray | Timestamps for errored request events | required |
start_time | float | None | Analysis window start | None |
end_time | float | None | Analysis window end | None |
threshold | float | None | Time threshold for merging nearby events | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of rate distribution summaries |
Source code in src/guidellm/schemas/statistics.py
rate_distribution_from_timings_function(function, successful, incomplete, errored, start_time=None, end_time=None, threshold=0.0001, include_pdf=False, epsilon=1e-06) classmethod
Create rate distribution by extracting timestamps from objects via function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function | Callable[[FunctionObjT], float | tuple[float, float] | Sequence[float | tuple[float, float]] | None] | Function to extract timestamp(s) from each object | required |
successful | Sequence[FunctionObjT] | Successful request objects | required |
incomplete | Sequence[FunctionObjT] | Incomplete request objects | required |
errored | Sequence[FunctionObjT] | Errored request objects | required |
start_time | float | None | Analysis window start | None |
end_time | float | None | Analysis window end | None |
threshold | float | None | Time threshold for merging nearby events | 0.0001 |
include_pdf | bool | int | Whether to include PDF; True for full, int for sampled size | False |
epsilon | float | Tolerance for probability validation | 1e-06 |
Returns:
| Type | Description |
|---|---|
StatusDistributionSummary | Status breakdown of rate distribution summaries |
Source code in src/guidellm/schemas/statistics.py
ToolCall
Bases: BaseModel
A single tool call from an OpenAI-compatible API response.
Source code in src/guidellm/schemas/tool_call.py
ToolCallFunction
UsageMetrics
Bases: StandardBaseDict
Multimodal usage metrics for generation requests.
Tracks resource consumption across different modalities including text, images, video, and audio. Provides granular metrics for tokens, bytes, duration, and format-specific measurements to enable comprehensive usage monitoring and billing.
Source code in src/guidellm/schemas/request.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
total_tokens property
Calculate total tokens across all modalities.
Returns:
| Type | Description |
|---|---|
int | None | Sum of text, image, video, and audio tokens, or None if all are None |
add_text_metrics(text)
Adds the metrics from the given text to the fields text_characters and text_words.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | Text to add metrics from | required |
Source code in src/guidellm/schemas/request.py
standard_model_config(**updates)
Generate a standard Pydantic model configuration with optional updates.
Provides a consistent base configuration for Pydantic models in the application, allowing for easy customization through additional keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
updates | Any | Additional configuration settings to override defaults | {} |
Returns:
| Type | Description |
|---|---|
ConfigDict | ConfigDict with standard settings merged with any updates |