hammad-python 0.0.30__py3-none-any.whl → 0.0.32__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.
Files changed (137) hide show
  1. ham/__init__.py +200 -0
  2. {hammad_python-0.0.30.dist-info → hammad_python-0.0.32.dist-info}/METADATA +6 -32
  3. hammad_python-0.0.32.dist-info/RECORD +6 -0
  4. hammad/__init__.py +0 -84
  5. hammad/_internal.py +0 -256
  6. hammad/_main.py +0 -226
  7. hammad/cache/__init__.py +0 -40
  8. hammad/cache/base_cache.py +0 -181
  9. hammad/cache/cache.py +0 -169
  10. hammad/cache/decorators.py +0 -261
  11. hammad/cache/file_cache.py +0 -80
  12. hammad/cache/ttl_cache.py +0 -74
  13. hammad/cli/__init__.py +0 -33
  14. hammad/cli/animations.py +0 -573
  15. hammad/cli/plugins.py +0 -867
  16. hammad/cli/styles/__init__.py +0 -55
  17. hammad/cli/styles/settings.py +0 -139
  18. hammad/cli/styles/types.py +0 -358
  19. hammad/cli/styles/utils.py +0 -634
  20. hammad/data/__init__.py +0 -90
  21. hammad/data/collections/__init__.py +0 -49
  22. hammad/data/collections/collection.py +0 -326
  23. hammad/data/collections/indexes/__init__.py +0 -37
  24. hammad/data/collections/indexes/qdrant/__init__.py +0 -1
  25. hammad/data/collections/indexes/qdrant/index.py +0 -723
  26. hammad/data/collections/indexes/qdrant/settings.py +0 -94
  27. hammad/data/collections/indexes/qdrant/utils.py +0 -210
  28. hammad/data/collections/indexes/tantivy/__init__.py +0 -1
  29. hammad/data/collections/indexes/tantivy/index.py +0 -426
  30. hammad/data/collections/indexes/tantivy/settings.py +0 -40
  31. hammad/data/collections/indexes/tantivy/utils.py +0 -176
  32. hammad/data/configurations/__init__.py +0 -35
  33. hammad/data/configurations/configuration.py +0 -564
  34. hammad/data/models/__init__.py +0 -50
  35. hammad/data/models/extensions/__init__.py +0 -4
  36. hammad/data/models/extensions/pydantic/__init__.py +0 -42
  37. hammad/data/models/extensions/pydantic/converters.py +0 -759
  38. hammad/data/models/fields.py +0 -546
  39. hammad/data/models/model.py +0 -1078
  40. hammad/data/models/utils.py +0 -280
  41. hammad/data/sql/__init__.py +0 -24
  42. hammad/data/sql/database.py +0 -576
  43. hammad/data/sql/types.py +0 -127
  44. hammad/data/types/__init__.py +0 -75
  45. hammad/data/types/file.py +0 -431
  46. hammad/data/types/multimodal/__init__.py +0 -36
  47. hammad/data/types/multimodal/audio.py +0 -200
  48. hammad/data/types/multimodal/image.py +0 -182
  49. hammad/data/types/text.py +0 -1308
  50. hammad/formatting/__init__.py +0 -33
  51. hammad/formatting/json/__init__.py +0 -27
  52. hammad/formatting/json/converters.py +0 -158
  53. hammad/formatting/text/__init__.py +0 -63
  54. hammad/formatting/text/converters.py +0 -723
  55. hammad/formatting/text/markdown.py +0 -131
  56. hammad/formatting/yaml/__init__.py +0 -26
  57. hammad/formatting/yaml/converters.py +0 -5
  58. hammad/genai/__init__.py +0 -217
  59. hammad/genai/a2a/__init__.py +0 -32
  60. hammad/genai/a2a/workers.py +0 -552
  61. hammad/genai/agents/__init__.py +0 -59
  62. hammad/genai/agents/agent.py +0 -1973
  63. hammad/genai/agents/run.py +0 -1024
  64. hammad/genai/agents/types/__init__.py +0 -42
  65. hammad/genai/agents/types/agent_context.py +0 -13
  66. hammad/genai/agents/types/agent_event.py +0 -128
  67. hammad/genai/agents/types/agent_hooks.py +0 -220
  68. hammad/genai/agents/types/agent_messages.py +0 -31
  69. hammad/genai/agents/types/agent_response.py +0 -125
  70. hammad/genai/agents/types/agent_stream.py +0 -327
  71. hammad/genai/graphs/__init__.py +0 -125
  72. hammad/genai/graphs/_utils.py +0 -190
  73. hammad/genai/graphs/base.py +0 -1828
  74. hammad/genai/graphs/plugins.py +0 -316
  75. hammad/genai/graphs/types.py +0 -638
  76. hammad/genai/models/__init__.py +0 -1
  77. hammad/genai/models/embeddings/__init__.py +0 -43
  78. hammad/genai/models/embeddings/model.py +0 -226
  79. hammad/genai/models/embeddings/run.py +0 -163
  80. hammad/genai/models/embeddings/types/__init__.py +0 -37
  81. hammad/genai/models/embeddings/types/embedding_model_name.py +0 -75
  82. hammad/genai/models/embeddings/types/embedding_model_response.py +0 -76
  83. hammad/genai/models/embeddings/types/embedding_model_run_params.py +0 -66
  84. hammad/genai/models/embeddings/types/embedding_model_settings.py +0 -47
  85. hammad/genai/models/language/__init__.py +0 -57
  86. hammad/genai/models/language/model.py +0 -1098
  87. hammad/genai/models/language/run.py +0 -878
  88. hammad/genai/models/language/types/__init__.py +0 -40
  89. hammad/genai/models/language/types/language_model_instructor_mode.py +0 -47
  90. hammad/genai/models/language/types/language_model_messages.py +0 -28
  91. hammad/genai/models/language/types/language_model_name.py +0 -239
  92. hammad/genai/models/language/types/language_model_request.py +0 -127
  93. hammad/genai/models/language/types/language_model_response.py +0 -217
  94. hammad/genai/models/language/types/language_model_response_chunk.py +0 -56
  95. hammad/genai/models/language/types/language_model_settings.py +0 -89
  96. hammad/genai/models/language/types/language_model_stream.py +0 -600
  97. hammad/genai/models/language/utils/__init__.py +0 -28
  98. hammad/genai/models/language/utils/requests.py +0 -421
  99. hammad/genai/models/language/utils/structured_outputs.py +0 -135
  100. hammad/genai/models/model_provider.py +0 -4
  101. hammad/genai/models/multimodal.py +0 -47
  102. hammad/genai/models/reranking.py +0 -26
  103. hammad/genai/types/__init__.py +0 -1
  104. hammad/genai/types/base.py +0 -215
  105. hammad/genai/types/history.py +0 -290
  106. hammad/genai/types/tools.py +0 -507
  107. hammad/logging/__init__.py +0 -35
  108. hammad/logging/decorators.py +0 -834
  109. hammad/logging/logger.py +0 -1018
  110. hammad/mcp/__init__.py +0 -53
  111. hammad/mcp/client/__init__.py +0 -35
  112. hammad/mcp/client/client.py +0 -624
  113. hammad/mcp/client/client_service.py +0 -400
  114. hammad/mcp/client/settings.py +0 -178
  115. hammad/mcp/servers/__init__.py +0 -26
  116. hammad/mcp/servers/launcher.py +0 -1161
  117. hammad/runtime/__init__.py +0 -32
  118. hammad/runtime/decorators.py +0 -142
  119. hammad/runtime/run.py +0 -299
  120. hammad/service/__init__.py +0 -49
  121. hammad/service/create.py +0 -527
  122. hammad/service/decorators.py +0 -283
  123. hammad/types.py +0 -288
  124. hammad/typing/__init__.py +0 -435
  125. hammad/web/__init__.py +0 -43
  126. hammad/web/http/__init__.py +0 -1
  127. hammad/web/http/client.py +0 -944
  128. hammad/web/models.py +0 -275
  129. hammad/web/openapi/__init__.py +0 -1
  130. hammad/web/openapi/client.py +0 -740
  131. hammad/web/search/__init__.py +0 -1
  132. hammad/web/search/client.py +0 -1023
  133. hammad/web/utils.py +0 -472
  134. hammad_python-0.0.30.dist-info/RECORD +0 -135
  135. {hammad → ham}/py.typed +0 -0
  136. {hammad_python-0.0.30.dist-info → hammad_python-0.0.32.dist-info}/WHEEL +0 -0
  137. {hammad_python-0.0.30.dist-info → hammad_python-0.0.32.dist-info}/licenses/LICENSE +0 -0
