hammad-python 0.0.19__py3-none-any.whl → 0.0.21__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.
- hammad/__init__.py +7 -137
- hammad/_internal.py +1 -0
- hammad/cli/_runner.py +8 -8
- hammad/cli/plugins.py +55 -26
- hammad/cli/styles/utils.py +16 -8
- hammad/data/__init__.py +1 -5
- hammad/data/collections/__init__.py +2 -3
- hammad/data/collections/collection.py +41 -22
- hammad/data/collections/indexes/__init__.py +1 -1
- hammad/data/collections/indexes/qdrant/__init__.py +1 -1
- hammad/data/collections/indexes/qdrant/index.py +106 -118
- hammad/data/collections/indexes/qdrant/settings.py +14 -14
- hammad/data/collections/indexes/qdrant/utils.py +28 -38
- hammad/data/collections/indexes/tantivy/__init__.py +1 -1
- hammad/data/collections/indexes/tantivy/index.py +57 -59
- hammad/data/collections/indexes/tantivy/settings.py +8 -19
- hammad/data/collections/indexes/tantivy/utils.py +28 -52
- hammad/data/models/__init__.py +2 -7
- hammad/data/sql/__init__.py +1 -1
- hammad/data/sql/database.py +71 -73
- hammad/data/sql/types.py +37 -51
- hammad/formatting/__init__.py +2 -1
- hammad/formatting/json/converters.py +2 -2
- hammad/genai/__init__.py +96 -36
- hammad/genai/agents/__init__.py +47 -1
- hammad/genai/agents/agent.py +1298 -0
- hammad/genai/agents/run.py +615 -0
- hammad/genai/agents/types/__init__.py +29 -22
- hammad/genai/agents/types/agent_context.py +13 -0
- hammad/genai/agents/types/agent_event.py +128 -0
- hammad/genai/agents/types/agent_hooks.py +220 -0
- hammad/genai/agents/types/agent_messages.py +31 -0
- hammad/genai/agents/types/agent_response.py +122 -0
- hammad/genai/agents/types/agent_stream.py +318 -0
- hammad/genai/models/__init__.py +1 -0
- hammad/genai/models/embeddings/__init__.py +39 -0
- hammad/genai/{embedding_models/embedding_model.py → models/embeddings/model.py} +45 -41
- hammad/genai/{embedding_models → models/embeddings}/run.py +10 -8
- hammad/genai/models/embeddings/types/__init__.py +37 -0
- hammad/genai/{embedding_models → models/embeddings/types}/embedding_model_name.py +2 -4
- hammad/genai/{embedding_models → models/embeddings/types}/embedding_model_response.py +11 -4
- hammad/genai/{embedding_models/embedding_model_request.py → models/embeddings/types/embedding_model_run_params.py} +4 -3
- hammad/genai/models/embeddings/types/embedding_model_settings.py +47 -0
- hammad/genai/models/language/__init__.py +48 -0
- hammad/genai/{language_models/language_model.py → models/language/model.py} +496 -204
- hammad/genai/{language_models → models/language}/run.py +80 -57
- hammad/genai/models/language/types/__init__.py +40 -0
- hammad/genai/models/language/types/language_model_instructor_mode.py +47 -0
- hammad/genai/models/language/types/language_model_messages.py +28 -0
- hammad/genai/{language_models/_types.py → models/language/types/language_model_name.py} +3 -40
- hammad/genai/{language_models → models/language/types}/language_model_request.py +17 -25
- hammad/genai/{language_models → models/language/types}/language_model_response.py +60 -67
- hammad/genai/{language_models → models/language/types}/language_model_response_chunk.py +8 -5
- hammad/genai/models/language/types/language_model_settings.py +89 -0
- hammad/genai/{language_models/_streaming.py → models/language/types/language_model_stream.py} +221 -243
- hammad/genai/{language_models/_utils → models/language/utils}/__init__.py +8 -11
- hammad/genai/models/language/utils/requests.py +421 -0
- hammad/genai/{language_models/_utils/_structured_outputs.py → models/language/utils/structured_outputs.py} +31 -20
- hammad/genai/models/model_provider.py +4 -0
- hammad/genai/{multimodal_models.py → models/multimodal.py} +4 -5
- hammad/genai/models/reranking.py +26 -0
- hammad/genai/types/__init__.py +1 -0
- hammad/genai/types/base.py +215 -0
- hammad/genai/{agents/types → types}/history.py +101 -88
- hammad/genai/{agents/types/tool.py → types/tools.py} +157 -140
- hammad/logging/logger.py +9 -1
- hammad/mcp/client/__init__.py +2 -3
- hammad/mcp/client/client.py +10 -10
- hammad/mcp/servers/__init__.py +2 -1
- hammad/service/decorators.py +1 -3
- hammad/web/models.py +1 -3
- hammad/web/search/client.py +10 -22
- {hammad_python-0.0.19.dist-info → hammad_python-0.0.21.dist-info}/METADATA +10 -2
- hammad_python-0.0.21.dist-info/RECORD +127 -0
- hammad/genai/embedding_models/__init__.py +0 -41
- hammad/genai/language_models/__init__.py +0 -35
- hammad/genai/language_models/_utils/_completions.py +0 -131
- hammad/genai/language_models/_utils/_messages.py +0 -89
- hammad/genai/language_models/_utils/_requests.py +0 -202
- hammad/genai/rerank_models.py +0 -26
- hammad_python-0.0.19.dist-info/RECORD +0 -111
- {hammad_python-0.0.19.dist-info → hammad_python-0.0.21.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.19.dist-info → hammad_python-0.0.21.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,7 @@
|
|
1
|
-
"""hammad.genai.embedding_models.
|
1
|
+
"""hammad.genai.embedding_models.embedding_model_run_params"""
|
2
2
|
|
3
3
|
import sys
|
4
|
+
|
4
5
|
if sys.version_info >= (3, 12):
|
5
6
|
from typing import TypedDict, Required, NotRequired
|
6
7
|
else:
|
@@ -20,11 +21,11 @@ from typing import (
|
|
20
21
|
from .embedding_model_name import EmbeddingModelName
|
21
22
|
|
22
23
|
__all__ = [
|
23
|
-
"
|
24
|
+
"EmbeddingModelRunParams",
|
24
25
|
]
|
25
26
|
|
26
27
|
|
27
|
-
class
|
28
|
+
class EmbeddingModelRunParams(TypedDict, total=False):
|
28
29
|
"""A request to an embedding model."""
|
29
30
|
|
30
31
|
input: List[Any] | Any
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"""hammad.genai.models.embeddings.types.embedding_model_settings"""
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
from typing import Any, List, Optional
|
5
|
+
|
6
|
+
from .embedding_model_name import EmbeddingModelName
|
7
|
+
from ....types.base import BaseGenAIModelSettings
|
8
|
+
|
9
|
+
|
10
|
+
__all__ = [
|
11
|
+
"EmbeddingModelSettings",
|
12
|
+
]
|
13
|
+
|
14
|
+
|
15
|
+
class EmbeddingModelSettings(BaseGenAIModelSettings):
|
16
|
+
"""A request to an embedding model."""
|
17
|
+
|
18
|
+
format: bool = False
|
19
|
+
"""Whether to format each non-string input as a markdown string."""
|
20
|
+
|
21
|
+
# LiteLLM Settings
|
22
|
+
dimensions: Optional[int] = None
|
23
|
+
"""The dimensions of the embedding."""
|
24
|
+
|
25
|
+
encoding_format: Optional[str] = None
|
26
|
+
"""The encoding format of the embedding."""
|
27
|
+
|
28
|
+
timeout: Optional[int] = None
|
29
|
+
"""The timeout for the embedding request."""
|
30
|
+
|
31
|
+
api_base: Optional[str] = None
|
32
|
+
"""The API base for the embedding request."""
|
33
|
+
|
34
|
+
api_version: Optional[str] = None
|
35
|
+
"""The API version for the embedding request."""
|
36
|
+
|
37
|
+
api_key: Optional[str] = None
|
38
|
+
"""The API key for the embedding request."""
|
39
|
+
|
40
|
+
api_type: Optional[str] = None
|
41
|
+
"""The API type for the embedding request."""
|
42
|
+
|
43
|
+
caching: bool = False
|
44
|
+
"""Whether to cache the embedding request."""
|
45
|
+
|
46
|
+
user: Optional[str] = None
|
47
|
+
"""The user for the embedding request."""
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"""hammad.genai.models.language"""
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
from ...._internal import create_getattr_importer
|
5
|
+
|
6
|
+
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
from .model import LanguageModel
|
9
|
+
from .run import run_language_model, async_run_language_model
|
10
|
+
from .types.language_model_instructor_mode import LanguageModelInstructorMode
|
11
|
+
from .types.language_model_messages import LanguageModelMessages
|
12
|
+
from .types.language_model_name import LanguageModelName
|
13
|
+
from .types.language_model_request import LanguageModelRequest
|
14
|
+
from .types.language_model_response import LanguageModelResponse
|
15
|
+
from .types.language_model_response_chunk import LanguageModelResponseChunk
|
16
|
+
from .types.language_model_settings import LanguageModelSettings
|
17
|
+
from .types.language_model_stream import LanguageModelStream
|
18
|
+
|
19
|
+
__all__ = [
|
20
|
+
# hammad.genai.models.language.model
|
21
|
+
"LanguageModel",
|
22
|
+
# hammad.genai.models.language.run
|
23
|
+
"run_language_model",
|
24
|
+
"async_run_language_model",
|
25
|
+
# hammad.genai.models.language.types.language_model_instructor_mode
|
26
|
+
"LanguageModelInstructorMode",
|
27
|
+
# hammad.genai.models.language.types.language_model_messages
|
28
|
+
"LanguageModelMessages",
|
29
|
+
# hammad.genai.models.language.types.language_model_name
|
30
|
+
"LanguageModelName",
|
31
|
+
# hammad.genai.models.language.types.language_model_request
|
32
|
+
"LanguageModelRequest",
|
33
|
+
# hammad.genai.models.language.types.language_model_response
|
34
|
+
"LanguageModelResponse",
|
35
|
+
# hammad.genai.models.language.types.language_model_response_chunk
|
36
|
+
"LanguageModelResponseChunk",
|
37
|
+
# hammad.genai.models.language.types.language_model_settings
|
38
|
+
"LanguageModelSettings",
|
39
|
+
# hammad.genai.models.language.types.language_model_stream
|
40
|
+
"LanguageModelStream",
|
41
|
+
]
|
42
|
+
|
43
|
+
|
44
|
+
__getattr__ = create_getattr_importer(__all__)
|
45
|
+
|
46
|
+
|
47
|
+
def __dir__() -> list[str]:
|
48
|
+
return __all__
|