-
-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy path__init__.py
More file actions
126 lines (106 loc) · 3.26 KB
/
__init__.py
File metadata and controls
126 lines (106 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""OpenAdapt - GUI automation with ML.
This is the meta-package that provides unified access to all OpenAdapt packages.
Install specific extras to get the functionality you need:
pip install openadapt[capture] # GUI capture only
pip install openadapt[ml] # ML models
pip install openadapt[evals] # Benchmarking
pip install openadapt[all] # Everything
"""
__version__ = "1.0.6"
# Lazy imports to avoid pulling in heavy dependencies unless needed
def __getattr__(name: str):
"""Lazy import handler for optional packages."""
# Capture package
if name in (
"Capture",
"CaptureSession",
"Recorder",
"Action",
"EventType",
"MouseButton",
):
from openadapt_capture import ( # noqa: F401
Action,
Capture,
CaptureSession,
EventType,
MouseButton,
Recorder,
)
return locals()[name]
# Evals package
if name in (
"BenchmarkAdapter",
"BenchmarkTask",
"ApiAgent",
"evaluate_agent_on_benchmark",
):
from openadapt_evals import ( # noqa: F401
ApiAgent,
BenchmarkAdapter,
BenchmarkTask,
evaluate_agent_on_benchmark,
)
return locals()[name]
# Viewer package
if name in ("PageBuilder", "HTMLBuilder"):
from openadapt_viewer import HTMLBuilder, PageBuilder # noqa: F401
return locals()[name]
# ML package (heavy - only import if explicitly requested)
if name in ("QwenVLAdapter", "train", "Trainer"):
from openadapt_ml import QwenVLAdapter # noqa: F401
from openadapt_ml.training import Trainer # noqa: F401
return locals().get(name)
# Grounding package (optional)
if name in ("Grounder", "OmniGrounder", "GeminiGrounder"):
try:
from openadapt_grounding import ( # noqa: F401
GeminiGrounder,
Grounder,
OmniGrounder,
)
return locals()[name]
except ImportError:
raise ImportError(
f"{name} requires openadapt-grounding. "
"Install with: pip install openadapt[grounding]"
)
# Retrieval package (optional)
if name in ("DemoRetriever", "DemoLibrary"):
try:
from openadapt_retrieval import DemoLibrary, DemoRetriever # noqa: F401
return locals()[name]
except ImportError:
raise ImportError(
f"{name} requires openadapt-retrieval. "
"Install with: pip install openadapt[retrieval]"
)
raise AttributeError(f"module 'openadapt' has no attribute '{name}'")
__all__ = [
"__version__",
# From capture
"Capture",
"CaptureSession",
"Recorder",
"Action",
"EventType",
"MouseButton",
# From evals
"BenchmarkAdapter",
"BenchmarkTask",
"ApiAgent",
"evaluate_agent_on_benchmark",
# From viewer
"PageBuilder",
"HTMLBuilder",
# From ml
"QwenVLAdapter",
"Trainer",
# From grounding (optional)
"Grounder",
"OmniGrounder",
"GeminiGrounder",
# From retrieval (optional)
"DemoRetriever",
"DemoLibrary",
]