hammad-python 0.0.18__py3-none-any.whl → 0.0.20__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 +7 -137
- hammad/_internal.py +1 -0
- hammad/cli/_runner.py +8 -8
- hammad/cli/plugins.py +55 -26
- hammad/cli/styles/utils.py +16 -8
- hammad/data/__init__.py +1 -5
- hammad/data/collections/__init__.py +2 -3
- hammad/data/collections/collection.py +41 -22
- hammad/data/collections/indexes/__init__.py +1 -1
- hammad/data/collections/indexes/qdrant/__init__.py +1 -1
- hammad/data/collections/indexes/qdrant/index.py +106 -118
- hammad/data/collections/indexes/qdrant/settings.py +14 -14
- hammad/data/collections/indexes/qdrant/utils.py +28 -38
- hammad/data/collections/indexes/tantivy/__init__.py +1 -1
- hammad/data/collections/indexes/tantivy/index.py +57 -59
- hammad/data/collections/indexes/tantivy/settings.py +8 -19
- hammad/data/collections/indexes/tantivy/utils.py +28 -52
- hammad/data/models/__init__.py +2 -7
- hammad/data/sql/__init__.py +1 -1
- hammad/data/sql/database.py +71 -73
- hammad/data/sql/types.py +37 -51
- hammad/formatting/__init__.py +2 -1
- hammad/formatting/json/converters.py +2 -2
- hammad/genai/__init__.py +96 -36
- hammad/genai/agents/__init__.py +47 -1
- hammad/genai/agents/agent.py +1022 -0
- hammad/genai/agents/run.py +615 -0
- hammad/genai/agents/types/__init__.py +29 -22
- hammad/genai/agents/types/agent_context.py +13 -0
- hammad/genai/agents/types/agent_event.py +128 -0
- hammad/genai/agents/types/agent_hooks.py +220 -0
- hammad/genai/agents/types/agent_messages.py +31 -0
- hammad/genai/agents/types/agent_response.py +90 -0
- hammad/genai/agents/types/agent_stream.py +242 -0
- hammad/genai/models/__init__.py +1 -0
- hammad/genai/models/embeddings/__init__.py +39 -0
- hammad/genai/{embedding_models/embedding_model.py → models/embeddings/model.py} +45 -41
- hammad/genai/{embedding_models → models/embeddings}/run.py +10 -8
- hammad/genai/models/embeddings/types/__init__.py +37 -0
- hammad/genai/{embedding_models → models/embeddings/types}/embedding_model_name.py +2 -4
- hammad/genai/{embedding_models → models/embeddings/types}/embedding_model_response.py +11 -4
- hammad/genai/{embedding_models/embedding_model_request.py → models/embeddings/types/embedding_model_run_params.py} +4 -3
- hammad/genai/models/embeddings/types/embedding_model_settings.py +47 -0
- hammad/genai/models/language/__init__.py +48 -0
- hammad/genai/{language_models/language_model.py → models/language/model.py} +481 -204
- hammad/genai/{language_models → models/language}/run.py +80 -57
- hammad/genai/models/language/types/__init__.py +40 -0
- hammad/genai/models/language/types/language_model_instructor_mode.py +47 -0
- hammad/genai/models/language/types/language_model_messages.py +28 -0
- hammad/genai/{language_models/_types.py → models/language/types/language_model_name.py} +3 -40
- hammad/genai/{language_models → models/language/types}/language_model_request.py +17 -25
- hammad/genai/{language_models → models/language/types}/language_model_response.py +61 -68
- hammad/genai/{language_models → models/language/types}/language_model_response_chunk.py +8 -5
- hammad/genai/models/language/types/language_model_settings.py +89 -0
- hammad/genai/{language_models/_streaming.py → models/language/types/language_model_stream.py} +221 -243
- hammad/genai/{language_models/_utils → models/language/utils}/__init__.py +8 -11
- hammad/genai/models/language/utils/requests.py +421 -0
- hammad/genai/{language_models/_utils/_structured_outputs.py → models/language/utils/structured_outputs.py} +31 -20
- hammad/genai/models/model_provider.py +4 -0
- hammad/genai/{multimodal_models.py → models/multimodal.py} +4 -5
- hammad/genai/models/reranking.py +26 -0
- hammad/genai/types/__init__.py +1 -0
- hammad/genai/types/base.py +215 -0
- hammad/genai/{agents/types → types}/history.py +101 -88
- hammad/genai/{agents/types/tool.py → types/tools.py} +156 -141
- hammad/logging/logger.py +2 -1
- hammad/mcp/client/__init__.py +2 -3
- hammad/mcp/client/client.py +10 -10
- hammad/mcp/servers/__init__.py +2 -1
- hammad/service/decorators.py +1 -3
- hammad/web/models.py +1 -3
- hammad/web/search/client.py +10 -22
- {hammad_python-0.0.18.dist-info → hammad_python-0.0.20.dist-info}/METADATA +10 -2
- hammad_python-0.0.20.dist-info/RECORD +127 -0
- hammad/genai/embedding_models/__init__.py +0 -41
- hammad/genai/language_models/__init__.py +0 -35
- hammad/genai/language_models/_utils/_completions.py +0 -131
- hammad/genai/language_models/_utils/_messages.py +0 -89
- hammad/genai/language_models/_utils/_requests.py +0 -202
- hammad/genai/rerank_models.py +0 -26
- hammad_python-0.0.18.dist-info/RECORD +0 -111
- {hammad_python-0.0.18.dist-info → hammad_python-0.0.20.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.18.dist-info → hammad_python-0.0.20.dist-info}/licenses/LICENSE +0 -0
hammad/__init__.py
CHANGED
@@ -6,148 +6,33 @@ from typing import TYPE_CHECKING
|
|
6
6
|
from ._internal import create_getattr_importer as __hammad_importer__
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
|
-
|
10
9
|
# hammad.cache
|
11
|
-
from .cache import
|
12
|
-
cached,
|
13
|
-
Cache
|
14
|
-
)
|
10
|
+
from .cache import cached, Cache
|
15
11
|
|
16
12
|
# hammad.cli
|
17
|
-
from .cli import
|
18
|
-
print,
|
19
|
-
animate,
|
20
|
-
input
|
21
|
-
)
|
22
|
-
|
23
|
-
# hammad.data
|
24
|
-
from .data.configurations import (
|
25
|
-
Configuration,
|
26
|
-
read_configuration_from_file,
|
27
|
-
read_configuration_from_url,
|
28
|
-
read_configuration_from_os_vars,
|
29
|
-
read_configuration_from_os_prefix,
|
30
|
-
read_configuration_from_dotenv
|
31
|
-
)
|
32
|
-
from .data.collections.collection import (
|
33
|
-
Collection,
|
34
|
-
create_collection
|
35
|
-
)
|
36
|
-
from .data.models import (
|
37
|
-
Model,
|
38
|
-
field,
|
39
|
-
validator,
|
40
|
-
model_settings,
|
41
|
-
convert_to_pydantic_model,
|
42
|
-
convert_to_pydantic_field,
|
43
|
-
)
|
44
|
-
from .data.types import (
|
45
|
-
Audio,
|
46
|
-
Image,
|
47
|
-
Text
|
48
|
-
)
|
13
|
+
from .cli import print, animate, input
|
49
14
|
|
50
15
|
# hammad.formatting
|
51
|
-
from .formatting.json import
|
52
|
-
|
53
|
-
)
|
54
|
-
from .formatting.text import (
|
55
|
-
convert_to_text,
|
56
|
-
convert_type_to_text
|
57
|
-
)
|
58
|
-
|
59
|
-
# hammad.genai
|
60
|
-
from .genai.embedding_models import (
|
61
|
-
EmbeddingModel,
|
62
|
-
run_embedding_model,
|
63
|
-
async_run_embedding_model
|
64
|
-
)
|
65
|
-
from .genai.language_models import (
|
66
|
-
LanguageModel,
|
67
|
-
run_language_model,
|
68
|
-
async_run_language_model
|
69
|
-
)
|
16
|
+
from .formatting.json import convert_to_json_schema
|
17
|
+
from .formatting.text import convert_to_text, convert_type_to_text
|
70
18
|
|
71
19
|
# hammad.logging
|
72
|
-
from .logging.logger import
|
73
|
-
|
74
|
-
create_logger
|
75
|
-
)
|
76
|
-
from .logging.decorators import (
|
77
|
-
trace,
|
78
|
-
trace_cls,
|
79
|
-
trace_function,
|
80
|
-
trace_http
|
81
|
-
)
|
82
|
-
|
83
|
-
# hammad.service
|
84
|
-
from .service.decorators import (
|
85
|
-
serve as serve_function,
|
86
|
-
serve_mcp as serve_function_as_mcp
|
87
|
-
)
|
88
|
-
|
89
|
-
# hammad.web
|
90
|
-
from .web.http.client import (
|
91
|
-
create_http_client
|
92
|
-
)
|
93
|
-
from .web.openapi.client import (
|
94
|
-
create_openapi_client
|
95
|
-
)
|
96
|
-
from .web.search.client import (
|
97
|
-
create_search_client
|
98
|
-
)
|
99
|
-
from .web.utils import (
|
100
|
-
run_web_request,
|
101
|
-
read_web_page,
|
102
|
-
read_web_pages,
|
103
|
-
run_news_search,
|
104
|
-
run_web_search,
|
105
|
-
extract_web_page_links,
|
106
|
-
)
|
20
|
+
from .logging.logger import Logger, create_logger
|
21
|
+
from .logging.decorators import trace, trace_cls, trace_function, trace_http
|
107
22
|
|
108
23
|
|
109
24
|
__all__ = [
|
110
25
|
# hammad.cache
|
111
26
|
"cached",
|
112
27
|
"Cache",
|
113
|
-
|
114
28
|
# hammad.cli
|
115
29
|
"print",
|
116
30
|
"animate",
|
117
31
|
"input",
|
118
|
-
|
119
|
-
# hammad.data
|
120
|
-
"Configuration",
|
121
|
-
"read_configuration_from_file",
|
122
|
-
"read_configuration_from_url",
|
123
|
-
"read_configuration_from_os_vars",
|
124
|
-
"read_configuration_from_os_prefix",
|
125
|
-
"read_configuration_from_dotenv",
|
126
|
-
"Collection",
|
127
|
-
"create_collection",
|
128
|
-
"Model",
|
129
|
-
"field",
|
130
|
-
"validator",
|
131
|
-
"model_settings",
|
132
|
-
"convert_to_pydantic_model",
|
133
|
-
"convert_to_pydantic_field",
|
134
|
-
"Audio",
|
135
|
-
"Image",
|
136
|
-
"Text",
|
137
|
-
|
138
32
|
# hammad.formatting
|
139
33
|
"convert_to_json_schema",
|
140
34
|
"convert_to_text",
|
141
35
|
"convert_type_to_text",
|
142
|
-
|
143
|
-
# hammad.genai
|
144
|
-
"EmbeddingModel",
|
145
|
-
"run_embedding_model",
|
146
|
-
"async_run_embedding_model",
|
147
|
-
"LanguageModel",
|
148
|
-
"run_language_model",
|
149
|
-
"async_run_language_model",
|
150
|
-
|
151
36
|
# hammad.logging
|
152
37
|
"Logger",
|
153
38
|
"create_logger",
|
@@ -155,21 +40,6 @@ __all__ = [
|
|
155
40
|
"trace_cls",
|
156
41
|
"trace_function",
|
157
42
|
"trace_http",
|
158
|
-
|
159
|
-
# hammad.service
|
160
|
-
"serve_function",
|
161
|
-
"serve_function_as_mcp",
|
162
|
-
|
163
|
-
# hammad.web
|
164
|
-
"create_http_client",
|
165
|
-
"create_openapi_client",
|
166
|
-
"create_search_client",
|
167
|
-
"run_web_request",
|
168
|
-
"read_web_page",
|
169
|
-
"read_web_pages",
|
170
|
-
"run_web_search",
|
171
|
-
"run_news_search",
|
172
|
-
"extract_web_page_links",
|
173
43
|
]
|
174
44
|
|
175
45
|
|
@@ -177,4 +47,4 @@ __getattr__ = __hammad_importer__(__all__)
|
|
177
47
|
|
178
48
|
|
179
49
|
def __dir__() -> list[str]:
|
180
|
-
return __all__
|
50
|
+
return __all__
|
hammad/_internal.py
CHANGED
hammad/cli/_runner.py
CHANGED
@@ -35,10 +35,7 @@ if TYPE_CHECKING:
|
|
35
35
|
)
|
36
36
|
|
37
37
|
|
38
|
-
__all__ = (
|
39
|
-
"CLIRunner",
|
40
|
-
)
|
41
|
-
|
38
|
+
__all__ = ("CLIRunner",)
|
42
39
|
|
43
40
|
|
44
41
|
class CLIRunner:
|
@@ -54,7 +51,6 @@ class CLIRunner:
|
|
54
51
|
flush: bool = False,
|
55
52
|
) -> None: ...
|
56
53
|
|
57
|
-
|
58
54
|
@overload
|
59
55
|
@staticmethod
|
60
56
|
def print(
|
@@ -70,7 +66,6 @@ class CLIRunner:
|
|
70
66
|
live: "CLIStyleLiveSettings | int | None" = None,
|
71
67
|
) -> None: ...
|
72
68
|
|
73
|
-
|
74
69
|
@staticmethod
|
75
70
|
def print(
|
76
71
|
*values: object,
|
@@ -109,6 +104,7 @@ class CLIRunner:
|
|
109
104
|
Live settings object if live=True, otherwise None
|
110
105
|
"""
|
111
106
|
from ..cli import print as _run_cli_print_fn
|
107
|
+
|
112
108
|
return _run_cli_print_fn(
|
113
109
|
*values,
|
114
110
|
sep=sep,
|
@@ -171,6 +167,7 @@ class CLIRunner:
|
|
171
167
|
The user's input, potentially validated and converted according to the schema.
|
172
168
|
"""
|
173
169
|
from ..cli import input as _run_cli_input_fn
|
170
|
+
|
174
171
|
return _run_cli_input_fn(
|
175
172
|
prompt=prompt,
|
176
173
|
schema=schema,
|
@@ -188,7 +185,9 @@ class CLIRunner:
|
|
188
185
|
@staticmethod
|
189
186
|
def animate(
|
190
187
|
renderable: "RenderableType | str",
|
191
|
-
type: Literal[
|
188
|
+
type: Literal[
|
189
|
+
"flashing", "pulsing", "shaking", "typing", "spinning", "rainbow"
|
190
|
+
],
|
192
191
|
duration: Optional[float] = None,
|
193
192
|
# Animation parameters (defaults are handled by the specific animation classes)
|
194
193
|
speed: Optional[float] = None,
|
@@ -239,6 +238,7 @@ class CLIRunner:
|
|
239
238
|
vertical_overflow: How to handle vertical overflow
|
240
239
|
"""
|
241
240
|
from ..cli import animate as _run_cli_animate_fn
|
241
|
+
|
242
242
|
_run_cli_animate_fn(
|
243
243
|
renderable=renderable,
|
244
244
|
type=type,
|
@@ -262,4 +262,4 @@ class CLIRunner:
|
|
262
262
|
console=console,
|
263
263
|
screen=screen,
|
264
264
|
vertical_overflow=vertical_overflow,
|
265
|
-
)
|
265
|
+
)
|
hammad/cli/plugins.py
CHANGED
@@ -159,6 +159,7 @@ def print(
|
|
159
159
|
title: Optional[str] = None,
|
160
160
|
expand: Optional[bool] = None,
|
161
161
|
live: "CLIStyleLiveSettings | int | None" = None,
|
162
|
+
duration: Optional[float] = None,
|
162
163
|
transient: bool = False,
|
163
164
|
new_line_start: bool = False,
|
164
165
|
) -> None:
|
@@ -190,6 +191,7 @@ def print(
|
|
190
191
|
title : Title for panel rendering.
|
191
192
|
expand : Whether to expand panel to full width.
|
192
193
|
live : A dictionary of live settings or an integer in seconds to run the print in a live renderable.
|
194
|
+
duration : The duration of the live renderable.
|
193
195
|
transient : Whether to clear the output after completion.
|
194
196
|
new_line_start : Start with a new line before printing.
|
195
197
|
|
@@ -221,6 +223,7 @@ def print(
|
|
221
223
|
and padding is None
|
222
224
|
and title is None
|
223
225
|
and expand is None
|
226
|
+
and not transient
|
224
227
|
):
|
225
228
|
builtins.print(*values, sep=sep, end=end, file=file, flush=flush)
|
226
229
|
return
|
@@ -250,7 +253,7 @@ def print(
|
|
250
253
|
|
251
254
|
live_settings: CLIStyleLiveSettings = {
|
252
255
|
"duration": float(live),
|
253
|
-
"transient":
|
256
|
+
"transient": transient, # Use the transient parameter
|
254
257
|
}
|
255
258
|
else:
|
256
259
|
live_settings = live
|
@@ -281,19 +284,41 @@ def print(
|
|
281
284
|
get_console = _get_rich_console()
|
282
285
|
Console, _ = _get_rich_console_classes()
|
283
286
|
console = get_console() if file is None else Console(file=file)
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
287
|
+
|
288
|
+
if transient:
|
289
|
+
# Use Rich's Live with transient for temporary output
|
290
|
+
import time
|
291
|
+
from rich.live import Live
|
292
|
+
|
293
|
+
# Auto-set duration to 2.5 when transient=True and duration is None
|
294
|
+
display_duration = duration if duration is not None else 2.5
|
295
|
+
|
296
|
+
with Live(
|
297
|
+
styled_content,
|
298
|
+
console=console,
|
299
|
+
refresh_per_second=1,
|
300
|
+
transient=True,
|
301
|
+
auto_refresh=False,
|
302
|
+
) as live:
|
303
|
+
live.update(styled_content)
|
304
|
+
live.refresh()
|
305
|
+
time.sleep(
|
306
|
+
display_duration
|
307
|
+
) # Use duration parameter for transient content
|
308
|
+
else:
|
309
|
+
console.print(
|
310
|
+
styled_content,
|
311
|
+
end=end,
|
312
|
+
justify=justify,
|
313
|
+
overflow=overflow,
|
314
|
+
no_wrap=no_wrap,
|
315
|
+
emoji=emoji,
|
316
|
+
markup=markup,
|
317
|
+
highlight=highlight,
|
318
|
+
width=width,
|
319
|
+
height=height,
|
320
|
+
new_line_start=new_line_start,
|
321
|
+
)
|
297
322
|
|
298
323
|
|
299
324
|
class InputError(Exception):
|
@@ -771,10 +796,10 @@ def animate(
|
|
771
796
|
animation = animations["CLIFlashingAnimation"](
|
772
797
|
renderable,
|
773
798
|
speed=speed if speed is not None else 0.5,
|
774
|
-
colors=colors,
|
799
|
+
colors=colors, # Class handles default if None
|
775
800
|
on_color=on_color if on_color is not None else "white",
|
776
801
|
off_color=off_color if off_color is not None else "dim white",
|
777
|
-
duration=duration,
|
802
|
+
duration=duration, # Base class handles default if None
|
778
803
|
)
|
779
804
|
elif type == "pulsing":
|
780
805
|
animation = animations["CLIPulsingAnimation"](
|
@@ -783,39 +808,43 @@ def animate(
|
|
783
808
|
min_opacity=min_opacity if min_opacity is not None else 0.3,
|
784
809
|
max_opacity=max_opacity if max_opacity is not None else 1.0,
|
785
810
|
color=color if color is not None else "white",
|
786
|
-
duration=duration,
|
811
|
+
duration=duration, # Base class handles default if None
|
787
812
|
)
|
788
813
|
elif type == "shaking":
|
789
814
|
animation = animations["CLIShakingAnimation"](
|
790
815
|
renderable,
|
791
816
|
intensity=intensity if intensity is not None else 1,
|
792
817
|
speed=speed if speed is not None else 0.1,
|
793
|
-
duration=duration,
|
818
|
+
duration=duration, # Base class handles default if None
|
794
819
|
)
|
795
820
|
elif type == "typing":
|
796
821
|
# Note: CLITypingAnimation expects 'text', assuming renderable is a string here.
|
797
|
-
animation = animations[
|
822
|
+
animation = animations[
|
823
|
+
"CLITypingAnimation"
|
824
|
+
](
|
798
825
|
renderable,
|
799
|
-
speed=speed
|
800
|
-
|
826
|
+
speed=speed
|
827
|
+
if speed is not None
|
828
|
+
else 0.05, # Pass animate's speed, using CLITypingAnimation's speed default
|
829
|
+
typing_speed=typing_speed, # Pass animate's typing_speed, CLITypingAnimation handles its None default
|
801
830
|
cursor=cursor if cursor is not None else "█",
|
802
831
|
show_cursor=show_cursor if show_cursor is not None else True,
|
803
|
-
duration=duration,
|
832
|
+
duration=duration, # Base class handles default if None
|
804
833
|
)
|
805
834
|
elif type == "spinning":
|
806
835
|
animation = animations["CLISpinningAnimation"](
|
807
836
|
renderable,
|
808
|
-
frames=frames,
|
837
|
+
frames=frames, # Class handles default if None
|
809
838
|
speed=speed if speed is not None else 0.1,
|
810
839
|
prefix=prefix if prefix is not None else True,
|
811
|
-
duration=duration,
|
840
|
+
duration=duration, # Base class handles default if None
|
812
841
|
)
|
813
842
|
elif type == "rainbow":
|
814
843
|
animation = animations["CLIRainbowAnimation"](
|
815
844
|
renderable,
|
816
845
|
speed=speed if speed is not None else 0.5,
|
817
|
-
colors=colors,
|
818
|
-
duration=duration,
|
846
|
+
colors=colors, # Class handles default if None
|
847
|
+
duration=duration, # Base class handles default if None
|
819
848
|
)
|
820
849
|
else:
|
821
850
|
raise ValueError(f"Unknown animation type: {type}")
|
hammad/cli/styles/utils.py
CHANGED
@@ -119,8 +119,8 @@ def style_renderable(
|
|
119
119
|
style_settings: CLIStyleRenderableSettings | None = None,
|
120
120
|
bg: CLIStyleBackgroundType | None = None,
|
121
121
|
bg_settings: CLIStyleBackgroundSettings | None = None,
|
122
|
-
border
|
123
|
-
padding
|
122
|
+
border=None,
|
123
|
+
padding=None,
|
124
124
|
title: str | None = None,
|
125
125
|
expand: bool | None = None,
|
126
126
|
):
|
@@ -383,7 +383,7 @@ def style_renderable(
|
|
383
383
|
except Exception:
|
384
384
|
# Skip property if processing fails
|
385
385
|
continue
|
386
|
-
|
386
|
+
|
387
387
|
# Handle direct panel parameters
|
388
388
|
if title is not None:
|
389
389
|
panel_kwargs["title"] = title
|
@@ -394,6 +394,7 @@ def style_renderable(
|
|
394
394
|
if border is not None:
|
395
395
|
try:
|
396
396
|
from rich import box as rich_box_module
|
397
|
+
|
397
398
|
box_map = {
|
398
399
|
"ascii": rich_box_module.ASCII,
|
399
400
|
"ascii2": rich_box_module.ASCII2,
|
@@ -516,7 +517,7 @@ def style_renderable(
|
|
516
517
|
panel_kwargs = {}
|
517
518
|
bg_style = Style(bgcolor=bg)
|
518
519
|
panel_kwargs["style"] = bg_style
|
519
|
-
|
520
|
+
|
520
521
|
# Handle direct panel parameters even with simple bg
|
521
522
|
if title is not None:
|
522
523
|
panel_kwargs["title"] = title
|
@@ -527,6 +528,7 @@ def style_renderable(
|
|
527
528
|
if border is not None:
|
528
529
|
try:
|
529
530
|
from rich import box as rich_box_module
|
531
|
+
|
530
532
|
box_map = {
|
531
533
|
"ascii": rich_box_module.ASCII,
|
532
534
|
"ascii2": rich_box_module.ASCII2,
|
@@ -558,17 +560,22 @@ def style_renderable(
|
|
558
560
|
except Exception:
|
559
561
|
# Use default box if box processing fails
|
560
562
|
pass
|
561
|
-
|
563
|
+
|
562
564
|
return Panel(styled_renderable, **panel_kwargs)
|
563
565
|
except Exception:
|
564
566
|
# Fallback to styled renderable if panel creation fails
|
565
567
|
return styled_renderable
|
566
568
|
else:
|
567
569
|
# Handle panel parameters without background
|
568
|
-
if
|
570
|
+
if (
|
571
|
+
title is not None
|
572
|
+
or padding is not None
|
573
|
+
or expand is not None
|
574
|
+
or border is not None
|
575
|
+
):
|
569
576
|
try:
|
570
577
|
panel_kwargs = {}
|
571
|
-
|
578
|
+
|
572
579
|
if title is not None:
|
573
580
|
panel_kwargs["title"] = title
|
574
581
|
if padding is not None:
|
@@ -578,6 +585,7 @@ def style_renderable(
|
|
578
585
|
if border is not None:
|
579
586
|
try:
|
580
587
|
from rich import box as rich_box_module
|
588
|
+
|
581
589
|
box_map = {
|
582
590
|
"ascii": rich_box_module.ASCII,
|
583
591
|
"ascii2": rich_box_module.ASCII2,
|
@@ -609,7 +617,7 @@ def style_renderable(
|
|
609
617
|
except Exception:
|
610
618
|
# Use default box if box processing fails
|
611
619
|
pass
|
612
|
-
|
620
|
+
|
613
621
|
return Panel(styled_renderable, **panel_kwargs)
|
614
622
|
except Exception:
|
615
623
|
# Fallback to styled renderable if panel creation fails
|
hammad/data/__init__.py
CHANGED
@@ -47,7 +47,6 @@ __all__ = (
|
|
47
47
|
# hammad.data.types
|
48
48
|
"BaseText",
|
49
49
|
"Text",
|
50
|
-
|
51
50
|
# hammad.data.models
|
52
51
|
"Model",
|
53
52
|
"model_settings",
|
@@ -55,7 +54,6 @@ __all__ = (
|
|
55
54
|
"validator",
|
56
55
|
"is_field",
|
57
56
|
"is_model",
|
58
|
-
|
59
57
|
# hammad.data.collections
|
60
58
|
"Collection",
|
61
59
|
"TantivyCollectionIndex",
|
@@ -64,12 +62,10 @@ __all__ = (
|
|
64
62
|
"TantivyCollectionIndexQuerySettings",
|
65
63
|
"QdrantCollectionIndexSettings",
|
66
64
|
"QdrantCollectionIndexQuerySettings",
|
67
|
-
|
68
65
|
# hammad.data.sql
|
69
66
|
"DatabaseItemType",
|
70
67
|
"DatabaseItem",
|
71
68
|
"Database",
|
72
|
-
|
73
69
|
# hammad.data.configurations
|
74
70
|
"Configuration",
|
75
71
|
)
|
@@ -80,4 +76,4 @@ __getattr__ = create_getattr_importer(__all__)
|
|
80
76
|
|
81
77
|
def __dir__() -> list[str]:
|
82
78
|
"""Get the attributes of the hammad.data module."""
|
83
|
-
return list(__all__)
|
79
|
+
return list(__all__)
|
@@ -5,7 +5,7 @@ from ..._internal import create_getattr_importer
|
|
5
5
|
|
6
6
|
if TYPE_CHECKING:
|
7
7
|
from .collection import Collection
|
8
|
-
|
8
|
+
|
9
9
|
from .indexes import (
|
10
10
|
TantivyCollectionIndex,
|
11
11
|
QdrantCollectionIndex,
|
@@ -25,7 +25,6 @@ if TYPE_CHECKING:
|
|
25
25
|
__all__ = (
|
26
26
|
# hammad.data.collections.collection
|
27
27
|
"Collection",
|
28
|
-
|
29
28
|
# hammad.data.collections.indexes
|
30
29
|
"TantivyCollectionIndex",
|
31
30
|
"QdrantCollectionIndex",
|
@@ -41,4 +40,4 @@ __getattr__ = create_getattr_importer(__all__)
|
|
41
40
|
|
42
41
|
def __dir__() -> list[str]:
|
43
42
|
"""Get the attributes of the hammad.data.collections module."""
|
44
|
-
return list(__all__)
|
43
|
+
return list(__all__)
|