hammad-python 0.0.22__tar.gz → 0.0.24__tar.gz

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.
Files changed (135) hide show
  1. {hammad_python-0.0.22 → hammad_python-0.0.24}/PKG-INFO +5 -1
  2. hammad_python-0.0.24/hammad/__init__.py +303 -0
  3. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/_internal.py +19 -1
  4. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/plugins.py +3 -1
  5. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/__init__.py +10 -0
  6. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/__init__.py +5 -1
  7. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/sql/__init__.py +2 -1
  8. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/__init__.py +57 -0
  9. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/__init__.py +11 -1
  10. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/agent.py +719 -213
  11. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/run.py +50 -12
  12. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_response.py +2 -1
  13. hammad_python-0.0.24/hammad/genai/graphs/__init__.py +113 -0
  14. hammad_python-0.0.24/hammad/genai/graphs/base.py +1103 -0
  15. hammad_python-0.0.24/hammad/genai/graphs/plugins.py +316 -0
  16. hammad_python-0.0.24/hammad/genai/graphs/types.py +638 -0
  17. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/__init__.py +5 -1
  18. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/model.py +31 -2
  19. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/__init__.py +5 -1
  20. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/model.py +70 -0
  21. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/run.py +29 -12
  22. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_response.py +1 -1
  23. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/types/tools.py +1 -1
  24. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/logging/logger.py +10 -0
  25. {hammad_python-0.0.22 → hammad_python-0.0.24}/pyproject.toml +6 -1
  26. {hammad_python-0.0.22 → hammad_python-0.0.24}/uv.lock +34 -2
  27. hammad_python-0.0.22/hammad/__init__.py +0 -50
  28. {hammad_python-0.0.22 → hammad_python-0.0.24}/.gitignore +0 -0
  29. {hammad_python-0.0.22 → hammad_python-0.0.24}/LICENSE +0 -0
  30. {hammad_python-0.0.22 → hammad_python-0.0.24}/README.md +0 -0
  31. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/__init__.py +0 -0
  32. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/base_cache.py +0 -0
  33. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/cache.py +0 -0
  34. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/decorators.py +0 -0
  35. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/file_cache.py +0 -0
  36. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cache/ttl_cache.py +0 -0
  37. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/__init__.py +0 -0
  38. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/_runner.py +0 -0
  39. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/animations.py +0 -0
  40. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/styles/__init__.py +0 -0
  41. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/styles/settings.py +0 -0
  42. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/styles/types.py +0 -0
  43. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/cli/styles/utils.py +0 -0
  44. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/collection.py +0 -0
  45. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/__init__.py +0 -0
  46. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/qdrant/__init__.py +0 -0
  47. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/qdrant/index.py +0 -0
  48. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/qdrant/settings.py +0 -0
  49. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/qdrant/utils.py +0 -0
  50. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/tantivy/__init__.py +0 -0
  51. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/tantivy/index.py +0 -0
  52. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/tantivy/settings.py +0 -0
  53. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/collections/indexes/tantivy/utils.py +0 -0
  54. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/configurations/__init__.py +0 -0
  55. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/configurations/configuration.py +0 -0
  56. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/__init__.py +0 -0
  57. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/extensions/__init__.py +0 -0
  58. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/extensions/pydantic/__init__.py +0 -0
  59. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/extensions/pydantic/converters.py +0 -0
  60. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/fields.py +0 -0
  61. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/model.py +0 -0
  62. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/models/utils.py +0 -0
  63. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/sql/database.py +0 -0
  64. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/sql/types.py +0 -0
  65. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/__init__.py +0 -0
  66. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/file.py +0 -0
  67. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/multimodal/__init__.py +0 -0
  68. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/multimodal/audio.py +0 -0
  69. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/multimodal/image.py +0 -0
  70. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/data/types/text.py +0 -0
  71. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/__init__.py +0 -0
  72. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/json/__init__.py +0 -0
  73. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/json/converters.py +0 -0
  74. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/text/__init__.py +0 -0
  75. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/text/converters.py +0 -0
  76. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/text/markdown.py +0 -0
  77. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/yaml/__init__.py +0 -0
  78. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/formatting/yaml/converters.py +0 -0
  79. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/__init__.py +0 -0
  80. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_context.py +0 -0
  81. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_event.py +0 -0
  82. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_hooks.py +0 -0
  83. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_messages.py +0 -0
  84. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/agents/types/agent_stream.py +0 -0
  85. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/__init__.py +0 -0
  86. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/run.py +0 -0
  87. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/types/__init__.py +0 -0
  88. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/types/embedding_model_name.py +0 -0
  89. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/types/embedding_model_response.py +0 -0
  90. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/types/embedding_model_run_params.py +0 -0
  91. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/embeddings/types/embedding_model_settings.py +0 -0
  92. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/__init__.py +0 -0
  93. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_instructor_mode.py +0 -0
  94. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_messages.py +0 -0
  95. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_name.py +0 -0
  96. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_request.py +0 -0
  97. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_response_chunk.py +0 -0
  98. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_settings.py +0 -0
  99. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/types/language_model_stream.py +0 -0
  100. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/utils/__init__.py +0 -0
  101. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/utils/requests.py +0 -0
  102. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/language/utils/structured_outputs.py +0 -0
  103. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/model_provider.py +0 -0
  104. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/multimodal.py +0 -0
  105. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/models/reranking.py +0 -0
  106. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/types/__init__.py +0 -0
  107. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/types/base.py +0 -0
  108. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/genai/types/history.py +0 -0
  109. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/logging/__init__.py +0 -0
  110. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/logging/decorators.py +0 -0
  111. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/__init__.py +0 -0
  112. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/client/__init__.py +0 -0
  113. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/client/client.py +0 -0
  114. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/client/client_service.py +0 -0
  115. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/client/settings.py +0 -0
  116. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/servers/__init__.py +0 -0
  117. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/mcp/servers/launcher.py +0 -0
  118. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/py.typed +0 -0
  119. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/runtime/__init__.py +0 -0
  120. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/runtime/decorators.py +0 -0
  121. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/runtime/run.py +0 -0
  122. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/service/__init__.py +0 -0
  123. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/service/create.py +0 -0
  124. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/service/decorators.py +0 -0
  125. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/typing/__init__.py +0 -0
  126. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/__init__.py +0 -0
  127. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/http/__init__.py +0 -0
  128. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/http/client.py +0 -0
  129. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/models.py +0 -0
  130. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/openapi/__init__.py +0 -0
  131. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/openapi/client.py +0 -0
  132. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/search/__init__.py +0 -0
  133. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/search/client.py +0 -0
  134. {hammad_python-0.0.22 → hammad_python-0.0.24}/hammad/web/utils.py +0 -0
  135. {hammad_python-0.0.22 → hammad_python-0.0.24}/mkdocs.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hammad-python
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Author-email: Hammad Saeed <hammadaidev@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -45,6 +45,7 @@ Requires-Dist: fastapi>=0.115.6; extra == 'all'
45
45
  Requires-Dist: instructor>=1.9.0; extra == 'all'
