mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-02 02:21:27 +00:00
fix(gemini-video): inherit BaseVideoConfig to enable async content response (#16875)
This fix addresses the same issue that was resolved for OpenAI video in PR #16708. The GeminiVideoConfig class was importing BaseVideoConfig only within TYPE_CHECKING, causing it to be 'Any' at runtime. This prevented the async_transform_video_content_response method from being available during video content downloads. Changes: - Moved BaseVideoConfig import from TYPE_CHECKING to top-level imports - Added test_gemini_video_config_has_async_transform() to verify the fix - Ensures GeminiVideoConfig properly inherits BaseVideoConfig at runtime Fixes video generation errors for Gemini Veo models: 'GeminiVideoConfig' object has no attribute 'async_transform_video_content_response'
This commit is contained in:
@@ -15,17 +15,16 @@ from litellm.images.utils import ImageEditRequestUtils
|
||||
import litellm
|
||||
from litellm.types.llms.gemini import GeminiLongRunningOperationResponse, GeminiVideoGenerationInstance, GeminiVideoGenerationParameters, GeminiVideoGenerationRequest
|
||||
from litellm.constants import DEFAULT_GOOGLE_VIDEO_DURATION_SECONDS
|
||||
from litellm.llms.base_llm.videos.transformation import BaseVideoConfig
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj
|
||||
from ...base_llm.videos.transformation import BaseVideoConfig as _BaseVideoConfig
|
||||
from ...base_llm.chat.transformation import BaseLLMException as _BaseLLMException
|
||||
|
||||
LiteLLMLoggingObj = _LiteLLMLoggingObj
|
||||
BaseVideoConfig = _BaseVideoConfig
|
||||
BaseLLMException = _BaseLLMException
|
||||
else:
|
||||
LiteLLMLoggingObj = Any
|
||||
BaseVideoConfig = Any
|
||||
BaseLLMException = Any
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import litellm
|
||||
from litellm.types.videos.main import VideoObject, VideoResponse
|
||||
from litellm.videos.main import video_generation, avideo_generation, video_status, avideo_status
|
||||
from litellm.llms.openai.videos.transformation import OpenAIVideoConfig
|
||||
from litellm.llms.gemini.videos.transformation import GeminiVideoConfig
|
||||
from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler
|
||||
from litellm.cost_calculator import default_video_cost_calculator
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging as LitellmLogging
|
||||
@@ -813,5 +814,12 @@ def test_openai_video_config_has_async_transform():
|
||||
cfg = OpenAIVideoConfig()
|
||||
assert callable(getattr(cfg, "async_transform_video_content_response", None))
|
||||
|
||||
|
||||
def test_gemini_video_config_has_async_transform():
|
||||
"""Ensure GeminiVideoConfig exposes async_transform_video_content_response at runtime."""
|
||||
cfg = GeminiVideoConfig()
|
||||
assert callable(getattr(cfg, "async_transform_video_content_response", None))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__])
|
||||
|
||||
Reference in New Issue
Block a user