Skip to content

Conversation

markurtz
Copy link
Collaborator

Summary

Refactors the backend package to introduce a new architecture that supports the scheduler refactor. The changes include new object models for requests/responses, adjustments to the registry-based backend system, and integration with the scheduler interface. The refactor replaces the previous response/streaming model with a more flexible request-response pattern that supports timing measurements and distributed execution.

Details

  • New object models: Introduced GenerationRequestGenerationResponse, and GenerationRequestTimings in objects.py to standardize data flow between scheduler and backends
  • Backend architecture refactor: Redesigned Backend base class to extend RegistryMixin and BackendInterface, enabling automatic registration and scheduler integration
  • Process lifecycle management: Added process_startup() and process_shutdown() methods to support distributed worker processes with proper resource management
  • OpenAI backend modernization: Rewrote OpenAIHTTPBackend with improved error handling, streaming support, beginning support for multimodal content processing, and configuration management
  • Registry system: Implemented automatic backend registration using decorators, replacing manual registry management
  • Scheduler integration: Backends now implement BackendInterface with resolve() method for processing generation requests with timing metadata
  • Removed deprecated modules: Eliminated response.py with its streaming response types in favor of the new object model
  • Enhanced test coverage: Added comprehensive unit tests for all new components with smoke, sanity, and regression test categories

Test Plan

  • Execute new backend module test suites covering smoke, sanity, and regression scenarios
  • Verify OpenAI backend functionality with mocked HTTP responses for both streaming and non-streaming modes
  • Test backend registry and factory pattern functionality
  • Validate integration with scheduler interfaces and timing measurement
  • Ensure proper resource management during process startup/shutdown cycles

Related Issues

  • Part of the larger scheduler refactor initiative

  • "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
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Refactors the backend architecture to introduce new request/response models, a registry-based Backend interface with process lifecycle, and a modernized OpenAI HTTP backend with streaming and multimodal support. Also replaces deprecated response types and significantly expands unit tests.

  • Introduces GenerationRequest, GenerationResponse, and GenerationRequestTimings models
  • Rewrites OpenAIHTTPBackend with streaming, timing, and registry integration
  • Adds process_startup/process_shutdown lifecycle and removes legacy response module

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/guidellm/backend/backend.py Defines new Backend base class integrating RegistryMixin and BackendInterface; updates factory and lifecycle contract.
src/guidellm/backend/openai.py Complete rewrite of OpenAIHTTPBackend, adds paths/keys constants, streaming, multimodal handling, and validation logic.
src/guidellm/backend/objects.py Adds standardized request/response/timings Pydantic models.
src/guidellm/backend/response.py Removes deprecated streaming response and request args models.
src/guidellm/backend/init.py Updates exports to new models and backend.
tests/unit/backend/test_openai_backend.py Expands tests for new backend behavior, streaming, timings, and registry integration.
tests/unit/backend/test_objects.py New tests for the new object models and their properties.
tests/unit/backend/test_backend.py Tests Backend base class behaviors and registry.
tests/unit/backend/test_response.py Removes tests for deprecated response module.
tests/unit/backend/test_openai_backend_custom_configs.py Removes tests tied to old settings-driven header behavior.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@markurtz markurtz force-pushed the features/refactor/scheduler branch 2 times, most recently from 2d94201 to a7ae737 Compare September 19, 2025 12:06
@markurtz markurtz force-pushed the features/refactor/backend branch from 6b3331f to a88605e Compare September 19, 2025 12:14
sjmonson added a commit that referenced this pull request Sep 23, 2025
…features/refactor/base-draft

[GuideLLM Refactor] backend package updates, rewrites, and tests expansion #355
sjmonson added a commit that referenced this pull request Sep 25, 2025
Base automatically changed from features/refactor/scheduler to features/refactor/base September 29, 2025 14:19
@markurtz markurtz merged commit 8f48cf9 into features/refactor/base Sep 29, 2025
12 of 17 checks passed
@markurtz markurtz deleted the features/refactor/backend branch September 29, 2025 14:19
@markurtz markurtz added this to the v0.4.0 milestone Oct 1, 2025
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