indexify 0.0.16__py3-none-any.whl → 0.0.19__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/client.py CHANGED
@@ -45,7 +45,7 @@ class IndexifyClient:
45
45
 
46
46
  def __init__(
47
47
  self,
48
- service_url: str = DEFAULT_SERVICE_URL,
48
+ service_url: str = DEFAULT_SERVICE_URL, # switch this to DEFAULT_SERVICE_URL_HTTPS for TLS
49
49
  namespace: str = "default",
50
50
  config_path: Optional[str] = None,
51
51
  *args,
@@ -128,7 +128,7 @@ class IndexifyClient:
128
128
  return client
129
129
 
130
130
  def _request(self, method: str, **kwargs) -> httpx.Response:
131
- response = self._client.request(method, **kwargs)
131
+ response = self._client.request(method,timeout=None, **kwargs)
132
132
  try:
133
133
  response.raise_for_status()
134
134
  except httpx.HTTPStatusError as exc:
@@ -475,7 +475,7 @@ class IndexifyClient:
475
475
  - path (str): relative path to the file to be uploaded
476
476
  """
477
477
  with open(path, "rb") as f:
478
- response = self.put(f"namespaces/{self.namespace}/content/{document_id}", files={"file": f}, timeout=None)
478
+ response = self.put(f"namespaces/{self.namespace}/content/{document_id}", files={"file": f})
479
479
  response.raise_for_status()
480
480
 
481
481
  def get_structured_data(self, content_id: str) -> dict:
@@ -489,7 +489,7 @@ class IndexifyClient:
489
489
  response.raise_for_status()
490
490
  return response.json().get("metadata",[])
491
491
 
492
- def search_index(self, name: str, query: str, top_k: int, filters: List[str] = None) -> list[TextChunk]:
492
+ def search_index(self, name: str, query: str, top_k: int, filters: List[str] = []) -> list[TextChunk]:
493
493
  """
494
494
  Search index in the current namespace.
495
495
 
@@ -499,8 +499,6 @@ class IndexifyClient:
499
499
  - top_k (int): top k nearest neighbors to be returned
500
500
  - filters (List[str]): list of filters to apply
501
501
  """
502
- if filters is None:
503
- filters = []
504
502
  req = {"index": name, "query": query, "k": top_k, "filters": filters}
505
503
  response = self.post(
506
504
  f"namespaces/{self.namespace}/search",
@@ -510,7 +508,7 @@ class IndexifyClient:
510
508
  response.raise_for_status()
511
509
  return response.json()["results"]
512
510
 
513
- def upload_file(self, path: str, id=None, labels: dict = {}):
511
+ def upload_file(self, path: str, id=None, labels: dict = {}) -> str:
514
512
  """
515
513
  Upload a file.
516
514
 
@@ -527,9 +525,10 @@ class IndexifyClient:
527
525
  files={"file": f},
528
526
  data=labels,
529
527
  params=params,
530
- timeout=None,
531
528
  )
532
529
  response.raise_for_status()
530
+ response_json = response.json()
531
+ return response_json["content_id"]
533
532
 
534
533
  def list_schemas(self) -> List[str]:
535
534
  """
@@ -538,7 +537,18 @@ class IndexifyClient:
538
537
  response = self.get(f"namespaces/{self.namespace}/schemas")
539
538
  response.raise_for_status()
540
539
  return response.json()
540
+
541
+ def get_content_tree(self, content_id:str):
542
+ """
543
+ Get content tree for a given content id
541
544
 
545
+ Args:
546
+ - content_id (str): id of content
547
+ """
548
+ response = self.get(f"namespaces/{self.namespace}/content/{content_id}/content-tree")
549
+ response.raise_for_status()
550
+ return response.json()
551
+
542
552
  def sql_query(self, query: str):
543
553
  """
544
554
  Execute a SQL query.
@@ -560,8 +570,8 @@ class IndexifyClient:
560
570
  rows.append(data)
561
571
  return SqlQueryResult(result=rows)
562
572
 
563
- def ingest_remote_file(self, url: str, mime_type: str, labels: Dict[str, str]):
564
- req = {"url": url, "mime_type": mime_type, "labels": labels}
573
+ def ingest_remote_file(self, url: str, mime_type: str, labels: Dict[str, str], id=None):
574
+ req = {"url": url, "mime_type": mime_type, "labels": labels, "id": id}
565
575
  response = self.post(
566
576
  f"namespaces/{self.namespace}/ingest_remote_file",
567
577
  json=req,
indexify/settings.py CHANGED
@@ -1 +1,2 @@
1
1
  DEFAULT_SERVICE_URL = "http://localhost:8900"
2
+ DEFAULT_SERVICE_URL_HTTPS = "https://localhost:8900"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.0.16
3
+ Version: 0.0.19
4
4
  Summary: Python Client for Indexify
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -1,13 +1,13 @@
1
1
  indexify/__init__.py,sha256=Sz6zkAIHsPOi0rG5RM7dVkXGDa0fO2uurD6vS4Qo15E,312
2
- indexify/client.py,sha256=ZDirw1O46nRx0WBgB95jvpkd4LdAjgZnlQ_2A673_cI,19047
2
+ indexify/client.py,sha256=x2-Yqa59x20K4-5V7Agh35jOGqRIBGZrAoQYKXjuq0A,19480
3
3
  indexify/data_containers.py,sha256=r1wxJPtsmXbyKvb17fqxm-dPjKz51oZ62f8A8Zxls1c,361
4
4
  indexify/exceptions.py,sha256=vjd5SPPNFIEW35GorSIodsqvm9RKHQm9kdp8t9gv-WM,111
5
5
  indexify/extraction_policy.py,sha256=vKVHT8jSjzhUaKqWpewOGkYojMBplvGdSm9zoSN9Pcg,750
6
6
  indexify/extractor.py,sha256=KMcP9xopHJRBzeSxalztGGTBvOzVKRFEsJynV-hLRSc,1175
7
7
  indexify/index.py,sha256=RvxYhJXEth-GKvqzlMiz5PuN1eIbZk84pt20piA1Gsw,504
8
- indexify/settings.py,sha256=yzWAEZkrTjykSMj3hrFU7l_jUoUCOUsgPVW1nU-qzJQ,46
8
+ indexify/settings.py,sha256=UXUd6hYlDALPPjUCFvFkvUmsm7HwXAluWowCjZWoxjY,98
9
9
  indexify/utils.py,sha256=rDN2lrsAs9noJEIjfx6ukmC2SAIyrlUt7QU-kaBjujM,125
10
- indexify-0.0.16.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- indexify-0.0.16.dist-info/METADATA,sha256=h_tYmLlbYT0g_9SJnec9hgey8AYP0VTKascytOt0_jE,1714
12
- indexify-0.0.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
- indexify-0.0.16.dist-info/RECORD,,
10
+ indexify-0.0.19.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ indexify-0.0.19.dist-info/METADATA,sha256=reizFOmSBBTh3n4wMVcxqeOdg7APpnBmpcxr32jiwJg,1714
12
+ indexify-0.0.19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
+ indexify-0.0.19.dist-info/RECORD,,