46
46
  Requires-Dist: litellm>=1.73.6; extra == 'all'
47
47
  Requires-Dist: mcp>=1.10.1; extra == 'all'
48
+ Requires-Dist: pydantic-graph>=0.4.2; extra == 'all'
48
49
  Requires-Dist: qdrant-client>=1.14.3; extra == 'all'
49
50
  Requires-Dist: uvicorn>=0.34.0; extra == 'all'
50
51
  Provides-Extra: genai
@@ -52,8 +53,11 @@ Requires-Dist: fastapi>=0.115.6; extra == 'genai'
52
53
  Requires-Dist: instructor>=1.9.0; extra == 'genai'
53
54
  Requires-Dist: litellm>=1.73.6; extra == 'genai'
54
55
  Requires-Dist: mcp>=1.10.1; extra == 'genai'
56
+ Requires-Dist: pydantic-graph>=0.4.2; extra == 'genai'
55
57
  Requires-Dist: qdrant-client>=1.14.3; extra == 'genai'
56
58
  Requires-Dist: uvicorn>=0.34.0; extra == 'genai'
59
+ Provides-Extra: graph
60
+ Requires-Dist: pydantic-graph>=0.4.2; extra == 'graph'
57
61
  Provides-Extra: mcp
58
62
  Requires-Dist: mcp>=1.10.1; extra == 'mcp'
