hammad-python 0.0.23__py3-none-any.whl → 0.0.24__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 CHANGED
@@ -1,29 +1,298 @@
1
- """hammad-python"""
1
+ """hammad-python
2
2
 
3
- from __future__ import annotations
3
+ A vast ecosystem of ('nightly', dont trust literally any interface to stay the same
4
+ for more than a few days) resources, utilities and components for building applications
5
+ in Python."""
4
6
 
5
7
  from typing import TYPE_CHECKING
6
8
  from ._internal import create_getattr_importer as __hammad_importer__
7
9
 
10
+
8
11
  if TYPE_CHECKING:
9
- from ._main._fn import fn
10
- from ._main._new import new
11
- from ._main._run import run
12
- from ._main._to import to
12
+ # BUILTINS | hammad.cli
13
13
  from .cli import print, input, animate
14
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
47
+
48
+ # hammad.genai
49
+ from .genai.graphs import (
50
+ BaseGraph,
51
+ GraphResponse,
52
+ GraphStream,
53
+ GraphResponseChunk,
54
+ GraphBuilder,
55
+ action,
56
+ plugin,
57
+ )
58
+ from .genai.agents import (
59
+ Agent,
60
+ AgentResponse,
61
+ AgentResponseChunk,
62
+ AgentStream,
63
+ create_agent,
64
+ run_agent,
65
+ run_agent_iter,
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,
136
+ )
137
+
138
+ # hammad.service
139
+ from .service import create_service, async_create_service, serve, serve_mcp
140
+
141
+ # hammad.web
142
+ from .web import (
143
+ HttpClient,
144
+ AsyncHttpClient,
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,
158
+ )
159
+
15
160
 
16
161
  __all__ = (
17
- # top level namespace modules for
18
- # super duper fast access to things and stuff
19
- "run",
20
- "new",
21
- "to",
22
- "fn",
23
- # cli
162
+ # hammad.cli
24
163
  "print",
25
164
  "input",
26
165
  "animate",
166
+ # hammad.cache
167
+ "Cache",
168
+ "create_cache",
169
+ "cached",
170
+ "auto_cached",
171
+ # hammad.formatting
172
+ "convert_to_json_schema",
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",
202
+ "action",
203
+ "plugin",
204
+ # hammad.genai.agents
205
+ "Agent",
206
+ "AgentResponse",
207
+ "AgentResponseChunk",
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",
278
+ "serve",
279
+ "serve_mcp",
280
+ # hammad.web
281
+ "HttpClient",
282
+ "AsyncHttpClient",
283
+ "OpenAPIClient",
284
+ "AsyncOpenAPIClient",
285
+ "SearchClient",
286
+ "AsyncSearchClient",
287
+ "create_http_client",
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",
27
296
  )
28
297
 
29
298
 
hammad/cli/plugins.py CHANGED
@@ -734,7 +734,9 @@ def input(
734
734
 
735
735
  def animate(
736
736
  renderable: "RenderableType | str",
737
- type: Literal["flashing", "pulsing", "shaking", "typing", "spinning", "rainbow"],
737
+ type: Literal[
738
+ "flashing", "pulsing", "shaking", "typing", "spinning", "rainbow"
739
+ ] = "pulsing",
738
740
  duration: Optional[float] = None,
739
741
  # Animation parameters (defaults are handled by the specific animation classes)
740
742
  speed: Optional[float] = None,
hammad/genai/__init__.py CHANGED
@@ -21,6 +21,32 @@ if TYPE_CHECKING:
21
21
  async_run_agent,
22
22
  async_run_agent_iter,
23
23
  )
24
+ from .graphs import (
25
+ GraphBuilder,
26
+ GraphContext,
27
+ GraphEnd,
28
+ GraphEvent,
29
+ GraphHistoryEntry,
30
+ GraphNode,
31
+ GraphState,
32
+ GraphResponse,
33
+ GraphStream,
34
+ GraphResponseChunk,
35
+ BaseGraph,
36
+ BasePlugin,
37
+ PluginDecorator,
38
+ PydanticGraphContext,
39
+ AudioPlugin,
40
+ ServePlugin,
41
+ MemoryPlugin,
42
+ HistoryPlugin,
43
+ SettingsPlugin,
44
+ ActionNode,
45
+ ActionInfo,
46
+ ActionSettings,
47
+ action,
48
+ plugin,
49
+ )
24
50
  from .models.embeddings import (
25
51
  Embedding,
26
52
  EmbeddingModel,
@@ -87,6 +113,31 @@ __all__ = [
87
113
  "run_agent_iter",
88
114
  "async_run_agent",
89
115
  "async_run_agent_iter",
116
+ # hammad.genai.graphs
117
+ "GraphBuilder",
118
+ "GraphContext",
119
+ "GraphEnd",
120
+ "GraphEvent",
121
+ "GraphHistoryEntry",
122
+ "GraphNode",
123
+ "GraphState",
124
+ "GraphResponse",
125
+ "GraphStream",
126
+ "GraphResponseChunk",
127
+ "BaseGraph",
128
+ "BasePlugin",
129
+ "PluginDecorator",
130
+ "PydanticGraphContext",
131
+ "AudioPlugin",
132
+ "ServePlugin",
133
+ "MemoryPlugin",
134
+ "HistoryPlugin",
135
+ "SettingsPlugin",
136
+ "ActionNode",
137
+ "ActionInfo",
138
+ "ActionSettings",
139
+ "action",
140
+ "plugin",
90
141
  # hammad.genai.models.embeddings
91
142
  "Embedding",
92
143
  "EmbeddingModel",
@@ -9,6 +9,7 @@ if TYPE_CHECKING:
9
9
  Agent,
10
10
  create_agent,
11
11
  )
12
+ from .run import run_agent, run_agent_iter, async_run_agent, async_run_agent_iter
12
13
 
13
14
  # Types
14
15
  from .types.agent_context import AgentContext
@@ -26,6 +27,11 @@ __all__ = [
26
27
  # hammad.genai.agents.agent
27
28
  "Agent",
28
29
  "create_agent",
30
+ # hammad.genai.agents.run
31
+ "run_agent",
32
+ "run_agent_iter",
33
+ "async_run_agent",
34
+ "async_run_agent_iter",
29
35
  # hammad.genai.agents.types.agent_context
30
36
  "AgentContext",
31
37
  # hammad.genai.agents.types.agent_event