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/__init__.py
CHANGED
@@ -9,290 +9,71 @@ from ._internal import create_getattr_importer as __hammad_importer__
|
|
9
9
|
|
10
10
|
|
11
11
|
if TYPE_CHECKING:
|
12
|
-
|
13
|
-
from .cli import print, input, animate
|
14
|
-
|
15
|
-
# hammad.cache
|
16
|
-
from .cache import Cache, create_cache, cached, auto_cached
|
17
|
-
|
18
|
-
# hammad.formatting
|
19
|
-
from .formatting.json import convert_to_json_schema
|
20
|
-
from .formatting.text import (
|
21
|
-
convert_to_text,
|
22
|
-
convert_type_to_text,
|
23
|
-
convert_docstring_to_text,
|
24
|
-
)
|
25
|
-
|
26
|
-
# hammad.data
|
27
|
-
from .data.configurations import (
|
28
|
-
Configuration,
|
29
|
-
read_configuration_from_os_vars,
|
30
|
-
read_configuration_from_file,
|
31
|
-
read_configuration_from_url,
|
32
|
-
)
|
33
|
-
from .data.collections import Collection, create_collection
|
34
|
-
from .data.sql import (
|
35
|
-
Database as SQLDatabase,
|
36
|
-
create_database as create_sql_database,
|
37
|
-
)
|
38
|
-
from .data.models import (
|
39
|
-
Model,
|
40
|
-
field,
|
41
|
-
validator,
|
42
|
-
convert_to_pydantic_field,
|
43
|
-
convert_to_pydantic_model,
|
44
|
-
is_pydantic_model_class,
|
45
|
-
)
|
46
|
-
from .data.types import Text, BaseText, Audio, Image, File
|
12
|
+
from . import types
|
47
13
|
|
48
|
-
#
|
49
|
-
from .
|
14
|
+
# 'builtins'
|
15
|
+
from .cache import cached
|
16
|
+
from .cli import print, input, animate
|
17
|
+
from .genai import (
|
50
18
|
BaseGraph,
|
51
|
-
GraphResponse,
|
52
|
-
GraphStream,
|
53
|
-
GraphResponseChunk,
|
54
|
-
GraphBuilder,
|
55
|
-
action,
|
56
19
|
plugin,
|
20
|
+
action,
|
21
|
+
select,
|
22
|
+
agent_decorator as agent,
|
23
|
+
language_model_decorator as llm,
|
24
|
+
run_embedding_model as embedding,
|
25
|
+
define_tool as tool,
|
57
26
|
)
|
58
|
-
from .
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
async_run_agent,
|
67
|
-
async_run_agent_iter,
|
68
|
-
)
|
69
|
-
from .genai.models.embeddings import (
|
70
|
-
Embedding,
|
71
|
-
EmbeddingModel,
|
72
|
-
EmbeddingModelResponse,
|
73
|
-
EmbeddingModelSettings,
|
74
|
-
create_embedding_model,
|
75
|
-
run_embedding_model,
|
76
|
-
async_run_embedding_model,
|
77
|
-
)
|
78
|
-
from .genai.models.language import (
|
79
|
-
LanguageModel,
|
80
|
-
LanguageModelRequest,
|
81
|
-
LanguageModelResponse,
|
82
|
-
LanguageModelResponseChunk,
|
83
|
-
LanguageModelStream,
|
84
|
-
LanguageModelSettings,
|
85
|
-
create_language_model,
|
86
|
-
run_language_model,
|
87
|
-
async_run_language_model,
|
88
|
-
)
|
89
|
-
from .genai.models.multimodal import (
|
90
|
-
run_image_edit_model,
|
91
|
-
run_image_generation_model,
|
92
|
-
run_image_variation_model,
|
93
|
-
run_transcription_model,
|
94
|
-
run_tts_model,
|
95
|
-
async_run_image_edit_model,
|
96
|
-
async_run_image_generation_model,
|
97
|
-
async_run_image_variation_model,
|
98
|
-
async_run_transcription_model,
|
99
|
-
async_run_tts_model,
|
100
|
-
)
|
101
|
-
from .genai.models.reranking import run_reranking_model, async_run_reranking_model
|
102
|
-
from .genai.types.tools import define_tool, Tool
|
103
|
-
from .genai.types.history import History
|
104
|
-
|
105
|
-
# hammad.logging
|
106
|
-
from .logging import (
|
107
|
-
Logger,
|
108
|
-
create_logger,
|
109
|
-
create_logger_level,
|
110
|
-
trace,
|
111
|
-
trace_cls,
|
112
|
-
trace_function,
|
113
|
-
trace_http,
|
114
|
-
)
|
115
|
-
|
116
|
-
# hammad.mcp
|
117
|
-
from .mcp import (
|
118
|
-
MCPClient,
|
119
|
-
MCPClientSseSettings,
|
120
|
-
MCPClientStdioSettings,
|
121
|
-
MCPClientStreamableHttpSettings,
|
122
|
-
MCPServerSseSettings,
|
123
|
-
MCPServerStdioSettings,
|
124
|
-
MCPServerStreamableHttpSettings,
|
125
|
-
launch_mcp_servers,
|
126
|
-
convert_mcp_tool_to_openai_tool,
|
127
|
-
)
|
128
|
-
|
129
|
-
# hammad.runtime
|
130
|
-
from .runtime import (
|
131
|
-
run_parallel,
|
132
|
-
run_sequentially,
|
133
|
-
run_with_retry,
|
134
|
-
parallelize_function,
|
135
|
-
sequentialize_function,
|
27
|
+
from .data.collections import create_collection as collection
|
28
|
+
from .formatting.text import convert_to_text as markdown
|
29
|
+
from .mcp import launch_mcp_servers
|
30
|
+
from .logging import create_logger as logger
|
31
|
+
from .service import serve, serve_mcp
|
32
|
+
from .web import (
|
33
|
+
run_web_search as web_search,
|
34
|
+
run_web_request as web_request,
|
136
35
|
)
|
137
36
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
OpenAPIClient,
|
146
|
-
AsyncOpenAPIClient,
|
147
|
-
SearchClient,
|
148
|
-
AsyncSearchClient,
|
149
|
-
create_http_client,
|
150
|
-
create_openapi_client,
|
151
|
-
create_search_client,
|
152
|
-
run_web_search,
|
153
|
-
run_news_search,
|
154
|
-
run_web_request,
|
155
|
-
read_web_page,
|
156
|
-
read_web_pages,
|
157
|
-
extract_web_page_links,
|
37
|
+
from ._main import (
|
38
|
+
to,
|
39
|
+
run,
|
40
|
+
fn,
|
41
|
+
new,
|
42
|
+
read,
|
43
|
+
settings,
|
158
44
|
)
|
159
45
|
|
160
46
|
|
161
47
|
__all__ = (
|
162
|
-
#
|
48
|
+
# types
|
49
|
+
"types",
|
50
|
+
# -- 'builtins'
|
51
|
+
"cached",
|
163
52
|
"print",
|
164
|
-
"input",
|
165
53
|
"animate",
|
166
|
-
|
167
|
-
"
|
168
|
-
"
|
169
|
-
"
|
170
|
-
"
|
171
|
-
|
172
|
-
"
|
173
|
-
"convert_to_text",
|
174
|
-
"convert_type_to_text",
|
175
|
-
"convert_docstring_to_text",
|
176
|
-
# hammad.data
|
177
|
-
"Configuration",
|
178
|
-
"read_configuration_from_os_vars",
|
179
|
-
"read_configuration_from_file",
|
180
|
-
"read_configuration_from_url",
|
181
|
-
"Collection",
|
182
|
-
"create_collection",
|
183
|
-
"SQLDatabase",
|
184
|
-
"create_sql_database",
|
185
|
-
"Model",
|
186
|
-
"field",
|
187
|
-
"validator",
|
188
|
-
"convert_to_pydantic_field",
|
189
|
-
"convert_to_pydantic_model",
|
190
|
-
"is_pydantic_model_class",
|
191
|
-
"Text",
|
192
|
-
"BaseText",
|
193
|
-
"Audio",
|
194
|
-
"Image",
|
195
|
-
"File",
|
196
|
-
# hammad.genai
|
197
|
-
"BaseGraph",
|
198
|
-
"GraphResponse",
|
199
|
-
"GraphStream",
|
200
|
-
"GraphResponseChunk",
|
201
|
-
"GraphBuilder",
|
54
|
+
"input",
|
55
|
+
"llm",
|
56
|
+
"agent",
|
57
|
+
"embedding",
|
58
|
+
"tool",
|
59
|
+
"markdown",
|
60
|
+
"launch_mcp_servers",
|
202
61
|
"action",
|
203
62
|
"plugin",
|
204
|
-
|
205
|
-
"
|
206
|
-
"
|
207
|
-
"
|
208
|
-
"AgentStream",
|
209
|
-
"create_agent",
|
210
|
-
"run_agent",
|
211
|
-
"run_agent_iter",
|
212
|
-
"async_run_agent",
|
213
|
-
"async_run_agent_iter",
|
214
|
-
# hammad.genai.models.embeddings
|
215
|
-
"Embedding",
|
216
|
-
"EmbeddingModel",
|
217
|
-
"EmbeddingModelResponse",
|
218
|
-
"EmbeddingModelSettings",
|
219
|
-
"create_embedding_model",
|
220
|
-
"run_embedding_model",
|
221
|
-
"async_run_embedding_model",
|
222
|
-
# hammad.genai.models.language
|
223
|
-
"LanguageModel",
|
224
|
-
"LanguageModelRequest",
|
225
|
-
"LanguageModelResponse",
|
226
|
-
"LanguageModelResponseChunk",
|
227
|
-
"LanguageModelStream",
|
228
|
-
"LanguageModelSettings",
|
229
|
-
"create_language_model",
|
230
|
-
"run_language_model",
|
231
|
-
"async_run_language_model",
|
232
|
-
# hammad.genai.models.multimodal
|
233
|
-
"run_image_edit_model",
|
234
|
-
"run_image_generation_model",
|
235
|
-
"run_image_variation_model",
|
236
|
-
"run_transcription_model",
|
237
|
-
"run_tts_model",
|
238
|
-
"async_run_image_edit_model",
|
239
|
-
"async_run_image_generation_model",
|
240
|
-
"async_run_image_variation_model",
|
241
|
-
"async_run_transcription_model",
|
242
|
-
"async_run_tts_model",
|
243
|
-
# hammad.genai.models.reranking
|
244
|
-
"run_reranking_model",
|
245
|
-
"async_run_reranking_model",
|
246
|
-
# hammad.genai.types.tools
|
247
|
-
"define_tool",
|
248
|
-
"Tool",
|
249
|
-
# hammad.genai.types.history
|
250
|
-
"History",
|
251
|
-
# hammad.logging
|
252
|
-
"Logger",
|
253
|
-
"create_logger",
|
254
|
-
"create_logger_level",
|
255
|
-
"trace",
|
256
|
-
"trace_cls",
|
257
|
-
"trace_function",
|
258
|
-
"trace_http",
|
259
|
-
# hammad.mcp
|
260
|
-
"MCPClient",
|
261
|
-
"MCPClientSseSettings",
|
262
|
-
"MCPClientStdioSettings",
|
263
|
-
"MCPClientStreamableHttpSettings",
|
264
|
-
"MCPServerSseSettings",
|
265
|
-
"MCPServerStdioSettings",
|
266
|
-
"MCPServerStreamableHttpSettings",
|
267
|
-
"launch_mcp_servers",
|
268
|
-
"convert_mcp_tool_to_openai_tool",
|
269
|
-
# hammad.runtime
|
270
|
-
"run_parallel",
|
271
|
-
"run_sequentially",
|
272
|
-
"run_with_retry",
|
273
|
-
"parallelize_function",
|
274
|
-
"sequentialize_function",
|
275
|
-
# hammad.service
|
276
|
-
"create_service",
|
277
|
-
"async_create_service",
|
63
|
+
"select",
|
64
|
+
"BaseGraph",
|
65
|
+
"collection",
|
66
|
+
"logger",
|
278
67
|
"serve",
|
279
68
|
"serve_mcp",
|
280
|
-
|
281
|
-
"
|
282
|
-
"
|
283
|
-
"
|
284
|
-
"
|
285
|
-
"
|
286
|
-
"
|
287
|
-
"
|
288
|
-
"create_openapi_client",
|
289
|
-
"create_search_client",
|
290
|
-
"run_web_search",
|
291
|
-
"run_news_search",
|
292
|
-
"run_web_request",
|
293
|
-
"read_web_page",
|
294
|
-
"read_web_pages",
|
295
|
-
"extract_web_page_links",
|
69
|
+
"web_search",
|
70
|
+
"web_request",
|
71
|
+
"to",
|
72
|
+
"run",
|
73
|
+
"fn",
|
74
|
+
"new",
|
75
|
+
"read",
|
76
|
+
"settings",
|
296
77
|
)
|
297
78
|
|
298
79
|
|
hammad/_main.py
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
"""hammad._main"""
|
2
|
+
|
3
|
+
|
4
|
+
class to:
|
5
|
+
"""Namespace for converters that can be used to convert objects to various formats.
|
6
|
+
|
7
|
+
The `to` class provides a collection of converters that can be used to convert objects
|
8
|
+
to various formats, such as pydantic models, text, markdown, json, and more.
|
9
|
+
"""
|
10
|
+
|
11
|
+
# ! CONVERTERS
|
12
|
+
from .data import (
|
13
|
+
convert_to_pydantic_field as pydantic_field,
|
14
|
+
convert_to_pydantic_model as pydantic_model,
|
15
|
+
)
|
16
|
+
from .data.types import (
|
17
|
+
convert_to_base_text as text,
|
18
|
+
convert_to_simple_text as simple_text,
|
19
|
+
convert_to_code_section as code_section,
|
20
|
+
convert_to_schema_section as schema_section,
|
21
|
+
convert_to_output_instructions as output_instructions,
|
22
|
+
)
|
23
|
+
from .formatting.json import (
|
24
|
+
convert_to_json_schema as json_schema,
|
25
|
+
)
|
26
|
+
from .formatting.text import (
|
27
|
+
convert_to_text as markdown,
|
28
|
+
)
|
29
|
+
|
30
|
+
|
31
|
+
class fn:
|
32
|
+
"""Namespace for decorators that can be used to modify functions, methods, and classes.
|
33
|
+
|
34
|
+
The `fn` class provides a collection of decorators that can be used to modify functions,
|
35
|
+
methods, and classes in various ways, such as caching results, tracing function calls,
|
36
|
+
and validating input parameters.
|
37
|
+
"""
|
38
|
+
|
39
|
+
# ! DECORATORS
|
40
|
+
from .cache import cached, auto_cached
|
41
|
+
from .logging import trace, trace_cls, trace_function, trace_http
|
42
|
+
from .data.models import validator
|
43
|
+
from .runtime import (
|
44
|
+
sequentialize_function as sequentialize,
|
45
|
+
parallelize_function as parallelize,
|
46
|
+
run_with_retry as retry,
|
47
|
+
)
|
48
|
+
from .service import serve, serve_mcp
|
49
|
+
|
50
|
+
|
51
|
+
class new:
|
52
|
+
"""Namespace for factory functions that create new objects, models, services, and clients.
|
53
|
+
|
54
|
+
The `new` class provides convenient access to a variety of factory functions for creating
|
55
|
+
commonly used objects in the hammad ecosystem, such as caches, collections, databases,
|
56
|
+
models, loggers, agents, services, and web clients.
|
57
|
+
|
58
|
+
Example usage:
|
59
|
+
cache = new.cache(...)
|
60
|
+
collection = new.collection(...)
|
61
|
+
model = new.model(...)
|
62
|
+
logger = new.logger(...)
|
63
|
+
agent = new.agent(...)
|
64
|
+
service = new.service(...)
|
65
|
+
http_client = new.http_client(...)
|
66
|
+
"""
|
67
|
+
|
68
|
+
# ! FACTORIES
|
69
|
+
from .cache import (
|
70
|
+
create_cache as cache,
|
71
|
+
)
|
72
|
+
from .data import (
|
73
|
+
create_collection as collection,
|
74
|
+
create_database as database,
|
75
|
+
create_model as model,
|
76
|
+
)
|
77
|
+
from .logging import create_logger as logger
|
78
|
+
from .genai import (
|
79
|
+
create_agent as agent,
|
80
|
+
create_embedding_model as embedding_model,
|
81
|
+
create_language_model as language_model,
|
82
|
+
)
|
83
|
+
from .service import (
|
84
|
+
create_service as service,
|
85
|
+
async_create_service as async_service,
|
86
|
+
)
|
87
|
+
from .mcp import (
|
88
|
+
MCPClient as mcp_client,
|
89
|
+
)
|
90
|
+
from .web import (
|
91
|
+
create_http_client as http_client,
|
92
|
+
create_openapi_client as openapi_client,
|
93
|
+
create_search_client as search_client,
|
94
|
+
)
|
95
|
+
|
96
|
+
|
97
|
+
class run:
|
98
|
+
"""Centeral namespace for 'one-off' runners, or functions that can be
|
99
|
+
executed directly, and standalone."""
|
100
|
+
|
101
|
+
# ! RUNNERS
|
102
|
+
from .genai import (
|
103
|
+
run_agent as agent,
|
104
|
+
run_agent_iter as agent_iter,
|
105
|
+
run_embedding_model as embedding_model,
|
106
|
+
run_image_edit_model as image_edit_model,
|
107
|
+
run_image_generation_model as image_generation_model,
|
108
|
+
run_image_variation_model as image_variation_model,
|
109
|
+
run_language_model as language_model,
|
110
|
+
run_reranking_model as reranking_model,
|
111
|
+
run_transcription_model as transcription_model,
|
112
|
+
run_tts_model as text_to_speech_model,
|
113
|
+
)
|
114
|
+
from .mcp import (
|
115
|
+
launch_mcp_servers as mcp_servers,
|
116
|
+
)
|
117
|
+
from .web import (
|
118
|
+
run_news_search as news_search,
|
119
|
+
run_web_search as web_search,
|
120
|
+
run_web_request as web_request,
|
121
|
+
)
|
122
|
+
|
123
|
+
|
124
|
+
class read:
|
125
|
+
"""Namespace for various resource, URL or other file-type readers."""
|
126
|
+
|
127
|
+
from .data.configurations import (
|
128
|
+
read_configuration_from_dotenv as configuration_from_dotenv,
|
129
|
+
read_configuration_from_file as configuration_from_file,
|
130
|
+
read_configuration_from_url as configuration_from_url,
|
131
|
+
read_configuration_from_os_prefix as configuration_from_os_prefix,
|
132
|
+
read_configuration_from_os_vars as configuration_from_os_vars,
|
133
|
+
)
|
134
|
+
from .data.types import (
|
135
|
+
read_file_from_bytes as file_from_bytes,
|
136
|
+
read_file_from_path as file_from_path,
|
137
|
+
read_file_from_url as file_from_url,
|
138
|
+
read_audio_from_path as audio_from_path,
|
139
|
+
read_audio_from_url as audio_from_url,
|
140
|
+
read_image_from_path as image_from_path,
|
141
|
+
read_image_from_url as image_from_url,
|
142
|
+
)
|
143
|
+
from .web import (
|
144
|
+
read_web_page as web_page,
|
145
|
+
read_web_pages as web_pages,
|
146
|
+
extract_web_page_links as extract_links,
|
147
|
+
)
|
148
|
+
|
149
|
+
|
150
|
+
class settings:
|
151
|
+
"""Namespace class for all settings definitions within the ecosystem. This is an
|
152
|
+
easy way to find the configuration settings for the component you are intending
|
153
|
+
to use."""
|
154
|
+
|
155
|
+
# NOTE:
|
156
|
+
# these are attached to the 'core/builtin' extensions imported at the very top
|
157
|
+
# hence the weird very very literal names
|
158
|
+
from .cli import (
|
159
|
+
CLIStyleLiveSettings as live,
|
160
|
+
CLIStyleBackgroundSettings as bg,
|
161
|
+
CLIStyleRenderableSettings as style,
|
162
|
+
)
|
163
|
+
|
164
|
+
from .data import (
|
165
|
+
QdrantCollectionIndexSettings as qdrant,
|
166
|
+
QdrantCollectionIndexQuerySettings as qdrant_query,
|
167
|
+
TantivyCollectionIndexSettings as tantivy,
|
168
|
+
TantivyCollectionIndexQuerySettings as tantivy_query,
|
169
|
+
)
|
170
|
+
from .logging.logger import LoggerLevelSettings as logger_level
|
171
|
+
from .genai import (
|
172
|
+
AgentSettings as agent,
|
173
|
+
LanguageModelSettings as language_model,
|
174
|
+
EmbeddingModelSettings as embedding_model,
|
175
|
+
)
|
176
|
+
from .mcp import (
|
177
|
+
MCPClientSseSettings as mcp_client_sse,
|
178
|
+
MCPClientStdioSettings as mcp_client_stdio,
|
179
|
+
MCPClientStreamableHttpSettings as mcp_client_streamable_http,
|
180
|
+
MCPServerSseSettings as mcp_server_sse,
|
181
|
+
MCPServerStdioSettings as mcp_server_stdio,
|
182
|
+
MCPServerStreamableHttpSettings as mcp_server_streamable_http,
|
183
|
+
)
|
184
|
+
|
185
|
+
|
186
|
+
__all__ = (
|
187
|
+
# hammad.cache
|
188
|
+
"cached",
|
189
|
+
# hammad.cli
|
190
|
+
"print",
|
191
|
+
"input",
|
192
|
+
"animate",
|
193
|
+
# hammad.logging
|
194
|
+
"logger",
|
195
|
+
# hammad.genai
|
196
|
+
"BaseGraph",
|
197
|
+
"plugin",
|
198
|
+
"action",
|
199
|
+
"agent",
|
200
|
+
"llm",
|
201
|
+
"tool",
|
202
|
+
# hammad.data.collections
|
203
|
+
"collection",
|
204
|
+
# hammad.formatting.text
|
205
|
+
"markdown",
|
206
|
+
# hammad.mcp
|
207
|
+
"launch_mcp_servers",
|
208
|
+
# hammad.service
|
209
|
+
"serve",
|
210
|
+
"serve_mcp",
|
211
|
+
# hammad.web
|
212
|
+
"web_search",
|
213
|
+
"web_request",
|
214
|
+
# hammad.to
|
215
|
+
"to",
|
216
|
+
# hammad.fn
|
217
|
+
"fn",
|
218
|
+
# hammad.new
|
219
|
+
"new",
|
220
|
+
# hammad.run
|
221
|
+
"run",
|
222
|
+
# hammad.read
|
223
|
+
"read",
|
224
|
+
# hammad.settings
|
225
|
+
"settings",
|
226
|
+
)
|
hammad/cli/__init__.py
CHANGED
@@ -8,7 +8,6 @@ from .._internal import create_getattr_importer
|
|
8
8
|
|
9
9
|
if TYPE_CHECKING:
|
10
10
|
from .plugins import print, input, animate
|
11
|
-
from ._runner import CLIRunner
|
12
11
|
from .styles.settings import (
|
13
12
|
CLIStyleRenderableSettings,
|
14
13
|
CLIStyleBackgroundSettings,
|
@@ -20,7 +19,6 @@ __all__ = (
|
|
20
19
|
"print",
|
21
20
|
"input",
|
22
21
|
"animate",
|
23
|
-
"CLIRunner",
|
24
22
|
"CLIStyleRenderableSettings",
|
25
23
|
"CLIStyleBackgroundSettings",
|
26
24
|
"CLIStyleLiveSettings",
|
hammad/data/__init__.py
CHANGED
@@ -19,6 +19,7 @@ if TYPE_CHECKING:
|
|
19
19
|
convert_to_pydantic_field,
|
20
20
|
is_pydantic_model_class,
|
21
21
|
)
|
22
|
+
from .models.utils import create_model
|
22
23
|
from .collections import (
|
23
24
|
Collection,
|
24
25
|
create_collection,
|
@@ -29,11 +30,7 @@ if TYPE_CHECKING:
|
|
29
30
|
QdrantCollectionIndexSettings,
|
30
31
|
QdrantCollectionIndexQuerySettings,
|
31
32
|
)
|
32
|
-
from .sql import
|
33
|
-
DatabaseItemType,
|
34
|
-
DatabaseItem,
|
35
|
-
Database,
|
36
|
-
)
|
33
|
+
from .sql import DatabaseItemType, DatabaseItem, Database, create_database
|
37
34
|
from .configurations import (
|
38
35
|
Configuration,
|
39
36
|
read_configuration_from_file,
|
@@ -58,6 +55,7 @@ __all__ = (
|
|
58
55
|
"convert_to_pydantic_model",
|
59
56
|
"convert_to_pydantic_field",
|
60
57
|
"is_pydantic_model_class",
|
58
|
+
"create_model",
|
61
59
|
# hammad.data.collections
|
62
60
|
"Collection",
|
63
61
|
"create_collection",
|
@@ -71,6 +69,7 @@ __all__ = (
|
|
71
69
|
"DatabaseItemType",
|
72
70
|
"DatabaseItem",
|
73
71
|
"Database",
|
72
|
+
"create_database",
|
74
73
|
# hammad.data.configurations
|
75
74
|
"Configuration",
|
76
75
|
"read_configuration_from_file",
|
hammad/data/types/__init__.py
CHANGED
@@ -12,11 +12,30 @@ if TYPE_CHECKING:
|
|
12
12
|
from .text import (
|
13
13
|
BaseText,
|
14
14
|
Text,
|
15
|
+
SimpleText,
|
16
|
+
CodeSection,
|
17
|
+
SchemaSection,
|
18
|
+
OutputText,
|
19
|
+
convert_to_simple_text,
|
20
|
+
convert_to_output_text,
|
21
|
+
convert_to_output_instructions,
|
22
|
+
convert_to_code_section,
|
23
|
+
convert_to_schema_section,
|
24
|
+
convert_to_base_text,
|
25
|
+
)
|
26
|
+
from .file import (
|
27
|
+
File,
|
28
|
+
read_file_from_bytes,
|
29
|
+
read_file_from_path,
|
30
|
+
read_file_from_url,
|
15
31
|
)
|
16
|
-
from .file import File
|
17
32
|
from .multimodal import (
|
18
33
|
Audio,
|
19
34
|
Image,
|
35
|
+
read_audio_from_path,
|
36
|
+
read_audio_from_url,
|
37
|
+
read_image_from_path,
|
38
|
+
read_image_from_url,
|
20
39
|
)
|
21
40
|
|
22
41
|
|
@@ -24,11 +43,28 @@ __all__ = (
|
|
24
43
|
# hammad.data.types.text
|
25
44
|
"BaseText",
|
26
45
|
"Text",
|
46
|
+
"SimpleText",
|
47
|
+
"CodeSection",
|
48
|
+
"SchemaSection",
|
49
|
+
"OutputText",
|
50
|
+
"convert_to_simple_text",
|
51
|
+
"convert_to_output_text",
|
52
|
+
"convert_to_output_instructions",
|
53
|
+
"convert_to_code_section",
|
54
|
+
"convert_to_schema_section",
|
55
|
+
"convert_to_base_text",
|
27
56
|
# hammad.data.types.file
|
28
57
|
"File",
|
58
|
+
"read_file_from_bytes",
|
59
|
+
"read_file_from_path",
|
60
|
+
"read_file_from_url",
|
29
61
|
# hammad.data.types.multimodal
|
30
62
|
"Audio",
|
31
63
|
"Image",
|
64
|
+
"read_audio_from_path",
|
65
|
+
"read_audio_from_url",
|
66
|
+
"read_image_from_path",
|
67
|
+
"read_image_from_url",
|
32
68
|
)
|
33
69
|
|
34
70
|
|