59
63
  Provides-Extra: serve
@@ -0,0 +1,303 @@
1
+ """hammad-python
2
+
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."""
6
+
7
+ from typing import TYPE_CHECKING
8
+ from ._internal import create_getattr_importer as __hammad_importer__
9
+
10
+
11
+ if TYPE_CHECKING:
12
+ # BUILTINS | hammad.cli
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
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
+
160
+
161
+ __all__ = (
162
+ # hammad.cli
163
+ "print",
164
+ "input",
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",
296
+ )
297
+
298
+
299
+ __getattr__ = __hammad_importer__(__all__)
300
+
301
+
302
+ def __dir__() -> list[str]:
303
+ return list(__all__)
@@ -108,7 +108,25 @@ def _parse_type_checking_imports(source_code: str) -> dict[str, tuple[str, str]]
108
108
  # Process imports in this block
109
109
  for stmt in node.body:
110
110
  if isinstance(stmt, ast.ImportFrom) and stmt.module:
111
- module_path = f".{stmt.module}"
111
+ # Only add '.' prefix for relative imports
112
+ # If stmt.level > 0, it's already a relative import
113
+ # If stmt.level == 0 and module doesn't start with '.', it's absolute
114
+ if stmt.level > 0:
115
+ # Already relative import
116
+ module_path = "." * stmt.level + (stmt.module or "")
117
+ elif stmt.module.startswith("."):
118
+ # Explicit relative import
119
+ module_path = stmt.module
120
+ elif any(
121
+ stmt.module.startswith(name)
122
+ for name in ["litellm", "openai", "instructor", "httpx"]
123
+ ):
124
+ # Known absolute third-party imports
125
+ module_path = stmt.module
126
+ else:
127
+ # Default to relative import for internal modules
128
+ module_path = f".{stmt.module}"
129
+
112
130
  for alias in stmt.names:
113
131
  original_name = alias.name
114
132
  local_name = alias.asname or original_name
@@ -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,
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
21
21
  )
