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,33 +0,0 @@
1
- """hammad.formatting"""
2
-
3
- from typing import TYPE_CHECKING
4
- from .._internal import create_getattr_importer
5
-
6
- if TYPE_CHECKING:
7
- from . import json
8
- from .json import (
9
- convert_to_json_schema
10
- )
11
- from . import text
12
- from .text import (
13
- convert_to_text,
14
- convert_type_to_text,
15
- convert_docstring_to_text
16
- )
17
- from . import yaml
18
-
19
- __all__ = (
20
- "json",
21
- "convert_to_json_schema",
22
- "text",
23
- "convert_to_text",
24
- "convert_type_to_text",
25
- "convert_docstring_to_text",
26
- "yaml",
27
- )
28
-
29
- __getattr__ = create_getattr_importer(__all__)
30
-
31
-
32
- def __dir__() -> list[str]:
33
- return list(__all__)
@@ -1,27 +0,0 @@
1
- """hammad.formatting.json"""
2
-
3
- from typing import TYPE_CHECKING
4
- from ..._internal import create_getattr_importer
5
-
6
- if TYPE_CHECKING:
7
- from .converters import (
8
- convert_to_json_schema,
9
- convert_to_json,
10
- encode_json,
11
- decode_json,
12
- )
13
-
14
- __all__ = (
15
- "convert_to_json_schema",
16
- "convert_to_json",
17
- "encode_json",
18
- "decode_json",
19
- )
20
-
21
-
22
- __getattr__ = create_getattr_importer(__all__)
23
-
24
-
25
- def __dir__() -> list[str]:
26
- """Get the attributes of the json module."""
27
- return list(__all__)
@@ -1,158 +0,0 @@
1
- """hammad.formatting.json.converters
2
-
3
- Contains various utility functions used when working with JSON data."""
4
-
5
- import dataclasses
6
- from typing import Any
7
- import msgspec
8
- from msgspec.json import encode as encode_json, decode as decode_json
9
-
10
- from ...typing import get_type_description, inspection # type: ignore
11
-
12
- __all__ = (
13
- "SchemaError",
14
- "convert_to_json_schema",
15
- "encode",
16
- "decode",
17
- )
18
-
19
-
20
- class SchemaError(Exception):
21
- """An exception raised when a schema utility raises an error."""
22
-
23
-
24
- def convert_to_json_schema(t: Any) -> dict:
25
- """Converts various objects, types, and interfaces into
26
- a JSON schema.
27
-
28
- Args:
29
- t: The object, type, or interface to convert to a JSON schema.
30
-
31
- Returns:
32
- A JSON schema as a dictionary.
33
- """
34
- from dataclasses import is_dataclass, fields as dataclass_fields
35
- import inspect
36
- from typing import get_type_hints
37
-
38
- schema = {"type": "object", "properties": {}}
39
-
40
- # Handle msgspec Struct
41
- try:
42
- if isinstance(t, type) and issubclass(t, msgspec.Struct):
43
- struct_info = msgspec.structs.fields(t)
44
- for field in struct_info:
45
- field_type = field.type
46
- field_schema = {
47
- "type": get_type_description(field_type),
48
- "description": f"Field of type {get_type_description(field_type)}",
49
- }
50
- if field.default is not msgspec.NODEFAULT:
51
- field_schema["default"] = field.default
52
- schema["properties"][field.name] = field_schema
53
- return schema
54
- except (ImportError, AttributeError):
55
- pass
56
-
57
- # Handle Pydantic models
58
- try:
59
- from pydantic import BaseModel
60
-
61
- if isinstance(t, type) and issubclass(t, BaseModel):
62
- pydantic_schema = (
63
- t.model_json_schema() if hasattr(t, "model_json_schema") else t.schema()
64
- )
65
- return pydantic_schema
66
- except ImportError:
67
- pass
68
-
69
- # Handle dataclasses
70
- if is_dataclass(t):
71
- if isinstance(t, type):
72
- # Class-level dataclass
73
- for field in dataclass_fields(t):
74
- field_type = field.type
75
- field_schema = {
76
- "type": get_type_description(field_type),
77
- "description": f"Field of type {get_type_description(field_type)}",
78
- }
79
- if field.default is not dataclasses.MISSING:
80
- field_schema["default"] = field.default
81
- elif field.default_factory is not dataclasses.MISSING:
82
- field_schema["default"] = "factory function"
83
- schema["properties"][field.name] = field_schema
84
- else:
85
- # Instance-level dataclass
86
- for field in dataclass_fields(t):
87
- field_type = field.type
88
- field_schema = {
89
- "type": get_type_description(field_type),
90
- "description": f"Field of type {get_type_description(field_type)}",
91
- "value": getattr(t, field.name, None),
92
- }
93
- schema["properties"][field.name] = field_schema
94
- return schema
95
-
96
- # Handle regular classes with type hints (including abstract classes)
97
- if inspect.isclass(t):
98
- try:
99
- type_hints = get_type_hints(t)
100
- for name, type_hint in type_hints.items():
101
- schema["properties"][name] = {
102
- "type": get_type_description(type_hint),
103
- "description": f"Field of type {get_type_description(type_hint)}",
104
- }
105
- except (NameError, AttributeError):
106
- pass
107
- return schema
108
-
109
- # Handle dictionary
110
- if isinstance(t, dict):
111
- for key, value in t.items():
112
- schema["properties"][key] = {
113
- "type": type(value).__name__,
114
- "description": f"Field of type {type(value).__name__}",
115
- "example": value,
116
- }
117
- return schema
118
-
119
- # Handle basic types and type hints
120
- origin = inspection.get_origin(t)
121
- if origin is not None:
122
- args = inspection.get_args(t)
123
- if origin is list and args:
124
- return {"type": "array", "items": {"type": get_type_description(args[0])}}
125
- elif origin is dict and len(args) == 2:
126
- return {
127
- "type": "object",
128
- "additionalProperties": {"type": get_type_description(args[1])},
129
- "description": f"Object with {get_type_description(args[0])} keys",
130
- }
131
- elif origin is tuple and args:
132
- return {
133
- "type": "array",
134
- "items": [{"type": get_type_description(arg)} for arg in args],
135
- "minItems": len(args),
136
- "maxItems": len(args),
137
- }
138
- elif inspection.is_union_type(t):
139
- if inspection.is_optional_type(t):
140
- non_none_args = [arg for arg in args if arg is not type(None)]
141
- if non_none_args:
142
- return {
143
- "type": get_type_description(non_none_args[0]),
144
- "nullable": True,
145
- }
146
- else:
147
- return {"anyOf": [{"type": get_type_description(arg)} for arg in args]}
148
- elif inspection.is_literal_type(t) and args:
149
- return {"enum": list(args)}
150
-
151
- # Default to string representation of type
152
- return {"type": get_type_description(t)}
153
-
154
-
155
- def convert_to_json(
156
- target: Any,
157
- ) -> str:
158
- return encode_json(target).decode()
@@ -1,63 +0,0 @@
1
- """hammad.formatting.text
2
-
3
- Contains resources for working with text / markdown formatting."""
4
-
5
- from typing import TYPE_CHECKING
6
- from ..._internal import create_getattr_importer
7
-
8
- if TYPE_CHECKING:
9
- from .converters import (
10
- convert_collection_to_text,
11
- convert_dataclass_to_text,
12
- convert_dict_to_text,
13
- convert_docstring_to_text,
14
- convert_function_to_text,
15
- convert_pydantic_to_text,
16
- convert_type_to_text,
17
- convert_to_text,
18
- )
19
- from .markdown import (
20
- markdown_blockquote,
21
- markdown_bold,
22
- markdown_code,
23
- markdown_code_block,
24
- markdown_heading,
25
- markdown_horizontal_rule,
26
- markdown_italic,
27
- markdown_link,
28
- markdown_list_item,
29
- markdown_table,
30
- markdown_table_row,
31
- )
32
-
33
-
34
- __all__ = (
35
- # hammad.text.converters
36
- "convert_collection_to_text",
37
- "convert_dataclass_to_text",
38
- "convert_dict_to_text",
39
- "convert_docstring_to_text",
40
- "convert_function_to_text",
41
- "convert_pydantic_to_text",
42
- "convert_type_to_text",
43
- "convert_to_text",
44
- # hammad.text.markdown
45
- "markdown_blockquote",
46
- "markdown_bold",
47
- "markdown_code",
48
- "markdown_code_block",
49
- "markdown_heading",
50
- "markdown_horizontal_rule",
51
- "markdown_italic",
52
- "markdown_link",
53
- "markdown_list_item",
54
- "markdown_table",
55
- "markdown_table_row",
56
- )
57
-
58
-
59
- __getattr__ = create_getattr_importer(__all__)
60
-
61
-
62
- def __dir__() -> list[str]:
63
- return list(__all__)