indexify 0.0.13__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.
indexify/client.py CHANGED
@@ -153,12 +153,40 @@ class IndexifyClient:
153
153
  return self._request("POST", url=f"{self._service_url}/{endpoint}", **kwargs)
154
154
 
155
155
  def put(self, endpoint: str, **kwargs) -> httpx.Response:
156
- # Not Implemented
157
- raise NotImplementedError
156
+ """
157
+ Make a PUT request to the Indexify service.
158
+
159
+ :param endpoint: The endpoint to make the request to.
160
+
161
+ Example usage:
162
+
163
+ ```
164
+ from indexify import IndexifyClient
158
165
 
166
+ client = IndexifyClient()
167
+ response = client.put("namespaces", json={"name": "my-repo"})
168
+ print(response.json())
169
+ ```
170
+ """
171
+ return self._request("PUT", url=f"{self._service_url}/{endpoint}", **kwargs)
172
+
159
173
  def delete(self, endpoint: str, **kwargs) -> httpx.Response:
160
- # Not Implemented
161
- raise NotImplementedError
174
+ """
175
+ Make a DELETE request to the Indexify service.
176
+
177
+ :param endpoint: The endpoint to make the request to.
178
+
179
+ Example usage:
180
+
181
+ ```
182
+ from indexify import IndexifyClient
183
+
184
+ client = IndexifyClient()
185
+ response = client.delete("namespaces")
186
+ print(response.json())
187
+ ```
188
+ """
189
+ return self._request("DELETE", url=f"{self._service_url}/{endpoint}", **kwargs)
162
190
 
163
191
  def close(self):
164
192
  """
@@ -321,11 +349,21 @@ class IndexifyClient:
321
349
  except httpx.HTTPStatusError as exc:
322
350
  raise ApiException(exc.response.text)
323
351
  return
352
+
353
+ def get_content_metadata(self, content_id: str) -> dict:
354
+ """
355
+ Get metadata for a specific content ID in a given index.
324
356
 
325
- def get_content(
357
+ Args:
358
+ - content_id (str): content id to query
359
+ """
360
+ response = self.get(f"namespaces/{self.namespace}/content/{content_id}")
361
+ response.raise_for_status()
362
+ return response.json()
363
+
364
+ def get_extracted_content(
326
365
  self,
327
- parent_id: str = None,
328
- labels_eq: str = None,
366
+ content_id: str = None,
329
367
  ):
330
368
  """
331
369
  Get list of content from current namespace.
@@ -334,11 +372,7 @@ class IndexifyClient:
334
372
  - parent_id (str): Optional filter for parent id
335
373
  - labels_eq (str): Optional filter for labels
336
374
  """
337
- params = {}
338
- if parent_id:
339
- params.update({"parent_id": parent_id})
340
- if labels_eq:
341
- params.update({"labels_eq": labels_eq})
375
+ params = {"parent_id": content_id}
342
376
 
343
377
  response = self.get(f"namespaces/{self.namespace}/content", params=params)
344
378
  response.raise_for_status()
@@ -399,7 +433,33 @@ class IndexifyClient:
399
433
  )
400
434
  response.raise_for_status()
401
435
 
402
- def get_metadata(self, content_id: str) -> dict:
436
+ def delete_documents(self, document_ids: List[str]) -> None:
437
+ """
438
+ Delete documents from current namespace.
439
+
440
+ Args:
441
+ - document_ids (List[str]): list of document ids to delete
442
+ """
443
+ req = {"content_ids": document_ids}
444
+ response = self.delete(
445
+ f"namespaces/{self.namespace}/content",
446
+ json=req,
447
+ headers={"Content-Type": "application/json"},
448
+ )
449
+ response.raise_for_status()
450
+
451
+ def update_content(self, document_id: str, path: str) -> None:
452
+ """
453
+ Update a piece of content with a new file
454
+
455
+ Args:
456
+ - path (str): relative path to the file to be uploaded
457
+ """
458
+ with open(path, "rb") as f:
459
+ response = self.put(f"namespaces/{self.namespace}/content/{document_id}", files={"file": f}, timeout=None)
460
+ response.raise_for_status()
461
+
462
+ def get_structured_data(self, content_id: str) -> dict:
403
463
  """
404
464
  Query metadata for a specific content ID in a given index.
405
465
 
@@ -443,6 +503,14 @@ class IndexifyClient:
443
503
  )
444
504
  response.raise_for_status()
445
505
 
506
+ def list_schemas(self) -> List[str]:
507
+ """
508
+ List all schemas in the current namespace.
509
+ """
510
+ response = self.get(f"namespaces/{self.namespace}/schemas")
511
+ response.raise_for_status()
512
+ return response.json()
513
+
446
514
  def sql_query(self, query: str):
447
515
  """
448
516
  Execute a SQL query.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.0.13
3
+ Version: 0.0.15
4
4
  Summary: Python Client for Indexify
5
5
  Home-page: https://github.com/tensorlakeai/indexify
6
6
  License: Apache 2.0
@@ -1,5 +1,5 @@
1
1
  indexify/__init__.py,sha256=Sz6zkAIHsPOi0rG5RM7dVkXGDa0fO2uurD6vS4Qo15E,312
2
- indexify/client.py,sha256=OpIvM5sUeddMtVGWoCrtzA_6gOqrpMKOkjv3EkTRdl4,15021
2
+ indexify/client.py,sha256=VtEqSE7hO4CWRweaCBBiA3KmS3Q8XGpkvfOqDc5xhAw,17176
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
@@ -7,7 +7,7 @@ indexify/extractor.py,sha256=KMcP9xopHJRBzeSxalztGGTBvOzVKRFEsJynV-hLRSc,1175
7
7
  indexify/index.py,sha256=RvxYhJXEth-GKvqzlMiz5PuN1eIbZk84pt20piA1Gsw,504
8
8
  indexify/settings.py,sha256=yzWAEZkrTjykSMj3hrFU7l_jUoUCOUsgPVW1nU-qzJQ,46
9
9
  indexify/utils.py,sha256=rDN2lrsAs9noJEIjfx6ukmC2SAIyrlUt7QU-kaBjujM,125
10
- indexify-0.0.13.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- indexify-0.0.13.dist-info/METADATA,sha256=nlYOFRQib2LmdyrF9w_Bwxb5eNrH6wFOsrNOykJdNK8,1714
12
- indexify-0.0.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
- indexify-0.0.13.dist-info/RECORD,,
10
+ indexify-0.0.15.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ indexify-0.0.15.dist-info/METADATA,sha256=jsXSt36fuQ_oWPv5j9S_EC3TI6IEKEs0wIxxlH0YgwY,1714
12
+ indexify-0.0.15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
+ indexify-0.0.15.dist-info/RECORD,,