22
22
  from .collections import (
23
23
  Collection,
24
+ create_collection,
24
25
  TantivyCollectionIndex,
25
26
  QdrantCollectionIndex,
26
27
  TantivyCollectionIndexSettings,
@@ -54,8 +55,12 @@ __all__ = (
54
55
  "validator",
55
56
  "is_field",
56
57
  "is_model",
58
+ "convert_to_pydantic_model",
59
+ "convert_to_pydantic_field",
60
+ "is_pydantic_model_class",
57
61
  # hammad.data.collections
58
62
  "Collection",
63
+ "create_collection",
59
64
  "TantivyCollectionIndex",
60
65
  "QdrantCollectionIndex",
61
66
  "TantivyCollectionIndexSettings",
@@ -68,6 +73,11 @@ __all__ = (
68
73
  "Database",
69
74
  # hammad.data.configurations
70
75
  "Configuration",
76
+ "read_configuration_from_file",
77
+ "read_configuration_from_url",
78
+ "read_configuration_from_os_vars",
79
+ "read_configuration_from_os_prefix",
80
+ "read_configuration_from_dotenv",
71
81
  )
72
82
 
73
83
 
@@ -4,7 +4,10 @@ from typing import TYPE_CHECKING
4
4
  from ..._internal import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
- from .collection import Collection
7
+ from .collection import (
8
+ Collection,
9
+ create_collection,
10
+ )
8
11
 
9
12
  from .indexes import (
10
13
  TantivyCollectionIndex,
@@ -25,6 +28,7 @@ if TYPE_CHECKING:
25
28
  __all__ = (
26
29
  # hammad.data.collections.collection
27
30
  "Collection",
31
+ "create_collection",
28
32
  # hammad.data.collections.indexes
29
33
  "TantivyCollectionIndex",
30
34
  "QdrantCollectionIndex",
@@ -5,13 +5,14 @@ from ..._internal import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .types import DatabaseItemType, DatabaseItem
8
- from .database import Database
8
+ from .database import Database, create_database
9
9
 
10
10
 
11
11
  __all__ = (
12
12
  "DatabaseItemType",
13
13
  "DatabaseItem",
14
14
  "Database",
15
+ "create_database",
15
16
  )
16
17
 
17
18
 
@@ -13,6 +13,7 @@ if TYPE_CHECKING:
13
13
  AgentContext,
14
14
  AgentMessages,
15
15
  AgentResponseChunk,
16
+ create_agent,
16
17
  )
17
18
  from .agents.run import (
18
19
  run_agent,
@@ -20,6 +21,32 @@ if TYPE_CHECKING:
20
21
  async_run_agent,
21
22
  async_run_agent_iter,
22
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
+ )
23
50
  from .models.embeddings import (
24
51
  Embedding,
25
52
  EmbeddingModel,
@@ -27,6 +54,7 @@ if TYPE_CHECKING:
27
54
  EmbeddingModelSettings,
28
55
  run_embedding_model,
29
56
  async_run_embedding_model,
57
+ create_embedding_model,
30
58
  )
31
59
  from .models.language import (
32
60
  LanguageModel,
@@ -40,6 +68,7 @@ if TYPE_CHECKING:
40
68
  LanguageModelStream,
41
69
  run_language_model,
42
70
  async_run_language_model,
71
+ create_language_model,
43
72
  )
44
73
  from .models.reranking import run_reranking_model, async_run_reranking_model
45
74
  from .models.multimodal import (
@@ -78,11 +107,37 @@ __all__ = [
78
107
  "AgentContext",
79
108
  "AgentMessages",
80
109
  "AgentResponseChunk",
110
+ "create_agent",
81
111
  # hammad.genai.agents.run
82
112
  "run_agent",
83
113
  "run_agent_iter",
84
114
  "async_run_agent",
85
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",
86
141
  # hammad.genai.models.embeddings
87
142
  "Embedding",
88
143
  "EmbeddingModel",
@@ -90,6 +145,7 @@ __all__ = [
90
145
  "EmbeddingModelSettings",
91
146
  "run_embedding_model",
92
147
  "async_run_embedding_model",
148
+ "create_embedding_model",
93
149
  # hammad.genai.models.language
94
150
  "LanguageModel",
95
151
  "LanguageModelInstructorMode",
@@ -102,6 +158,7 @@ __all__ = [
102
158
  "LanguageModelStream",
103
159
  "run_language_model",
104
160
  "async_run_language_model",
161
+ "create_language_model",
105
162
  # hammad.genai.models.reranking
106
163
  "run_reranking_model",
107
164
  "async_run_reranking_model",
@@ -5,7 +5,11 @@ from ..._internal import create_getattr_importer
5
5
 
6
6
 
7
7
  if TYPE_CHECKING:
8
- from .agent import Agent
8
+ from .agent import (
9
+ Agent,
10
+ create_agent,
11
+ )
12
+ from .run import run_agent, run_agent_iter, async_run_agent, async_run_agent_iter
9
13
 
10
14
  # Types
11
15
  from .types.agent_context import AgentContext
@@ -22,6 +26,12 @@ if TYPE_CHECKING:
22
26
  __all__ = [
23
27
  # hammad.genai.agents.agent
24
28
  "Agent",
29
+ "create_agent",
30
+ # hammad.genai.agents.run
31
+ "run_agent",
32
+ "run_agent_iter",
33
+ "async_run_agent",
34
+ "async_run_agent_iter",
25
35
  # hammad.genai.agents.types.agent_context
26
36
  "AgentContext",
27
37
  # hammad.genai.agents.types.agent_event