indexify 0.0.22__py3-none-any.whl → 0.0.23__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.
- indexify/__init__.py +4 -2
- indexify/client.py +29 -3
- {indexify-0.0.22.dist-info → indexify-0.0.23.dist-info}/METADATA +1 -1
- {indexify-0.0.22.dist-info → indexify-0.0.23.dist-info}/RECORD +6 -6
- {indexify-0.0.22.dist-info → indexify-0.0.23.dist-info}/LICENSE.txt +0 -0
- {indexify-0.0.22.dist-info → indexify-0.0.23.dist-info}/WHEEL +0 -0
indexify/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from .index import Index
|
2
2
|
from .client import IndexifyClient
|
3
|
-
from .extraction_policy import
|
4
|
-
from .client import IndexifyClient, Document
|
3
|
+
from .extraction_policy import ExtractionGraph
|
4
|
+
from .client import IndexifyClient, Document, generate_hash_from_string, generate_unique_hex_id
|
5
5
|
from .settings import DEFAULT_SERVICE_URL
|
6
6
|
|
7
7
|
__all__ = [
|
@@ -11,4 +11,6 @@ __all__ = [
|
|
11
11
|
"ExtractionGraph",
|
12
12
|
"ExtractionGraphBuilder" "ExtractionPolicy",
|
13
13
|
"DEFAULT_SERVICE_URL",
|
14
|
+
"generate_hash_from_string",
|
15
|
+
"generate_unique_hex_id",
|
14
16
|
]
|
indexify/client.py
CHANGED
@@ -14,11 +14,34 @@ from .data_containers import TextChunk
|
|
14
14
|
from indexify.exceptions import ApiException
|
15
15
|
from dataclasses import dataclass
|
16
16
|
from typing import List, Optional, Union, Dict
|
17
|
+
import logging
|
17
18
|
|
18
19
|
Document = namedtuple("Document", ["text", "labels", "id"])
|
19
20
|
|
20
21
|
SQLQueryRow = namedtuple("SQLQueryRow", ["content_id", "data"])
|
21
22
|
|
23
|
+
def generate_unique_hex_id():
|
24
|
+
"""
|
25
|
+
Generate a unique hexadecimal identifier
|
26
|
+
|
27
|
+
Returns:
|
28
|
+
str: a unique hexadecimal string
|
29
|
+
"""
|
30
|
+
return uuid.uuid4().hex[:16]
|
31
|
+
|
32
|
+
def generate_hash_from_string(input_string: str):
|
33
|
+
"""
|
34
|
+
Generate a hash for the given string and return it as a hexadecimal string.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
input_string (str): The input string to hash.
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
str: The hexadecimal hash of the input string.
|
41
|
+
"""
|
42
|
+
hash_object = hashlib.sha256(input_string.encode())
|
43
|
+
return hash_object.hexdigest()[:16]
|
44
|
+
|
22
45
|
|
23
46
|
@dataclass
|
24
47
|
class SqlQueryResult:
|
@@ -129,9 +152,10 @@ class IndexifyClient:
|
|
129
152
|
response = self._client.request(method, timeout=self._timeout, **kwargs)
|
130
153
|
status_code = str(response.status_code)
|
131
154
|
if status_code.startswith("4") or status_code.startswith("5"):
|
132
|
-
|
133
|
-
|
134
|
-
|
155
|
+
raise ApiException(response.text)
|
156
|
+
#error = Error.from_tonic_error_string(str(response.url), response.text)
|
157
|
+
#self.__print_additional_error_context(error)
|
158
|
+
#raise error
|
135
159
|
except httpx.ConnectError:
|
136
160
|
message = f"Make sure the server is running and accesible at {self._service_url}"
|
137
161
|
error = Error(status="ConnectionError", message=message)
|
@@ -590,6 +614,7 @@ class IndexifyClient:
|
|
590
614
|
Returns:
|
591
615
|
str: a unique hexadecimal string
|
592
616
|
"""
|
617
|
+
logging.warning("This method is deprecated. Use generate_unique_hex_id from indexify instead.")
|
593
618
|
return uuid.uuid4().hex[:16]
|
594
619
|
|
595
620
|
def generate_hash_from_string(self, input_string: str):
|
@@ -602,6 +627,7 @@ class IndexifyClient:
|
|
602
627
|
Returns:
|
603
628
|
str: The hexadecimal hash of the input string.
|
604
629
|
"""
|
630
|
+
logging.warning("This method is deprecated. Use generate_hash_from_string from indexify instead.")
|
605
631
|
hash_object = hashlib.sha256(input_string.encode())
|
606
632
|
return hash_object.hexdigest()[:16]
|
607
633
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
indexify/__init__.py,sha256=
|
2
|
-
indexify/client.py,sha256=
|
1
|
+
indexify/__init__.py,sha256=Y40-Ur_tL7kGGs-reh9BTfEYGe-KyGxgdg-CmoFsXRQ,473
|
2
|
+
indexify/client.py,sha256=Q6QJ_yzJMmH_h0x3EwXL69qmp-TPrU7lcQedw__rRnk,21238
|
3
3
|
indexify/data_containers.py,sha256=r1wxJPtsmXbyKvb17fqxm-dPjKz51oZ62f8A8Zxls1c,361
|
4
4
|
indexify/error.py,sha256=3umTeYb0ugtUyehV1ibfvaeACxAONPyWPc-1HRN4d1M,856
|
5
5
|
indexify/exceptions.py,sha256=vjd5SPPNFIEW35GorSIodsqvm9RKHQm9kdp8t9gv-WM,111
|
@@ -8,7 +8,7 @@ indexify/extractor.py,sha256=sWFLlXHgEfWlmiKAXN6ytUt_uG7th-XGNHqz-TG39gs,1216
|
|
8
8
|
indexify/index.py,sha256=RvxYhJXEth-GKvqzlMiz5PuN1eIbZk84pt20piA1Gsw,504
|
9
9
|
indexify/settings.py,sha256=LSaWZ0ADIVmUv6o6dHWRC3-Ry5uLbCw2sBSg1e_U7UM,99
|
10
10
|
indexify/utils.py,sha256=rDN2lrsAs9noJEIjfx6ukmC2SAIyrlUt7QU-kaBjujM,125
|
11
|
-
indexify-0.0.
|
12
|
-
indexify-0.0.
|
13
|
-
indexify-0.0.
|
14
|
-
indexify-0.0.
|
11
|
+
indexify-0.0.23.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
12
|
+
indexify-0.0.23.dist-info/METADATA,sha256=vQqfHcLrf52YvCNbuAc1m9yLh-rVSGkRqfMKbcTuSb0,1753
|
13
|
+
indexify-0.0.23.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
14
|
+
indexify-0.0.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|