hammad-python 0.0.26__py3-none-any.whl → 0.0.28__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/data/__init__.py CHANGED
@@ -23,6 +23,7 @@ if TYPE_CHECKING:
23
23
  from .collections import (
24
24
  Collection,
25
25
  create_collection,
26
+ CollectionType,
26
27
  TantivyCollectionIndex,
27
28
  QdrantCollectionIndex,
28
29
  TantivyCollectionIndexSettings,
@@ -59,6 +60,7 @@ __all__ = (
59
60
  # hammad.data.collections
60
61
  "Collection",
61
62
  "create_collection",
63
+ "CollectionType",
62
64
  "TantivyCollectionIndex",
63
65
  "QdrantCollectionIndex",
64
66
  "TantivyCollectionIndexSettings",
@@ -7,6 +7,7 @@ if TYPE_CHECKING:
7
7
  from .collection import (
8
8
  Collection,
9
9
  create_collection,
10
+ CollectionType,
10
11
  )
11
12
 
12
13
  from .indexes import (
@@ -29,6 +30,7 @@ __all__ = (
29
30
  # hammad.data.collections.collection
30
31
  "Collection",
31
32
  "create_collection",
33
+ "CollectionType",
32
34
  # hammad.data.collections.indexes
33
35
  "TantivyCollectionIndex",
34
36
  "QdrantCollectionIndex",
@@ -1,14 +1,10 @@
1
1
  """hammad.data.collections.collection"""
2
2
 
3
3
  from typing import (
4
- Any,
5
- Callable,
6
- Dict,
7
- List,
8
4
  Literal,
9
5
  Optional,
10
6
  Type,
11
- TypeVar,
7
+ TypeAlias,
12
8
  Union,
13
9
  overload,
14
10
  TYPE_CHECKING,
@@ -37,9 +33,17 @@ else:
37
33
  __all__ = (
38
34
  "Collection",
39
35
  "VectorSearchResult",
36
+ "CollectionType",
40
37
  )
41
38
 
42
39
 
40
+ CollectionType: TypeAlias = Union["TantivyCollectionIndex", "QdrantCollectionIndex"]
41
+ """Alias for a type of collection index.
42
+
43
+ This is a union of TantivyCollectionIndex and QdrantCollectionIndex.
44
+ """
45
+
46
+
43
47
  class Collection:
44
48
  """
45
49
  A unified collection factory that creates the appropriate collection index type
@@ -222,7 +226,16 @@ def create_collection(
222
226
  distance_metric: "DistanceMetric" = "dot",
223
227
  settings: Optional["QdrantCollectionIndexSettings"] = None,
224
228
  query_settings: Optional["QdrantCollectionIndexQuerySettings"] = None,
225
- embedding_function: Optional[Callable[[Any], List[float]]] = None,
229
+ embedding_model: Optional[
230
+ "EmbeddingModelName"
231
+ ] = "openai/text-embedding-3-small",
232
+ embedding_dimensions: Optional[int] = None,
233
+ embedding_api_key: Optional[str] = None,
234
+ embedding_base_url: Optional[str] = None,
235
+ # Rerank-specific parameters
236
+ rerank_model: Optional[str] = None,
237
+ rerank_api_key: Optional[str] = None,
238
+ rerank_base_url: Optional[str] = None,
226
239
  ) -> "QdrantCollectionIndex": ...
227
240
 
228
241
 
@@ -247,7 +260,16 @@ def create_collection(
247
260
  ] = None,
248
261
  # Vector/Qdrant-specific parameters
249
262
  distance_metric: "DistanceMetric" = "dot",
250
- embedding_function: Optional[Callable[[Any], List[float]]] = None,
263
+ embedding_model: Optional[
264
+ "EmbeddingModelName"
265
+ ] = "openai/text-embedding-3-small",
266
+ embedding_dimensions: Optional[int] = None,
267
+ embedding_api_key: Optional[str] = None,
268
+ embedding_base_url: Optional[str] = None,
269
+ # Rerank-specific parameters
270
+ rerank_model: Optional[str] = None,
271
+ rerank_api_key: Optional[str] = None,
272
+ rerank_base_url: Optional[str] = None,
251
273
  ) -> Union["TantivyCollectionIndex", "QdrantCollectionIndex"]:
252
274
  """
253
275
  Create a data collection of the specified type. Collections are a unified
@@ -275,6 +297,11 @@ def create_collection(
275
297
  embedding_api_key: API key for the embedding service
276
298
  embedding_base_url: Base URL for the embedding service
277
299
 
300
+ # Rerank parameters (for vector collections):
301
+ rerank_model: The rerank model to use (e.g., 'cohere/rerank-english-v3.0')
302
+ rerank_api_key: API key for the rerank service
303
+ rerank_base_url: Base URL for the rerank service
304
+
278
305
  Returns:
279
306
  A TantivyCollectionIndex or QdrantCollectionIndex instance
280
307
  """
@@ -289,5 +316,11 @@ def create_collection(
289
316
  settings=settings,
290
317
  query_settings=query_settings,
291
318
  distance_metric=distance_metric,
292
- embedding_function=embedding_function,
319
+ embedding_model=embedding_model,
320
+ embedding_dimensions=embedding_dimensions,
321
+ embedding_api_key=embedding_api_key,
322
+ embedding_base_url=embedding_base_url,
323
+ rerank_model=rerank_model,
324
+ rerank_api_key=rerank_api_key,
325
+ rerank_base_url=rerank_base_url,
293
326
  )
@@ -5,12 +5,24 @@ from .._internal import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from . import json
8
+ from .json import (
9
+ convert_to_json_schema
10
+ )
8
11
  from . import text
12
+ from .text import (
13
+ convert_to_text,
14
+ convert_type_to_text,
15
+ convert_docstring_to_text
16
+ )
9
17
  from . import yaml
10
18
 
11
19
  __all__ = (
12
20
  "json",
21
+ "convert_to_json_schema",
13
22
  "text",
23
+ "convert_to_text",
24
+ "convert_type_to_text",
25
+ "convert_docstring_to_text",
14
26
  "yaml",
15
27
  )
16
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hammad-python
3
- Version: 0.0.26
3
+ Version: 0.0.28
4
4
  Author-email: Hammad Saeed <hammadaidev@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -41,14 +41,6 @@ Provides-Extra: ai
41
41
  Requires-Dist: instructor>=1.9.0; extra == 'ai'
42
42
  Requires-Dist: litellm>=1.73.6; extra == 'ai'
43
43
  Requires-Dist: qdrant-client>=1.14.3; extra == 'ai'
44
- Provides-Extra: all
45
- Requires-Dist: fastapi>=0.115.6; extra == 'all'
46
- Requires-Dist: instructor>=1.9.0; extra == 'all'
47
- Requires-Dist: litellm>=1.73.6; extra == 'all'
48
- Requires-Dist: mcp>=1.10.1; extra == 'all'
49
- Requires-Dist: pydantic-graph>=0.4.2; extra == 'all'
50
- Requires-Dist: qdrant-client>=1.14.3; extra == 'all'
51
- Requires-Dist: uvicorn>=0.34.0; extra == 'all'
52
44
  Provides-Extra: genai
53
45
  Requires-Dist: fastapi>=0.115.6; extra == 'genai'
54
46
  Requires-Dist: instructor>=1.9.0; extra == 'genai'
@@ -16,9 +16,9 @@ hammad/cli/styles/__init__.py,sha256=Ok7J_uhJgyswNkBWnDw50oTX9Xk1HPksUl3UbmT1qTI
16
16
  hammad/cli/styles/settings.py,sha256=irChf9RsMij3djx_n9D9duoVIzxLCpd9-BlKl6U_OLk,5532
17
17
  hammad/cli/styles/types.py,sha256=vNIeQY_23m10K8qVT7Iy-PMwosGL-La-UAZKszHJjEE,7911
18
18
  hammad/cli/styles/utils.py,sha256=zzi0JdH1X7O8XWRlMVfJP2jB-OWt7zkpm_LeCHoSKVY,28287
19
- hammad/data/__init__.py,sha256=rga828Od--N3QeGlnOSweADD1WsRLjSTqkaZVk1VhW0,2232
20
- hammad/data/collections/__init__.py,sha256=xEORHnjoV75Fa6LFDMyFw90oDaJ0e9VmISLFV3mOsIQ,1110
21
- hammad/data/collections/collection.py,sha256=fi7jyT2GmXiGLNajjegBJMbefzggL0PIMHf-81ov7Bo,10833
19
+ hammad/data/__init__.py,sha256=VfrHgmyf4RU1y8U0oA23TcohuF-XUh8742rH3lUnw0g,2278
20
+ hammad/data/collections/__init__.py,sha256=_7qoquGARHfx6G_ui9D4czyQAx5RkVHyrdFBhB7UI9U,1156
21
+ hammad/data/collections/collection.py,sha256=zDx27gMv-5F-ClTSaI0_1_GZN8K9bzXmvWIvIBqpkH0,12172
22
22
  hammad/data/collections/indexes/__init__.py,sha256=RmXKWKq2sbtA1swz5vamKKWut-eKfc-Q2tUnij-E-IU,960
23
23
  hammad/data/collections/indexes/qdrant/__init__.py,sha256=KU89TIJkYmJPnVxWKHfXntkIYwhn86ejXtWG30hCyHg,49
24
24
  hammad/data/collections/indexes/qdrant/index.py,sha256=UzhW64i5Yq5AXyGZjkW4dljgQxwKUbjF6vhzendbjko,25634
@@ -46,7 +46,7 @@ hammad/data/types/text.py,sha256=x22KAEX18eU0m5DUvY5P9f1kcYYtoUv9tPRlvmTJubA,408
46
46
  hammad/data/types/multimodal/__init__.py,sha256=jPqoHTmgBJnc_8jg-QMjAYiOiRys29IcDnJ3FMrCH_0,689
47
47
  hammad/data/types/multimodal/audio.py,sha256=6T3XJXrAazkAluwohfGff0ENmhRtIMAX0XV22KVGgDU,5380
48
48
  hammad/data/types/multimodal/image.py,sha256=IDjuCfTpsNqWEaAZ2c6M28gwTpswHy6tGu16F3GE6Rg,4733
49
- hammad/formatting/__init__.py,sha256=5WZP0WBgTPF7hRtcz_cSMrQG2fKuOGwhFiBTn2J4A_g,348
49
+ hammad/formatting/__init__.py,sha256=HspdG2uFBPcqtUa5lMdqV_9gTon1Emvn61WBUAz4xCI,642
50
50
  hammad/formatting/json/__init__.py,sha256=V4uODCUQdptfyw_D96R3XDopw1bgNIR2ogiEG-Z-FtQ,525
51
51
  hammad/formatting/json/converters.py,sha256=CfEKtoTkeQbaGnpHHY3SAFVFjRjeG115X94L8Jq-14I,5597
52
52
  hammad/formatting/text/__init__.py,sha256=ZAA7D4pwKFjeUxHsnm21QKSTtQ7Fj8ncO__m5Ry_eHY,1506
@@ -129,7 +129,7 @@ hammad/web/openapi/__init__.py,sha256=JhJQ6_laBmB2djIYFc0vgGha2GsdUe4FP1LDdZCQ5J
129
129
  hammad/web/openapi/client.py,sha256=1pXz7KAO_0pN4kQZoWKWskXDYGiJ535TsPO1GGCiC0E,26816
130
130
  hammad/web/search/__init__.py,sha256=e9A6znPIiZCz-4secyHbUs0uUGf5yAqW6wGacgx961U,24
131
131
  hammad/web/search/client.py,sha256=LIx2MsHhn6cRTuq5i1mWowRTdIhPobY4GQV3S3bk9lk,36694
132
- hammad_python-0.0.26.dist-info/METADATA,sha256=u04KMVnt5FBw6dPi0fP19OdhLXU2UlT7CU8kaXtP-RY,6785
133
- hammad_python-0.0.26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
- hammad_python-0.0.26.dist-info/licenses/LICENSE,sha256=h74yFUWjbBaodcWG5wNmm30npjl8obVcxD-1nQfUp2I,1069
135
- hammad_python-0.0.26.dist-info/RECORD,,
132
+ hammad_python-0.0.28.dist-info/METADATA,sha256=04h910Ph7yU2eqX-ptzlQ536MLO3r1b-UyrHsQM2Sv0,6425
133
+ hammad_python-0.0.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
134
+ hammad_python-0.0.28.dist-info/licenses/LICENSE,sha256=h74yFUWjbBaodcWG5wNmm30npjl8obVcxD-1nQfUp2I,1069
135
+ hammad_python-0.0.28.dist-info/RECORD,,