User Story
As a software developer,
I want dependency injection for BlipProcessor and BlipForConditionalGeneration in VideoDescriber initialization
so that I can mock these components during testing and easily swap models for flexibility.
Background
The current implementation directly initializes BlipProcessor and BlipForConditionalGeneration in VideoDescriber.__init__ (see frame_story/video_describer.py lines 13-14). This tight coupling:
- Prevents proper mocking during unit tests (e.g.,
tests/test_video_describer.py relies on actual model loading)
- Forces unnecessary model downloads during test runs
- Limits customization of model versions/implementations
- Creates longer test execution times due to real model initialization
Acceptance Criteria
Validation
- Verify
VideoDescriber() initializes with default Salesforce/blip models when no args passed
- Confirm tests pass when using mocked processor/model in
TestVideoDescriber.setUp()
- Check that custom models can be injected via
VideoDescriber(processor=CustomProcessor(), model=CustomModel())
- Ensure
describe_frames still generates valid descriptions after changes
User Story
As a software developer,
I want dependency injection for BlipProcessor and BlipForConditionalGeneration in
VideoDescriberinitializationso that I can mock these components during testing and easily swap models for flexibility.
Background
The current implementation directly initializes
BlipProcessorandBlipForConditionalGenerationinVideoDescriber.__init__(seeframe_story/video_describer.pylines 13-14). This tight coupling:tests/test_video_describer.pyrelies on actual model loading)Acceptance Criteria
VideoDescriber.__init__to accept optionalprocessorandmodelparametersget_video_descriptionsto pass these dependencies through if providedtest_video_describer.pytests to use mocked processor/modelValidation
VideoDescriber()initializes with default Salesforce/blip models when no args passedTestVideoDescriber.setUp()VideoDescriber(processor=CustomProcessor(), model=CustomModel())describe_framesstill generates valid descriptions after changes