hammad-python 0.0.14__py3-none-any.whl → 0.0.15__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 (101) hide show
  1. hammad_python-0.0.15.dist-info/METADATA +184 -0
  2. hammad_python-0.0.15.dist-info/RECORD +4 -0
  3. hammad/__init__.py +0 -1
  4. hammad/ai/__init__.py +0 -1
  5. hammad/ai/_utils.py +0 -142
  6. hammad/ai/completions/__init__.py +0 -45
  7. hammad/ai/completions/client.py +0 -684
  8. hammad/ai/completions/create.py +0 -710
  9. hammad/ai/completions/settings.py +0 -100
  10. hammad/ai/completions/types.py +0 -792
  11. hammad/ai/completions/utils.py +0 -486
  12. hammad/ai/embeddings/__init__.py +0 -35
  13. hammad/ai/embeddings/client/__init__.py +0 -1
  14. hammad/ai/embeddings/client/base_embeddings_client.py +0 -26
  15. hammad/ai/embeddings/client/fastembed_text_embeddings_client.py +0 -200
  16. hammad/ai/embeddings/client/litellm_embeddings_client.py +0 -288
  17. hammad/ai/embeddings/create.py +0 -159
  18. hammad/ai/embeddings/types.py +0 -69
  19. hammad/cache/__init__.py +0 -40
  20. hammad/cache/base_cache.py +0 -181
  21. hammad/cache/cache.py +0 -169
  22. hammad/cache/decorators.py +0 -261
  23. hammad/cache/file_cache.py +0 -80
  24. hammad/cache/ttl_cache.py +0 -74
  25. hammad/cli/__init__.py +0 -33
  26. hammad/cli/animations.py +0 -573
  27. hammad/cli/plugins.py +0 -781
  28. hammad/cli/styles/__init__.py +0 -55
  29. hammad/cli/styles/settings.py +0 -139
  30. hammad/cli/styles/types.py +0 -358
  31. hammad/cli/styles/utils.py +0 -480
  32. hammad/data/__init__.py +0 -56
  33. hammad/data/collections/__init__.py +0 -34
  34. hammad/data/collections/base_collection.py +0 -58
  35. hammad/data/collections/collection.py +0 -452
  36. hammad/data/collections/searchable_collection.py +0 -556
  37. hammad/data/collections/vector_collection.py +0 -596
  38. hammad/data/configurations/__init__.py +0 -35
  39. hammad/data/configurations/configuration.py +0 -564
  40. hammad/data/databases/__init__.py +0 -21
  41. hammad/data/databases/database.py +0 -902
  42. hammad/data/models/__init__.py +0 -44
  43. hammad/data/models/base/__init__.py +0 -35
  44. hammad/data/models/base/fields.py +0 -546
  45. hammad/data/models/base/model.py +0 -1078
  46. hammad/data/models/base/utils.py +0 -280
  47. hammad/data/models/pydantic/__init__.py +0 -55
  48. hammad/data/models/pydantic/converters.py +0 -632
  49. hammad/data/models/pydantic/models/__init__.py +0 -28
  50. hammad/data/models/pydantic/models/arbitrary_model.py +0 -46
  51. hammad/data/models/pydantic/models/cacheable_model.py +0 -79
  52. hammad/data/models/pydantic/models/fast_model.py +0 -318
  53. hammad/data/models/pydantic/models/function_model.py +0 -176
  54. hammad/data/models/pydantic/models/subscriptable_model.py +0 -63
  55. hammad/data/types/__init__.py +0 -41
  56. hammad/data/types/file.py +0 -358
  57. hammad/data/types/multimodal/__init__.py +0 -24
  58. hammad/data/types/multimodal/audio.py +0 -96
  59. hammad/data/types/multimodal/image.py +0 -80
  60. hammad/data/types/text.py +0 -1066
  61. hammad/formatting/__init__.py +0 -38
  62. hammad/formatting/json/__init__.py +0 -21
  63. hammad/formatting/json/converters.py +0 -152
  64. hammad/formatting/text/__init__.py +0 -63
  65. hammad/formatting/text/converters.py +0 -723
  66. hammad/formatting/text/markdown.py +0 -131
  67. hammad/formatting/yaml/__init__.py +0 -26
  68. hammad/formatting/yaml/converters.py +0 -5
  69. hammad/logging/__init__.py +0 -35
  70. hammad/logging/decorators.py +0 -834
  71. hammad/logging/logger.py +0 -954
  72. hammad/mcp/__init__.py +0 -50
  73. hammad/mcp/client/__init__.py +0 -1
  74. hammad/mcp/client/client.py +0 -523
  75. hammad/mcp/client/client_service.py +0 -393
  76. hammad/mcp/client/settings.py +0 -178
  77. hammad/mcp/servers/__init__.py +0 -1
  78. hammad/mcp/servers/launcher.py +0 -1161
  79. hammad/performance/__init__.py +0 -36
  80. hammad/performance/imports.py +0 -231
  81. hammad/performance/runtime/__init__.py +0 -32
  82. hammad/performance/runtime/decorators.py +0 -142
  83. hammad/performance/runtime/run.py +0 -299
  84. hammad/py.typed +0 -0
  85. hammad/service/__init__.py +0 -49
  86. hammad/service/create.py +0 -532
  87. hammad/service/decorators.py +0 -285
  88. hammad/typing/__init__.py +0 -407
  89. hammad/web/__init__.py +0 -43
  90. hammad/web/http/__init__.py +0 -1
  91. hammad/web/http/client.py +0 -944
  92. hammad/web/models.py +0 -245
  93. hammad/web/openapi/__init__.py +0 -1
  94. hammad/web/openapi/client.py +0 -740
  95. hammad/web/search/__init__.py +0 -1
  96. hammad/web/search/client.py +0 -988
  97. hammad/web/utils.py +0 -472
  98. hammad_python-0.0.14.dist-info/METADATA +0 -70
  99. hammad_python-0.0.14.dist-info/RECORD +0 -99
  100. {hammad_python-0.0.14.dist-info → hammad_python-0.0.15.dist-info}/WHEEL +0 -0
  101. {hammad_python-0.0.14.dist-info → hammad_python-0.0.15.dist-info}/licenses/LICENSE +0 -0
