hammad-python 0.0.24__py3-none-any.whl → 0.0.26__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hammad/__init__.py +49 -268
- hammad/_main.py +226 -0
- hammad/cli/__init__.py +0 -2
- hammad/data/__init__.py +4 -5
- hammad/data/types/__init__.py +37 -1
- hammad/data/types/file.py +74 -1
- hammad/data/types/multimodal/__init__.py +14 -2
- hammad/data/types/multimodal/audio.py +106 -2
- hammad/data/types/multimodal/image.py +104 -2
- hammad/data/types/text.py +242 -0
- hammad/genai/__init__.py +22 -0
- hammad/genai/a2a/__init__.py +32 -0
- hammad/genai/a2a/workers.py +552 -0
- hammad/genai/agents/__init__.py +2 -0
- hammad/genai/agents/agent.py +115 -9
- hammad/genai/agents/run.py +379 -8
- hammad/genai/graphs/__init__.py +13 -1
- hammad/genai/graphs/_utils.py +190 -0
- hammad/genai/graphs/base.py +850 -125
- hammad/genai/graphs/types.py +2 -2
- hammad/genai/models/language/__init__.py +6 -1
- hammad/genai/models/language/run.py +308 -0
- hammad/genai/models/language/types/language_model_response.py +2 -0
- hammad/logging/logger.py +53 -8
- hammad/mcp/__init__.py +3 -0
- hammad/types.py +288 -0
- {hammad_python-0.0.24.dist-info → hammad_python-0.0.26.dist-info}/METADATA +2 -1
- {hammad_python-0.0.24.dist-info → hammad_python-0.0.26.dist-info}/RECORD +30 -26
- hammad/cli/_runner.py +0 -265
- {hammad_python-0.0.24.dist-info → hammad_python-0.0.26.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.24.dist-info → hammad_python-0.0.26.dist-info}/licenses/LICENSE +0 -0
hammad/cli/_runner.py
DELETED
@@ -1,265 +0,0 @@
|
|
1
|
-
"""hammad.cli._runner"""
|
2
|
-
|
3
|
-
from typing import (
|
4
|
-
overload,
|
5
|
-
TYPE_CHECKING,
|
6
|
-
Optional,
|
7
|
-
Any,
|
8
|
-
Dict,
|
9
|
-
List,
|
10
|
-
Union,
|
11
|
-
Literal,
|
12
|
-
IO,
|
13
|
-
)
|
14
|
-
|
15
|
-
if TYPE_CHECKING:
|
16
|
-
from rich.console import Console, RenderableType
|
17
|
-
from ..cli.animations import (
|
18
|
-
CLIFlashingAnimation,
|
19
|
-
CLIPulsingAnimation,
|
20
|
-
CLIShakingAnimation,
|
21
|
-
CLITypingAnimation,
|
22
|
-
CLISpinningAnimation,
|
23
|
-
CLIRainbowAnimation,
|
24
|
-
RainbowPreset,
|
25
|
-
)
|
26
|
-
from ..cli.styles.types import (
|
27
|
-
CLIStyleType,
|
28
|
-
CLIStyleBackgroundType,
|
29
|
-
CLIStyleColorName,
|
30
|
-
)
|
31
|
-
from ..cli.styles.settings import (
|
32
|
-
CLIStyleRenderableSettings,
|
33
|
-
CLIStyleBackgroundSettings,
|
34
|
-
CLIStyleLiveSettings,
|
35
|
-
)
|
36
|
-
|
37
|
-
|
38
|
-
__all__ = ("CLIRunner",)
|
39
|
-
|
40
|
-
|
41
|
-
class CLIRunner:
|
42
|
-
"""Runner subclass for various CLI-based operations."""
|
43
|
-
|
44
|
-
@overload
|
45
|
-
@staticmethod
|
46
|
-
def print(
|
47
|
-
*values: object,
|
48
|
-
sep: str = " ",
|
49
|
-
end: str = "\n",
|
50
|
-
file: Optional[IO[str]] = None,
|
51
|
-
flush: bool = False,
|
52
|
-
) -> None: ...
|
53
|
-
|
54
|
-
@overload
|
55
|
-
@staticmethod
|
56
|
-
def print(
|
57
|
-
*values: object,
|
58
|
-
sep: str = " ",
|
59
|
-
end: str = "\n",
|
60
|
-
file: Optional[IO[str]] = None,
|
61
|
-
flush: bool = False,
|
62
|
-
style: "CLIStyleType | None" = None,
|
63
|
-
style_settings: "CLIStyleRenderableSettings | None" = None,
|
64
|
-
bg: "CLIStyleBackgroundType | None" = None,
|
65
|
-
bg_settings: "CLIStyleBackgroundSettings | None" = None,
|
66
|
-
live: "CLIStyleLiveSettings | int | None" = None,
|
67
|
-
) -> None: ...
|
68
|
-
|
69
|
-
@staticmethod
|
70
|
-
def print(
|
71
|
-
*values: object,
|
72
|
-
sep: str = " ",
|
73
|
-
end: str = "\n",
|
74
|
-
file: Optional[IO[str]] = None,
|
75
|
-
flush: bool = False,
|
76
|
-
style: "CLIStyleType | None" = None,
|
77
|
-
style_settings: "CLIStyleRenderableSettings | None" = None,
|
78
|
-
bg: "CLIStyleBackgroundType | None" = None,
|
79
|
-
bg_settings: "CLIStyleBackgroundSettings | None" = None,
|
80
|
-
live: "CLIStyleLiveSettings | int | None" = None,
|
81
|
-
) -> Optional["CLIStyleLiveSettings"]:
|
82
|
-
"""Print values to the console with optional styling and live updates.
|
83
|
-
|
84
|
-
This function extends Python's built-in print() with additional styling
|
85
|
-
capabilities including backgrounds and live updating displays.
|
86
|
-
|
87
|
-
Args:
|
88
|
-
*values: Values to print (similar to built-in print())
|
89
|
-
sep: String inserted between values (default: " ")
|
90
|
-
end: String appended after the last value (default: "\n")
|
91
|
-
file: File object to write to (default: sys.stdout)
|
92
|
-
flush: Whether to forcibly flush the stream
|
93
|
-
console: Rich Console instance to use
|
94
|
-
style: Style to apply to the content
|
95
|
-
color: Color to apply to the content
|
96
|
-
bg: Background style to apply
|
97
|
-
live: Whether to enable live updating
|
98
|
-
live_settings: Configuration for live display
|
99
|
-
settings: General rendering settings
|
100
|
-
bg_settings: Background styling settings
|
101
|
-
**kwargs: Additional keyword arguments
|
102
|
-
|
103
|
-
Returns:
|
104
|
-
Live settings object if live=True, otherwise None
|
105
|
-
"""
|
106
|
-
from ..cli import print as _run_cli_print_fn
|
107
|
-
|
108
|
-
return _run_cli_print_fn(
|
109
|
-
*values,
|
110
|
-
sep=sep,
|
111
|
-
end=end,
|
112
|
-
file=file,
|
113
|
-
flush=flush,
|
114
|
-
style=style,
|
115
|
-
style_settings=style_settings,
|
116
|
-
bg=bg,
|
117
|
-
bg_settings=bg_settings,
|
118
|
-
live=live,
|
119
|
-
)
|
120
|
-
|
121
|
-
@overload
|
122
|
-
@staticmethod
|
123
|
-
def input(
|
124
|
-
prompt: str = "",
|
125
|
-
schema: Any = None,
|
126
|
-
sequential: bool = True,
|
127
|
-
style: "CLIStyleType | None" = None,
|
128
|
-
style_settings: "CLIStyleRenderableSettings | None" = None,
|
129
|
-
bg: "CLIStyleBackgroundType | None" = None,
|
130
|
-
bg_settings: "CLIStyleBackgroundSettings | None" = None,
|
131
|
-
multiline: bool = False,
|
132
|
-
password: bool = False,
|
133
|
-
complete: Optional[List[str]] = None,
|
134
|
-
validate: Optional[callable] = None,
|
135
|
-
) -> Any: ...
|
136
|
-
|
137
|
-
@staticmethod
|
138
|
-
def input(
|
139
|
-
prompt: str = "",
|
140
|
-
schema: Any = None,
|
141
|
-
sequential: bool = True,
|
142
|
-
style: "CLIStyleType | None" = None,
|
143
|
-
style_settings: "CLIStyleRenderableSettings | None" = None,
|
144
|
-
bg: "CLIStyleBackgroundType | None" = None,
|
145
|
-
bg_settings: "CLIStyleBackgroundSettings | None" = None,
|
146
|
-
multiline: bool = False,
|
147
|
-
password: bool = False,
|
148
|
-
complete: Optional[List[str]] = None,
|
149
|
-
validate: Optional[callable] = None,
|
150
|
-
) -> Any:
|
151
|
-
"""Get input from the user with optional validation and styling.
|
152
|
-
|
153
|
-
Args:
|
154
|
-
prompt: The prompt message to display.
|
155
|
-
schema: Optional schema (dataclass, TypedDict, Pydantic model) for structured input.
|
156
|
-
sequential: If schema is provided, collect fields sequentially (default: True).
|
157
|
-
style: A color or style name to apply to the prompt.
|
158
|
-
style_settings: A dictionary of style settings to apply to the prompt.
|
159
|
-
bg: A color or box name to apply to the background of the prompt.
|
160
|
-
bg_settings: A dictionary of background settings to apply to the prompt.
|
161
|
-
multiline: Allow multiline input (default: False).
|
162
|
-
password: Hide input (default: False).
|
163
|
-
complete: List of strings for autocompletion.
|
164
|
-
validate: A callable to validate the input.
|
165
|
-
|
166
|
-
Returns:
|
167
|
-
The user's input, potentially validated and converted according to the schema.
|
168
|
-
"""
|
169
|
-
from ..cli import input as _run_cli_input_fn
|
170
|
-
|
171
|
-
return _run_cli_input_fn(
|
172
|
-
prompt=prompt,
|
173
|
-
schema=schema,
|
174
|
-
sequential=sequential,
|
175
|
-
style=style,
|
176
|
-
style_settings=style_settings,
|
177
|
-
bg=bg,
|
178
|
-
bg_settings=bg_settings,
|
179
|
-
multiline=multiline,
|
180
|
-
password=password,
|
181
|
-
complete=complete,
|
182
|
-
validate=validate,
|
183
|
-
)
|
184
|
-
|
185
|
-
@staticmethod
|
186
|
-
def animate(
|
187
|
-
renderable: "RenderableType | str",
|
188
|
-
type: Literal[
|
189
|
-
"flashing", "pulsing", "shaking", "typing", "spinning", "rainbow"
|
190
|
-
],
|
191
|
-
duration: Optional[float] = None,
|
192
|
-
# Animation parameters (defaults are handled by the specific animation classes)
|
193
|
-
speed: Optional[float] = None,
|
194
|
-
colors: "Optional[List[CLIStyleColorName]]" = None,
|
195
|
-
on_color: "Optional[CLIStyleColorName]" = None,
|
196
|
-
off_color: "Optional[CLIStyleColorName]" = None,
|
197
|
-
min_opacity: Optional[float] = None,
|
198
|
-
max_opacity: Optional[float] = None,
|
199
|
-
color: "Optional[CLIStyleColorName]" = None,
|
200
|
-
intensity: Optional[int] = None,
|
201
|
-
typing_speed: Optional[float] = None,
|
202
|
-
cursor: Optional[str] = None,
|
203
|
-
show_cursor: Optional[bool] = None,
|
204
|
-
frames: Optional[List[str]] = None,
|
205
|
-
prefix: Optional[bool] = None,
|
206
|
-
# Rich.Live parameters
|
207
|
-
refresh_rate: int = 20,
|
208
|
-
transient: bool = True,
|
209
|
-
auto_refresh: bool = True,
|
210
|
-
console: Optional["Console"] = None,
|
211
|
-
screen: bool = False,
|
212
|
-
vertical_overflow: str = "ellipsis",
|
213
|
-
) -> None:
|
214
|
-
"""Create and run an animation based on the specified type.
|
215
|
-
|
216
|
-
Args:
|
217
|
-
renderable: The object to animate (text, panel, etc.)
|
218
|
-
type: The type of animation to create
|
219
|
-
duration: Duration of the animation in seconds (defaults to 2.0)
|
220
|
-
speed: Animation speed (used by flashing, pulsing, shaking, spinning, rainbow)
|
221
|
-
colors: Color list (used by flashing, rainbow)
|
222
|
-
on_color: Color when flashing "on" (used by flashing)
|
223
|
-
off_color: Color when flashing "off" (used by flashing)
|
224
|
-
min_opacity: Minimum opacity for pulsing animation
|
225
|
-
max_opacity: Maximum opacity for pulsing animation
|
226
|
-
color: Color for pulsing animation
|
227
|
-
intensity: Shaking intensity for shaking animation
|
228
|
-
typing_speed: Speed for typing animation (used by typing)
|
229
|
-
cursor: Cursor character for typing animation (used by typing)
|
230
|
-
show_cursor: Whether to show cursor for typing animation (used by typing)
|
231
|
-
frames: Custom frames for spinning animation
|
232
|
-
prefix: Whether to show spinner as prefix for spinning animation
|
233
|
-
refresh_rate: Refresh rate per second for Live rendering
|
234
|
-
transient: Whether to clear animation after completion
|
235
|
-
auto_refresh: Whether to auto-refresh the display
|
236
|
-
console: Console to use for rendering
|
237
|
-
screen: Whether to use alternate screen buffer
|
238
|
-
vertical_overflow: How to handle vertical overflow
|
239
|
-
"""
|
240
|
-
from ..cli import animate as _run_cli_animate_fn
|
241
|
-
|
242
|
-
_run_cli_animate_fn(
|
243
|
-
renderable=renderable,
|
244
|
-
type=type,
|
245
|
-
duration=duration,
|
246
|
-
speed=speed,
|
247
|
-
colors=colors,
|
248
|
-
on_color=on_color,
|
249
|
-
off_color=off_color,
|
250
|
-
min_opacity=min_opacity,
|
251
|
-
max_opacity=max_opacity,
|
252
|
-
color=color,
|
253
|
-
intensity=intensity,
|
254
|
-
typing_speed=typing_speed,
|
255
|
-
cursor=cursor,
|
256
|
-
show_cursor=show_cursor,
|
257
|
-
frames=frames,
|
258
|
-
prefix=prefix,
|
259
|
-
refresh_rate=refresh_rate,
|
260
|
-
transient=transient,
|
261
|
-
auto_refresh=auto_refresh,
|
262
|
-
console=console,
|
263
|
-
screen=screen,
|
264
|
-
vertical_overflow=vertical_overflow,
|
265
|
-
)
|
File without changes
|
File without changes
|