mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
small update in init (#189)
This commit is contained in:
committed by
GitHub
Unverified
parent
c30d726914
commit
2e6f6a4008
@@ -0,0 +1,32 @@
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
import importlib
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
PACKAGE_EXTRA = "azure"
|
||||
|
||||
_IMPORTS = {
|
||||
"__version__": "agent_framework_azure",
|
||||
}
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
if name in _IMPORTS:
|
||||
submod_name = _IMPORTS[name]
|
||||
try:
|
||||
module = importlib.import_module(submod_name, package=__name__)
|
||||
return getattr(module, name)
|
||||
except ModuleNotFoundError as exc:
|
||||
raise ModuleNotFoundError(
|
||||
f"The '{PACKAGE_EXTRA}' extra is not installed, "
|
||||
f"please do `pip install agent-framework[{PACKAGE_EXTRA}]`"
|
||||
) from exc
|
||||
raise AttributeError(f"module {__name__} has no attribute {name}")
|
||||
|
||||
|
||||
def __dir__() -> list[str]:
|
||||
return list(_IMPORTS.keys())
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from agent_framework_azure import __version__ # noqa: F401
|
||||
Reference in New Issue
Block a user