Skip to content
Open
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
28 changes: 28 additions & 0 deletions src/strands/experimental/bidi/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
"""Bidirectional model interfaces and implementations."""

from typing import TYPE_CHECKING
Copy link
Member

Choose a reason for hiding this comment

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

Same comments as in #1384


from .model import BidiModel, BidiModelTimeoutError
from .nova_sonic import BidiNovaSonicModel

# Type checking imports for static analysis
if TYPE_CHECKING:
from .gemini_live import BidiGeminiLiveModel
from .openai_realtime import BidiOpenAIRealtimeModel

__all__ = [
"BidiModel",
"BidiModelTimeoutError",
"BidiNovaSonicModel",
"BidiGeminiLiveModel",
"BidiOpenAIRealtimeModel",
]


def __getattr__(name: str):
"""
Lazy load bidi model implementations only when accessed.
This defers the import of optional dependencies until actually needed:
- BidiGeminiLiveModel requires google-generativeai (lazy loaded)
- BidiOpenAIRealtimeModel requires openai (lazy loaded)
"""
if name == "BidiGeminiLiveModel":
from .gemini_live import BidiGeminiLiveModel

return BidiGeminiLiveModel
if name == "BidiOpenAIRealtimeModel":
from .openai_realtime import BidiOpenAIRealtimeModel

return BidiOpenAIRealtimeModel
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
Loading