@@ -1,38 +0,0 @@
1
- """hammad.formatting
2
-
3
- Contains resources for working with various data structures and formats
4
- such as JSON, YAML, and text / markdown formatting."""
5
-
6
- from typing import TYPE_CHECKING
7
- from ..performance.imports import create_getattr_importer
8
-
9
-
10
- if TYPE_CHECKING:
11
- from .json import (
12
- convert_to_json_schema,
13
- encode_json,
14
- decode_json,
15
- )
16
- from .yaml import (
17
- encode_yaml,
18
- decode_yaml,
19
- )
20
-
21
-
22
- __all__ = (
23
- # hammad.formatting.json
24
- "convert_to_json_schema",
25
- "encode_json",
26
- "decode_json",
27
- # hammad.formatting.yaml
28
- "encode_yaml",
29
- "decode_yaml",
30
- )
31
-
32
-
33
- __getattr__ = create_getattr_importer(__all__)
34
-
35
-
36
- def __dir__() -> list[str]:
37
- """Get the attributes of the formatting module."""
38
- return list(__all__)
@@ -1,21 +0,0 @@
1
- """hammad.formatting.json"""
2
-
3
- from typing import TYPE_CHECKING
4
- from ...performance.imports import create_getattr_importer
5
-
6
- if TYPE_CHECKING:
7
- from .converters import (
8
- convert_to_json_schema,
9
- encode_json,
10
- decode_json,
11
- )
12
-
13
- __all__ = ("convert_to_json_schema", "encode_json", "decode_json")
14
-
15
-
16
- __getattr__ = create_getattr_importer(__all__)
17
-
18
-
19
- def __dir__() -> list[str]:
20
- """Get the attributes of the json module."""
21
- return list(__all__)
@@ -1,152 +0,0 @@
1
- """hammad.formatting.json.utils
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)}
@@ -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 ...performance.imports 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__)