@@ -1,131 +0,0 @@
1
- """hammad.formatting.text.markdown"""
2
-
3
- from typing import (
4
- List,
5
- Literal,
6
- Optional,
7
- )
8
-
9
- __all__ = (
10
- "markdown_bold",
11
- "markdown_italic",
12
- "markdown_code",
13
- "markdown_code_block",
14
- "markdown_heading",
15
- "markdown_link",
16
- "markdown_list_item",
17
- "markdown_table_row",
18
- "markdown_blockquote",
19
- "markdown_horizontal_rule",
20
- "markdown_table",
21
- )
22
-
23
-
24
- def markdown_bold(text: str) -> str:
25
- """Format text as bold in Markdown."""
26
- return f"**{text}**"
27
-
28
-
29
- def markdown_italic(text: str) -> str:
30
- """Format text as italic in Markdown."""
31
- return f"*{text}*"
32
-
33
-
34
- def markdown_code(text: str) -> str:
35
- """Format text as inline code in Markdown."""
36
- return f"`{text}`"
37
-
38
-
39
- def markdown_code_block(text: str, language: str = "") -> str:
40
- """Format text as a code block in Markdown."""
41
- return f"```{language}\n{text}\n```"
42
-
43
-
44
- def markdown_heading(text: str, level: int = 1) -> str:
45
- """Format text as a heading in Markdown."""
46
- if not 1 <= level <= 6:
47
- level = 1
48
- return f"{'#' * level} {text}"
49
-
50
-
51
- def markdown_link(text: str, url: str) -> str:
52
- """Format text as a link in Markdown."""
53
- return f"[{text}]({url})"
54
-
55
-
56
- def markdown_list_item(
57
- text: str, level: int = 0, ordered: bool = False, index: int = 1
58
- ) -> str:
59
- """Format text as a list item in Markdown."""
60
- indent = " " * level
61
- marker = f"{index}." if ordered else "-"
62
- return f"{indent}{marker} {text}"
63
-
64
-
65
- def markdown_table_row(cells: List[str], is_header: bool = False) -> str:
66
- """Format a table row in Markdown."""
67
- row = "| " + " | ".join(cells) + " |"
68
- if is_header:
69
- separator = "|" + "|".join([" --- " for _ in cells]) + "|"
70
- return f"{row}\n{separator}"
71
- return row
72
-
73
-
74
- def markdown_blockquote(text: str, level: int = 1) -> str:
75
- """Format text as a blockquote in Markdown."""
76
- prefix = ">" * level + " "
77
- lines = text.split("\n")
78
- return "\n".join(f"{prefix}{line}" for line in lines)
79
-
80
-
81
- def markdown_horizontal_rule() -> str:
82
- """Create a horizontal rule in Markdown."""
83
- return "---"
84
-
85
-
86
- def markdown_table(
87
- headers: List[str],
88
- rows: List[List[str]],
89
- alignment: Optional[List[Literal["left", "center", "right"]]] = None,
90
- ) -> str:
91
- """
92
- Create a Markdown table from headers and rows.
93
-
94
- Args:
95
- headers: List of header strings
96
- rows: List of row data (each row is a list of strings)
97
- alignment: Optional list of alignments for each column
98
-
99
- Returns:
100
- Formatted Markdown table
101
- """
102
- if not headers:
103
- return ""
104
-
105
- parts = []
106
-
107
- # Add header
108
- parts.append("| " + " | ".join(headers) + " |")
109
-
110
- # Add separator with alignment
111
- separators = []
112
- for i, header in enumerate(headers):
113
- if alignment and i < len(alignment):
114
- align = alignment[i]
115
- if align == "center":
116
- separators.append(" :---: ")
117
- elif align == "right":
118
- separators.append(" ---: ")
119
- else:
120
- separators.append(" --- ")
121
- else:
122
- separators.append(" --- ")
123
- parts.append("|" + "|".join(separators) + "|")
124
-
125
- # Add rows
126
- for row in rows:
127
- # Ensure row has same number of columns as headers
128
- padded_row = row + [""] * (len(headers) - len(row))
129
- parts.append("| " + " | ".join(padded_row[: len(headers)]) + " |")
130
-
131
- return "\n".join(parts)
@@ -1,26 +0,0 @@
1
- """hammad.formatting.yaml
2
-
3
- Simply extends the `msgspec.yaml` submodule."""
4
-
5
- from typing import TYPE_CHECKING
6
- from ..._internal import create_getattr_importer
7
-
8
- if TYPE_CHECKING:
9
- from .converters import (
10
- encode_yaml,
11
- decode_yaml,
12
- )
13
-
14
-
15
- __all__ = (
16
- "encode_yaml",
17
- "decode_yaml",
18
- )
19
-
20
-
21
- __getattr__ = create_getattr_importer(__all__)
22
-
23
-
24
- def __dir__() -> list[str]:
25
- """Get the attributes of the yaml module."""
26
- return list(__all__)
@@ -1,5 +0,0 @@
1
- """hammad.formatting.yaml.converters"""
2
-
3
- from msgspec.yaml import encode as encode_yaml, decode as decode_yaml
4
-
5
- __all__ = ("encode_yaml", "decode_yaml")
hammad/genai/__init__.py DELETED
@@ -1,217 +0,0 @@
1
- """hammad.genai"""
2
-
3
- from typing import TYPE_CHECKING
4
- from .._internal import create_getattr_importer
5
-
6
-
7
- if TYPE_CHECKING:
8
- from .a2a import (
9
- as_a2a_app,
10
- GraphWorker,
11
- AgentWorker,
12
- )
13
- if TYPE_CHECKING:
14
- from .agents import (
15
- Agent,
16
- AgentEvent,
17
- AgentSettings,
18
- AgentResponse,
19
- AgentStream,
20
- AgentContext,
21
- AgentMessages,
22
- AgentResponseChunk,
23
- create_agent,
24
- )
25
- from .agents.run import (
26
- run_agent,
27
- run_agent_iter,
28
- async_run_agent,
29
- async_run_agent_iter,
30
- agent_decorator,
31
- )
32
- from .graphs import (
33
- GraphBuilder,
34
- GraphContext,
35
- GraphEnd,
36
- GraphEvent,
37
- GraphHistoryEntry,
38
- GraphNode,
39
- GraphState,
40
- GraphResponse,
41
- GraphStream,
42
- GraphResponseChunk,
43
- BaseGraph,
44
- BasePlugin,
45
- PluginDecorator,
46
- PydanticGraphContext,
47
- AudioPlugin,
48
- ServePlugin,
49
- MemoryPlugin,
50
- HistoryPlugin,
51
- SettingsPlugin,
52
- ActionNode,
53
- ActionInfo,
54
- ActionSettings,
55
- action,
56
- plugin,
57
- select,
58
- SelectionStrategy,
59
- ActionDecorator,
60
- )
61
- from .models.embeddings import (
62
- Embedding,
63
- EmbeddingModel,
64
- EmbeddingModelResponse,
65
- EmbeddingModelSettings,
66
- run_embedding_model,
67
- async_run_embedding_model,
68
- create_embedding_model,
69
- )
70
- from .models.language import (
71
- LanguageModel,
72
- LanguageModelInstructorMode,
73
- LanguageModelMessages,
74
- LanguageModelName,
75
- LanguageModelRequest,
76
- LanguageModelResponse,
77
- LanguageModelResponseChunk,
78
- LanguageModelSettings,
79
- LanguageModelStream,
80
- run_language_model,
81
- async_run_language_model,
82
- language_model_decorator,
83
- create_language_model,
84
- )
85
- from .models.reranking import run_reranking_model, async_run_reranking_model
86
- from .models.multimodal import (
87
- run_image_edit_model,
88
- run_image_generation_model,
89
- run_image_variation_model,
90
- run_transcription_model,
91
- run_tts_model,
92
- async_run_image_edit_model,
93
- async_run_image_generation_model,
94
- async_run_image_variation_model,
95
- async_run_transcription_model,
96
- async_run_tts_model,
97
- )
98
- from .types.base import (
99
- BaseGenAIModel,
100
- BaseGenAIModelEvent,
101
- BaseGenAIModelResponse,
102
- BaseGenAIModelSettings,
103
- BaseGenAIModelStream,
104
- )
105
- from .types.history import History
106
- from .types.tools import (
107
- Tool,
108
- define_tool,
109
- execute_tools_from_language_model_response,
110
- )
111
-
112
-
113
- __all__ = [
114
- # hammad.genai.a2a
115
- "as_a2a_app",
116
- "GraphWorker",
117
- "AgentWorker",
118
- # hammad.genai.agents.agent
119
- "Agent",
120
- "AgentEvent",
121
- "AgentSettings",
122
- "AgentResponse",
123
- "AgentStream",
124
- "AgentContext",
125
- "AgentMessages",
126
- "AgentResponseChunk",
127
- "create_agent",
128
- # hammad.genai.agents.run
129
- "run_agent",
130
- "run_agent_iter",
131
- "async_run_agent",
132
- "async_run_agent_iter",
133
- "agent_decorator",
134
- # hammad.genai.graphs
135
- "GraphBuilder",
136
- "GraphContext",
137
- "GraphEnd",
138
- "GraphEvent",
139
- "GraphHistoryEntry",
140
- "GraphNode",
141
- "GraphState",
142
- "GraphResponse",
143
- "GraphStream",
144
- "GraphResponseChunk",
145
- "BaseGraph",
146
- "BasePlugin",
147
- "PluginDecorator",
148
- "PydanticGraphContext",
149
- "AudioPlugin",
150
- "ServePlugin",
151
- "MemoryPlugin",
152
- "HistoryPlugin",
153
- "SettingsPlugin",
154
- "ActionNode",
155
- "ActionInfo",
156
- "ActionSettings",
157
- "action",
158
- "plugin",
159
- "select",
160
- "SelectionStrategy",
161
- "ActionDecorator",
162
- # hammad.genai.models.embeddings
163
- "Embedding",
164
- "EmbeddingModel",
165
- "EmbeddingModelResponse",
166
- "EmbeddingModelSettings",
167
- "run_embedding_model",
168
- "async_run_embedding_model",
169
- "create_embedding_model",
170
- # hammad.genai.models.language
171
- "LanguageModel",
172
- "LanguageModelInstructorMode",
173
- "LanguageModelMessages",
174
- "LanguageModelName",
175
- "LanguageModelRequest",
176
- "LanguageModelResponse",
177
- "LanguageModelResponseChunk",
178
- "LanguageModelSettings",
179
- "LanguageModelStream",
180
- "run_language_model",
181
- "async_run_language_model",
182
- "create_language_model",
183
- "language_model_decorator",
184
- # hammad.genai.models.reranking
185
- "run_reranking_model",
186
- "async_run_reranking_model",
187
- # hammad.genai.models.multimodal
188
- "run_image_edit_model",
189
- "run_image_generation_model",
190
- "run_image_variation_model",
191
- "run_transcription_model",
192
- "run_tts_model",
193
- "async_run_image_edit_model",
194
- "async_run_image_generation_model",
195
- "async_run_image_variation_model",
196
- "async_run_transcription_model",
197
- "async_run_tts_model",
198
- # hammad.genai.types.base
199
- "BaseGenAIModel",
200
- "BaseGenAIModelEvent",
201
- "BaseGenAIModelResponse",
202
- "BaseGenAIModelSettings",
203
- "BaseGenAIModelStream",
204
- # hammad.genai.types.history
205
- "History",
206
- # hammad.genai.types.tools
207
- "Tool",
208
- "define_tool",
209
- "execute_tools_from_language_model_response",
210
- ]
211
-
212
-
213
- __getattr__ = create_getattr_importer(__all__)
214
-
215
-
216
- def __dir__() -> list[str]:
217
- return __all__
@@ -1,32 +0,0 @@
1
- """hammad.genai.a2a"""
2
-
3
- from typing import TYPE_CHECKING
4
- from ..._internal import create_getattr_importer
5
-
6
-
7
- if TYPE_CHECKING:
8
- from fasta2a import (
9
- FastA2A
10
- )
11
- from .workers import (
12
- as_a2a_app,
13
- GraphWorker,
14
- AgentWorker,
15
- )
16
-
17
-
18
- __all__ = (
19
- # fasta2a
20
- "FastA2A",
21
- # hammad.genai.a2a.workers
22
- "as_a2a_app",
23
- "GraphWorker",
24
- "AgentWorker",
25
- )
26
-
27
-
28
- __getattr__ = create_getattr_importer(__all__)
29
-
30
-
31
- def __dir__() -> list[str]:
32
- return list(__all__)