hammad-python 0.0.30__py3-none-any.whl → 0.0.31__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.
- ham/__init__.py +10 -0
- {hammad_python-0.0.30.dist-info → hammad_python-0.0.31.dist-info}/METADATA +6 -32
- hammad_python-0.0.31.dist-info/RECORD +6 -0
- hammad/__init__.py +0 -84
- hammad/_internal.py +0 -256
- hammad/_main.py +0 -226
- hammad/cache/__init__.py +0 -40
- hammad/cache/base_cache.py +0 -181
- hammad/cache/cache.py +0 -169
- hammad/cache/decorators.py +0 -261
- hammad/cache/file_cache.py +0 -80
- hammad/cache/ttl_cache.py +0 -74
- hammad/cli/__init__.py +0 -33
- hammad/cli/animations.py +0 -573
- hammad/cli/plugins.py +0 -867
- hammad/cli/styles/__init__.py +0 -55
- hammad/cli/styles/settings.py +0 -139
- hammad/cli/styles/types.py +0 -358
- hammad/cli/styles/utils.py +0 -634
- hammad/data/__init__.py +0 -90
- hammad/data/collections/__init__.py +0 -49
- hammad/data/collections/collection.py +0 -326
- hammad/data/collections/indexes/__init__.py +0 -37
- hammad/data/collections/indexes/qdrant/__init__.py +0 -1
- hammad/data/collections/indexes/qdrant/index.py +0 -723
- hammad/data/collections/indexes/qdrant/settings.py +0 -94
- hammad/data/collections/indexes/qdrant/utils.py +0 -210
- hammad/data/collections/indexes/tantivy/__init__.py +0 -1
- hammad/data/collections/indexes/tantivy/index.py +0 -426
- hammad/data/collections/indexes/tantivy/settings.py +0 -40
- hammad/data/collections/indexes/tantivy/utils.py +0 -176
- hammad/data/configurations/__init__.py +0 -35
- hammad/data/configurations/configuration.py +0 -564
- hammad/data/models/__init__.py +0 -50
- hammad/data/models/extensions/__init__.py +0 -4
- hammad/data/models/extensions/pydantic/__init__.py +0 -42
- hammad/data/models/extensions/pydantic/converters.py +0 -759
- hammad/data/models/fields.py +0 -546
- hammad/data/models/model.py +0 -1078
- hammad/data/models/utils.py +0 -280
- hammad/data/sql/__init__.py +0 -24
- hammad/data/sql/database.py +0 -576
- hammad/data/sql/types.py +0 -127
- hammad/data/types/__init__.py +0 -75
- hammad/data/types/file.py +0 -431
- hammad/data/types/multimodal/__init__.py +0 -36
- hammad/data/types/multimodal/audio.py +0 -200
- hammad/data/types/multimodal/image.py +0 -182
- hammad/data/types/text.py +0 -1308
- hammad/formatting/__init__.py +0 -33
- hammad/formatting/json/__init__.py +0 -27
- hammad/formatting/json/converters.py +0 -158
- hammad/formatting/text/__init__.py +0 -63
- hammad/formatting/text/converters.py +0 -723
- hammad/formatting/text/markdown.py +0 -131
- hammad/formatting/yaml/__init__.py +0 -26
- hammad/formatting/yaml/converters.py +0 -5
- hammad/genai/__init__.py +0 -217
- hammad/genai/a2a/__init__.py +0 -32
- hammad/genai/a2a/workers.py +0 -552
- hammad/genai/agents/__init__.py +0 -59
- hammad/genai/agents/agent.py +0 -1973
- hammad/genai/agents/run.py +0 -1024
- hammad/genai/agents/types/__init__.py +0 -42
- hammad/genai/agents/types/agent_context.py +0 -13
- hammad/genai/agents/types/agent_event.py +0 -128
- hammad/genai/agents/types/agent_hooks.py +0 -220
- hammad/genai/agents/types/agent_messages.py +0 -31
- hammad/genai/agents/types/agent_response.py +0 -125
- hammad/genai/agents/types/agent_stream.py +0 -327
- hammad/genai/graphs/__init__.py +0 -125
- hammad/genai/graphs/_utils.py +0 -190
- hammad/genai/graphs/base.py +0 -1828
- hammad/genai/graphs/plugins.py +0 -316
- hammad/genai/graphs/types.py +0 -638
- hammad/genai/models/__init__.py +0 -1
- hammad/genai/models/embeddings/__init__.py +0 -43
- hammad/genai/models/embeddings/model.py +0 -226
- hammad/genai/models/embeddings/run.py +0 -163
- hammad/genai/models/embeddings/types/__init__.py +0 -37
- hammad/genai/models/embeddings/types/embedding_model_name.py +0 -75
- hammad/genai/models/embeddings/types/embedding_model_response.py +0 -76
- hammad/genai/models/embeddings/types/embedding_model_run_params.py +0 -66
- hammad/genai/models/embeddings/types/embedding_model_settings.py +0 -47
- hammad/genai/models/language/__init__.py +0 -57
- hammad/genai/models/language/model.py +0 -1098
- hammad/genai/models/language/run.py +0 -878
- hammad/genai/models/language/types/__init__.py +0 -40
- hammad/genai/models/language/types/language_model_instructor_mode.py +0 -47
- hammad/genai/models/language/types/language_model_messages.py +0 -28
- hammad/genai/models/language/types/language_model_name.py +0 -239
- hammad/genai/models/language/types/language_model_request.py +0 -127
- hammad/genai/models/language/types/language_model_response.py +0 -217
- hammad/genai/models/language/types/language_model_response_chunk.py +0 -56
- hammad/genai/models/language/types/language_model_settings.py +0 -89
- hammad/genai/models/language/types/language_model_stream.py +0 -600
- hammad/genai/models/language/utils/__init__.py +0 -28
- hammad/genai/models/language/utils/requests.py +0 -421
- hammad/genai/models/language/utils/structured_outputs.py +0 -135
- hammad/genai/models/model_provider.py +0 -4
- hammad/genai/models/multimodal.py +0 -47
- hammad/genai/models/reranking.py +0 -26
- hammad/genai/types/__init__.py +0 -1
- hammad/genai/types/base.py +0 -215
- hammad/genai/types/history.py +0 -290
- hammad/genai/types/tools.py +0 -507
- hammad/logging/__init__.py +0 -35
- hammad/logging/decorators.py +0 -834
- hammad/logging/logger.py +0 -1018
- hammad/mcp/__init__.py +0 -53
- hammad/mcp/client/__init__.py +0 -35
- hammad/mcp/client/client.py +0 -624
- hammad/mcp/client/client_service.py +0 -400
- hammad/mcp/client/settings.py +0 -178
- hammad/mcp/servers/__init__.py +0 -26
- hammad/mcp/servers/launcher.py +0 -1161
- hammad/runtime/__init__.py +0 -32
- hammad/runtime/decorators.py +0 -142
- hammad/runtime/run.py +0 -299
- hammad/service/__init__.py +0 -49
- hammad/service/create.py +0 -527
- hammad/service/decorators.py +0 -283
- hammad/types.py +0 -288
- hammad/typing/__init__.py +0 -435
- hammad/web/__init__.py +0 -43
- hammad/web/http/__init__.py +0 -1
- hammad/web/http/client.py +0 -944
- hammad/web/models.py +0 -275
- hammad/web/openapi/__init__.py +0 -1
- hammad/web/openapi/client.py +0 -740
- hammad/web/search/__init__.py +0 -1
- hammad/web/search/client.py +0 -1023
- hammad/web/utils.py +0 -472
- hammad_python-0.0.30.dist-info/RECORD +0 -135
- {hammad → ham}/py.typed +0 -0
- {hammad_python-0.0.30.dist-info → hammad_python-0.0.31.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.30.dist-info → hammad_python-0.0.31.dist-info}/licenses/LICENSE +0 -0
hammad/web/models.py
DELETED
@@ -1,275 +0,0 @@
|
|
1
|
-
"""hammad.web.models
|
2
|
-
|
3
|
-
Output models for web search and parsing functionality.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from __future__ import annotations
|
7
|
-
|
8
|
-
from typing import List, Dict, Any, Optional, Union
|
9
|
-
|
10
|
-
from pydantic import BaseModel, Field
|
11
|
-
|
12
|
-
|
13
|
-
# -----------------------------------------------------------------------------
|
14
|
-
# Search Result Models
|
15
|
-
# -----------------------------------------------------------------------------
|
16
|
-
|
17
|
-
|
18
|
-
class SearchResult(BaseModel):
|
19
|
-
"""DuckDuckGo web search result."""
|
20
|
-
|
21
|
-
title: str
|
22
|
-
"""Title of the search result."""
|
23
|
-
|
24
|
-
href: str
|
25
|
-
"""URL of the search result."""
|
26
|
-
|
27
|
-
body: str
|
28
|
-
"""Description/snippet of the search result."""
|
29
|
-
|
30
|
-
|
31
|
-
class NewsResult(BaseModel):
|
32
|
-
"""DuckDuckGo news search result."""
|
33
|
-
|
34
|
-
date: str
|
35
|
-
"""Publication date of the news article."""
|
36
|
-
|
37
|
-
title: str
|
38
|
-
"""Title of the news article."""
|
39
|
-
|
40
|
-
body: str
|
41
|
-
"""Description/snippet of the news article."""
|
42
|
-
|
43
|
-
url: str
|
44
|
-
"""URL of the news article."""
|
45
|
-
|
46
|
-
image: str
|
47
|
-
"""Image URL associated with the news article."""
|
48
|
-
|
49
|
-
source: str
|
50
|
-
"""Source/publisher of the news article."""
|
51
|
-
|
52
|
-
|
53
|
-
# -----------------------------------------------------------------------------
|
54
|
-
# Web Page Parsing Models
|
55
|
-
# -----------------------------------------------------------------------------
|
56
|
-
|
57
|
-
|
58
|
-
class LinkInfo(BaseModel):
|
59
|
-
"""Information about a link extracted from a web page."""
|
60
|
-
|
61
|
-
href: str
|
62
|
-
"""Absolute URL of the link."""
|
63
|
-
|
64
|
-
text: str
|
65
|
-
"""Text content of the link."""
|
66
|
-
|
67
|
-
|
68
|
-
class ImageInfo(BaseModel):
|
69
|
-
"""Information about an image extracted from a web page."""
|
70
|
-
|
71
|
-
src: str
|
72
|
-
"""Source URL of the image."""
|
73
|
-
|
74
|
-
alt: str
|
75
|
-
"""Alt text of the image."""
|
76
|
-
|
77
|
-
title: str
|
78
|
-
"""Title attribute of the image."""
|
79
|
-
|
80
|
-
|
81
|
-
class SelectedElement(BaseModel):
|
82
|
-
"""Information about a selected element from CSS selector."""
|
83
|
-
|
84
|
-
tag: str
|
85
|
-
"""HTML tag name of the element."""
|
86
|
-
|
87
|
-
text: str
|
88
|
-
"""Text content of the element."""
|
89
|
-
|
90
|
-
html: str
|
91
|
-
"""HTML content of the element."""
|
92
|
-
|
93
|
-
attributes: Dict[str, str]
|
94
|
-
"""Attributes of the element."""
|
95
|
-
|
96
|
-
|
97
|
-
class WebPageResult(BaseModel):
|
98
|
-
"""Result from parsing a single web page."""
|
99
|
-
|
100
|
-
url: str
|
101
|
-
"""URL of the parsed page."""
|
102
|
-
|
103
|
-
status_code: int
|
104
|
-
"""HTTP status code of the response."""
|
105
|
-
|
106
|
-
content_type: str
|
107
|
-
"""Content-Type header from the response."""
|
108
|
-
|
109
|
-
title: str
|
110
|
-
"""Title of the web page."""
|
111
|
-
|
112
|
-
text: str
|
113
|
-
"""Extracted text content of the page."""
|
114
|
-
|
115
|
-
links: List[LinkInfo]
|
116
|
-
"""List of links found on the page."""
|
117
|
-
|
118
|
-
images: List[ImageInfo]
|
119
|
-
"""List of images found on the page."""
|
120
|
-
|
121
|
-
selected_elements: List[SelectedElement]
|
122
|
-
"""List of elements matching the CSS selector."""
|
123
|
-
|
124
|
-
|
125
|
-
class WebPageErrorResult(BaseModel):
|
126
|
-
"""Result from a failed web page parsing attempt."""
|
127
|
-
|
128
|
-
url: str
|
129
|
-
"""URL that failed to be parsed."""
|
130
|
-
|
131
|
-
error: str
|
132
|
-
"""Error message describing what went wrong."""
|
133
|
-
|
134
|
-
status_code: Optional[int]
|
135
|
-
"""Always None for error results."""
|
136
|
-
|
137
|
-
content_type: str
|
138
|
-
"""Always empty string for error results."""
|
139
|
-
|
140
|
-
title: str
|
141
|
-
"""Always empty string for error results."""
|
142
|
-
|
143
|
-
text: str
|
144
|
-
"""Always empty string for error results."""
|
145
|
-
|
146
|
-
links: List[LinkInfo]
|
147
|
-
"""Always empty list for error results."""
|
148
|
-
|
149
|
-
images: List[ImageInfo]
|
150
|
-
"""Always empty list for error results."""
|
151
|
-
|
152
|
-
selected_elements: List[SelectedElement]
|
153
|
-
"""Always empty list for error results."""
|
154
|
-
|
155
|
-
|
156
|
-
# -----------------------------------------------------------------------------
|
157
|
-
# Enhanced Link Models
|
158
|
-
# -----------------------------------------------------------------------------
|
159
|
-
|
160
|
-
|
161
|
-
class ExtractedLink(BaseModel):
|
162
|
-
"""Information about a link extracted with classification."""
|
163
|
-
|
164
|
-
href: str
|
165
|
-
"""Absolute URL of the link."""
|
166
|
-
|
167
|
-
original_href: str
|
168
|
-
"""Original href attribute value (may be relative)."""
|
169
|
-
|
170
|
-
text: str
|
171
|
-
"""Text content of the link."""
|
172
|
-
|
173
|
-
title: str
|
174
|
-
"""Title attribute of the link."""
|
175
|
-
|
176
|
-
type: str
|
177
|
-
"""Type of link: 'internal' or 'external'."""
|
178
|
-
|
179
|
-
|
180
|
-
# -----------------------------------------------------------------------------
|
181
|
-
# HTTP Request Models
|
182
|
-
# -----------------------------------------------------------------------------
|
183
|
-
|
184
|
-
|
185
|
-
class HttpResponse(BaseModel):
|
186
|
-
"""HTTP response from web requests."""
|
187
|
-
|
188
|
-
status_code: int
|
189
|
-
"""HTTP status code."""
|
190
|
-
|
191
|
-
headers: Dict[str, str]
|
192
|
-
"""Response headers."""
|
193
|
-
|
194
|
-
content: Union[str, bytes]
|
195
|
-
"""Response content."""
|
196
|
-
|
197
|
-
url: str
|
198
|
-
"""Final URL after redirects."""
|
199
|
-
|
200
|
-
elapsed: float
|
201
|
-
"""Time elapsed for the request in seconds."""
|
202
|
-
|
203
|
-
# NOTE: This is a workaround to avoid the issue with the `json` field
|
204
|
-
# might consider moving to dataclasses
|
205
|
-
json_data: Optional[Dict[str, Any]] = Field(alias="json")
|
206
|
-
"""Parsed JSON content if Content-Type is JSON."""
|
207
|
-
|
208
|
-
text: str
|
209
|
-
"""Text content if response is text-based."""
|
210
|
-
|
211
|
-
|
212
|
-
# -----------------------------------------------------------------------------
|
213
|
-
# Batch Operation Models
|
214
|
-
# -----------------------------------------------------------------------------
|
215
|
-
|
216
|
-
|
217
|
-
class WebPageResults(BaseModel):
|
218
|
-
"""Results from batch web page parsing operations."""
|
219
|
-
|
220
|
-
urls: List[str]
|
221
|
-
"""URLs used for the web page parsing operations."""
|
222
|
-
|
223
|
-
results: List[Union[WebPageResult, WebPageErrorResult]]
|
224
|
-
"""List of results from batch web page parsing operations."""
|
225
|
-
|
226
|
-
|
227
|
-
class SearchResults(BaseModel):
|
228
|
-
"""Results from web search operations."""
|
229
|
-
|
230
|
-
query: str
|
231
|
-
"""Query used for the web search operations."""
|
232
|
-
|
233
|
-
results: List[SearchResult]
|
234
|
-
"""List of results from web search operations."""
|
235
|
-
|
236
|
-
|
237
|
-
class NewsResults(BaseModel):
|
238
|
-
"""Results from news search operations."""
|
239
|
-
|
240
|
-
query: str
|
241
|
-
"""Query used for the news search operations."""
|
242
|
-
|
243
|
-
results: List[NewsResult]
|
244
|
-
"""List of results from news search operations."""
|
245
|
-
|
246
|
-
|
247
|
-
class ExtractedLinks(BaseModel):
|
248
|
-
"""Results from link extraction operations."""
|
249
|
-
|
250
|
-
url: str
|
251
|
-
"""URL used for the link extraction operations."""
|
252
|
-
|
253
|
-
results: List[ExtractedLink]
|
254
|
-
"""List of results from link extraction operations."""
|
255
|
-
|
256
|
-
|
257
|
-
__all__ = (
|
258
|
-
# Search models
|
259
|
-
"SearchResult",
|
260
|
-
"NewsResult",
|
261
|
-
"SearchResults",
|
262
|
-
"NewsResults",
|
263
|
-
# Web page models
|
264
|
-
"LinkInfo",
|
265
|
-
"ImageInfo",
|
266
|
-
"SelectedElement",
|
267
|
-
"WebPageResult",
|
268
|
-
"WebPageErrorResult",
|
269
|
-
"WebPageResults",
|
270
|
-
# Link extraction models
|
271
|
-
"ExtractedLink",
|
272
|
-
"ExtractedLinks",
|
273
|
-
# HTTP models
|
274
|
-
"HttpResponse",
|
275
|
-
)
|
hammad/web/openapi/__init__.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"""hammad.web.openapi"""
|