groundx 2.3.0__py3-none-any.whl → 2.3.5__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.
Files changed (82) hide show
  1. groundx/__init__.py +16 -16
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +47 -366
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +15 -17
  6. groundx/core/__init__.py +5 -0
  7. groundx/core/api_error.py +13 -5
  8. groundx/core/client_wrapper.py +4 -3
  9. groundx/core/force_multipart.py +16 -0
  10. groundx/core/http_client.py +70 -26
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +69 -110
  14. groundx/core/serialization.py +7 -3
  15. groundx/customer/__init__.py +2 -0
  16. groundx/customer/client.py +31 -43
  17. groundx/customer/raw_client.py +91 -0
  18. groundx/documents/__init__.py +2 -0
  19. groundx/documents/client.py +122 -789
  20. groundx/documents/raw_client.py +1404 -0
  21. groundx/errors/__init__.py +2 -0
  22. groundx/errors/bad_request_error.py +4 -3
  23. groundx/errors/unauthorized_error.py +4 -3
  24. groundx/groups/__init__.py +2 -0
  25. groundx/groups/client.py +55 -520
  26. groundx/groups/raw_client.py +901 -0
  27. groundx/health/__init__.py +2 -0
  28. groundx/health/client.py +35 -101
  29. groundx/health/raw_client.py +193 -0
  30. groundx/ingest.py +2 -2
  31. groundx/search/__init__.py +2 -0
  32. groundx/search/client.py +82 -211
  33. groundx/search/raw_client.py +442 -0
  34. groundx/search/types/__init__.py +2 -0
  35. groundx/types/__init__.py +16 -16
  36. groundx/types/bounding_box_detail.py +4 -4
  37. groundx/types/bucket_detail.py +5 -5
  38. groundx/types/bucket_list_response.py +17 -3
  39. groundx/types/bucket_response.py +3 -3
  40. groundx/types/bucket_update_detail.py +4 -4
  41. groundx/types/bucket_update_response.py +3 -3
  42. groundx/types/customer_detail.py +2 -2
  43. groundx/types/customer_response.py +3 -3
  44. groundx/types/document.py +4 -4
  45. groundx/types/document_detail.py +9 -4
  46. groundx/types/document_list_response.py +4 -4
  47. groundx/types/document_local_ingest_request.py +1 -0
  48. groundx/types/document_lookup_response.py +8 -3
  49. groundx/types/document_response.py +3 -3
  50. groundx/types/group_detail.py +4 -4
  51. groundx/types/group_list_response.py +17 -3
  52. groundx/types/group_response.py +3 -3
  53. groundx/types/health_response.py +3 -3
  54. groundx/types/health_response_health.py +3 -3
  55. groundx/types/health_service.py +5 -5
  56. groundx/types/ingest_local_document.py +3 -3
  57. groundx/types/ingest_local_document_metadata.py +9 -4
  58. groundx/types/ingest_remote_document.py +10 -5
  59. groundx/types/ingest_response.py +4 -4
  60. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  61. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  62. groundx/types/ingest_status_progress.py +26 -0
  63. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  64. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  65. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  66. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  67. groundx/types/message_response.py +2 -2
  68. groundx/types/meter_detail.py +2 -2
  69. groundx/types/processes_status_response.py +19 -2
  70. groundx/types/search_response.py +3 -3
  71. groundx/types/search_response_search.py +3 -3
  72. groundx/types/search_result_item.py +5 -5
  73. groundx/types/subscription_detail.py +3 -3
  74. groundx/types/subscription_detail_meters.py +5 -5
  75. groundx/types/website_source.py +4 -4
  76. {groundx-2.3.0.dist-info → groundx-2.3.5.dist-info}/METADATA +1 -1
  77. groundx-2.3.5.dist-info/RECORD +95 -0
  78. groundx/types/process_status_response.py +0 -20
  79. groundx/types/process_status_response_ingest_progress.py +0 -26
  80. groundx-2.3.0.dist-info/RECORD +0 -88
  81. {groundx-2.3.0.dist-info → groundx-2.3.5.dist-info}/LICENSE +0 -0
  82. {groundx-2.3.0.dist-info → groundx-2.3.5.dist-info}/WHEEL +0 -0
@@ -1,28 +1,21 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from ..core.client_wrapper import SyncClientWrapper
5
- from ..types.ingest_remote_document import IngestRemoteDocument
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
- from ..types.ingest_response import IngestResponse
8
- from ..core.serialization import convert_and_respect_annotation_metadata
9
- from ..core.pydantic_utilities import parse_obj_as
10
- from ..errors.bad_request_error import BadRequestError
11
- from ..errors.unauthorized_error import UnauthorizedError
12
- from json.decoder import JSONDecodeError
13
- from ..core.api_error import ApiError
14
- from ..types.document_local_ingest_request import DocumentLocalIngestRequest
15
- from ..types.website_source import WebsiteSource
16
- from ..types.sort import Sort
17
- from ..types.sort_order import SortOrder
18
- from ..types.processing_status import ProcessingStatus
19
7
  from ..types.document_list_response import DocumentListResponse
20
- from ..types.process_status_response import ProcessStatusResponse
21
- from ..core.jsonable_encoder import jsonable_encoder
8
+ from ..types.document_local_ingest_request import DocumentLocalIngestRequest
22
9
  from ..types.document_lookup_response import DocumentLookupResponse
23
10
  from ..types.document_response import DocumentResponse
11
+ from ..types.ingest_remote_document import IngestRemoteDocument
12
+ from ..types.ingest_response import IngestResponse
24
13
  from ..types.processes_status_response import ProcessesStatusResponse
25
- from ..core.client_wrapper import AsyncClientWrapper
14
+ from ..types.processing_status import ProcessingStatus
15
+ from ..types.sort import Sort
16
+ from ..types.sort_order import SortOrder
17
+ from ..types.website_source import WebsiteSource
18
+ from .raw_client import AsyncRawDocumentsClient, RawDocumentsClient
26
19
 
27
20
  # this is used as the default value for optional parameters
28
21
  OMIT = typing.cast(typing.Any, ...)
@@ -30,7 +23,18 @@ OMIT = typing.cast(typing.Any, ...)
30
23
 
31
24
  class DocumentsClient:
32
25
  def __init__(self, *, client_wrapper: SyncClientWrapper):
33
- self._client_wrapper = client_wrapper
26
+ self._raw_client = RawDocumentsClient(client_wrapper=client_wrapper)
27
+
28
+ @property
29
+ def with_raw_response(self) -> RawDocumentsClient:
30
+ """
31
+ Retrieves a raw implementation of this client that returns raw responses.
32
+
33
+ Returns
34
+ -------
35
+ RawDocumentsClient
36
+ """
37
+ return self._raw_client
34
38
 
35
39
  def ingest_remote(
36
40
  self,
@@ -41,6 +45,8 @@ class DocumentsClient:
41
45
  """
42
46
  Ingest documents hosted on public URLs into a GroundX bucket.
43
47
 
48
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
49
+
44
50
  Parameters
45
51
  ----------
46
52
  documents : typing.Sequence[IngestRemoteDocument]
@@ -71,53 +77,8 @@ class DocumentsClient:
71
77
  ],
72
78
  )
73
79
  """
74
- _response = self._client_wrapper.httpx_client.request(
75
- "v1/ingest/documents/remote",
76
- method="POST",
77
- json={
78
- "documents": convert_and_respect_annotation_metadata(
79
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
80
- ),
81
- },
82
- headers={
83
- "content-type": "application/json",
84
- },
85
- request_options=request_options,
86
- omit=OMIT,
87
- )
88
- try:
89
- if 200 <= _response.status_code < 300:
90
- return typing.cast(
91
- IngestResponse,
92
- parse_obj_as(
93
- type_=IngestResponse, # type: ignore
94
- object_=_response.json(),
95
- ),
96
- )
97
- if _response.status_code == 400:
98
- raise BadRequestError(
99
- typing.cast(
100
- typing.Optional[typing.Any],
101
- parse_obj_as(
102
- type_=typing.Optional[typing.Any], # type: ignore
103
- object_=_response.json(),
104
- ),
105
- )
106
- )
107
- if _response.status_code == 401:
108
- raise UnauthorizedError(
109
- typing.cast(
110
- typing.Optional[typing.Any],
111
- parse_obj_as(
112
- type_=typing.Optional[typing.Any], # type: ignore
113
- object_=_response.json(),
114
- ),
115
- )
116
- )
117
- _response_json = _response.json()
118
- except JSONDecodeError:
119
- raise ApiError(status_code=_response.status_code, body=_response.text)
120
- raise ApiError(status_code=_response.status_code, body=_response_json)
80
+ _response = self._raw_client.ingest_remote(documents=documents, request_options=request_options)
81
+ return _response.data
121
82
 
122
83
  def ingest_local(
123
84
  self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
@@ -125,6 +86,8 @@ class DocumentsClient:
125
86
  """
126
87
  Upload documents hosted on a local file system into a GroundX bucket.
127
88
 
89
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
90
+
128
91
  Parameters
129
92
  ----------
130
93
  request : DocumentLocalIngestRequest
@@ -157,57 +120,20 @@ class DocumentsClient:
157
120
  ],
158
121
  )
159
122
  """
160
- _response = self._client_wrapper.httpx_client.request(
161
- "v1/ingest/documents/local",
162
- method="POST",
163
- json=convert_and_respect_annotation_metadata(
164
- object_=request, annotation=DocumentLocalIngestRequest, direction="write"
165
- ),
166
- request_options=request_options,
167
- omit=OMIT,
168
- )
169
- try:
170
- if 200 <= _response.status_code < 300:
171
- return typing.cast(
172
- IngestResponse,
173
- parse_obj_as(
174
- type_=IngestResponse, # type: ignore
175
- object_=_response.json(),
176
- ),
177
- )
178
- if _response.status_code == 400:
179
- raise BadRequestError(
180
- typing.cast(
181
- typing.Optional[typing.Any],
182
- parse_obj_as(
183
- type_=typing.Optional[typing.Any], # type: ignore
184
- object_=_response.json(),
185
- ),
186
- )
187
- )
188
- if _response.status_code == 401:
189
- raise UnauthorizedError(
190
- typing.cast(
191
- typing.Optional[typing.Any],
192
- parse_obj_as(
193
- type_=typing.Optional[typing.Any], # type: ignore
194
- object_=_response.json(),
195
- ),
196
- )
197
- )
198
- _response_json = _response.json()
199
- except JSONDecodeError:
200
- raise ApiError(status_code=_response.status_code, body=_response.text)
201
- raise ApiError(status_code=_response.status_code, body=_response_json)
123
+ _response = self._raw_client.ingest_local(request=request, request_options=request_options)
124
+ return _response.data
202
125
 
203
126
  def crawl_website(
204
127
  self, *, websites: typing.Sequence[WebsiteSource], request_options: typing.Optional[RequestOptions] = None
205
128
  ) -> IngestResponse:
206
129
  """
207
130
  Upload the content of a publicly accessible website for ingestion into a GroundX bucket. This is done by following links within a specified URL, recursively, up to a specified depth or number of pages.
131
+
208
132
  Note1: This endpoint is currently not supported for on-prem deployments.
209
133
  Note2: The `source_url` must include the protocol, http:// or https://.
210
134
 
135
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
136
+
211
137
  Parameters
212
138
  ----------
213
139
  websites : typing.Sequence[WebsiteSource]
@@ -239,53 +165,8 @@ class DocumentsClient:
239
165
  ],
240
166
  )
241
167
  """
242
- _response = self._client_wrapper.httpx_client.request(
243
- "v1/ingest/documents/website",
244
- method="POST",
245
- json={
246
- "websites": convert_and_respect_annotation_metadata(
247
- object_=websites, annotation=typing.Sequence[WebsiteSource], direction="write"
248
- ),
249
- },
250
- headers={
251
- "content-type": "application/json",
252
- },
253
- request_options=request_options,
254
- omit=OMIT,
255
- )
256
- try:
257
- if 200 <= _response.status_code < 300:
258
- return typing.cast(
259
- IngestResponse,
260
- parse_obj_as(
261
- type_=IngestResponse, # type: ignore
262
- object_=_response.json(),
263
- ),
264
- )
265
- if _response.status_code == 400:
266
- raise BadRequestError(
267
- typing.cast(
268
- typing.Optional[typing.Any],
269
- parse_obj_as(
270
- type_=typing.Optional[typing.Any], # type: ignore
271
- object_=_response.json(),
272
- ),
273
- )
274
- )
275
- if _response.status_code == 401:
276
- raise UnauthorizedError(
277
- typing.cast(
278
- typing.Optional[typing.Any],
279
- parse_obj_as(
280
- type_=typing.Optional[typing.Any], # type: ignore
281
- object_=_response.json(),
282
- ),
283
- )
284
- )
285
- _response_json = _response.json()
286
- except JSONDecodeError:
287
- raise ApiError(status_code=_response.status_code, body=_response.text)
288
- raise ApiError(status_code=_response.status_code, body=_response_json)
168
+ _response = self._raw_client.crawl_website(websites=websites, request_options=request_options)
169
+ return _response.data
289
170
 
290
171
  def list(
291
172
  self,
@@ -338,32 +219,16 @@ class DocumentsClient:
338
219
  )
339
220
  client.documents.list()
340
221
  """
341
- _response = self._client_wrapper.httpx_client.request(
342
- "v1/ingest/documents",
343
- method="GET",
344
- params={
345
- "n": n,
346
- "filter": filter,
347
- "sort": sort,
348
- "sortOrder": sort_order,
349
- "status": status,
350
- "nextToken": next_token,
351
- },
222
+ _response = self._raw_client.list(
223
+ n=n,
224
+ filter=filter,
225
+ sort=sort,
226
+ sort_order=sort_order,
227
+ status=status,
228
+ next_token=next_token,
352
229
  request_options=request_options,
353
230
  )
354
- try:
355
- if 200 <= _response.status_code < 300:
356
- return typing.cast(
357
- DocumentListResponse,
358
- parse_obj_as(
359
- type_=DocumentListResponse, # type: ignore
360
- object_=_response.json(),
361
- ),
362
- )
363
- _response_json = _response.json()
364
- except JSONDecodeError:
365
- raise ApiError(status_code=_response.status_code, body=_response.text)
366
- raise ApiError(status_code=_response.status_code, body=_response_json)
231
+ return _response.data
367
232
 
368
233
  def delete(
369
234
  self,
@@ -398,51 +263,12 @@ class DocumentsClient:
398
263
  document_ids="123e4567-e89b-12d3-a456-426614174000,9f7c11a6-24b8-4d52-a9f3-90a7e70a9e49",
399
264
  )
400
265
  """
401
- _response = self._client_wrapper.httpx_client.request(
402
- "v1/ingest/documents",
403
- method="DELETE",
404
- params={
405
- "documentIds": document_ids,
406
- },
407
- request_options=request_options,
408
- )
409
- try:
410
- if 200 <= _response.status_code < 300:
411
- return typing.cast(
412
- IngestResponse,
413
- parse_obj_as(
414
- type_=IngestResponse, # type: ignore
415
- object_=_response.json(),
416
- ),
417
- )
418
- if _response.status_code == 400:
419
- raise BadRequestError(
420
- typing.cast(
421
- typing.Optional[typing.Any],
422
- parse_obj_as(
423
- type_=typing.Optional[typing.Any], # type: ignore
424
- object_=_response.json(),
425
- ),
426
- )
427
- )
428
- if _response.status_code == 401:
429
- raise UnauthorizedError(
430
- typing.cast(
431
- typing.Optional[typing.Any],
432
- parse_obj_as(
433
- type_=typing.Optional[typing.Any], # type: ignore
434
- object_=_response.json(),
435
- ),
436
- )
437
- )
438
- _response_json = _response.json()
439
- except JSONDecodeError:
440
- raise ApiError(status_code=_response.status_code, body=_response.text)
441
- raise ApiError(status_code=_response.status_code, body=_response_json)
266
+ _response = self._raw_client.delete(document_ids=document_ids, request_options=request_options)
267
+ return _response.data
442
268
 
443
269
  def get_processing_status_by_id(
444
270
  self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
445
- ) -> ProcessStatusResponse:
271
+ ) -> IngestResponse:
446
272
  """
447
273
  Get the current status of an ingest, initiated with documents.ingest_remote, documents.ingest_local, or documents.crawl_website, by specifying the processId (the processId is included in the response of the documents.ingest functions).
448
274
 
@@ -456,7 +282,7 @@ class DocumentsClient:
456
282
 
457
283
  Returns
458
284
  -------
459
- ProcessStatusResponse
285
+ IngestResponse
460
286
  Look up success
461
287
 
462
288
  Examples
@@ -470,44 +296,8 @@ class DocumentsClient:
470
296
  process_id="processId",
471
297
  )
472
298
  """
473
- _response = self._client_wrapper.httpx_client.request(
474
- f"v1/ingest/{jsonable_encoder(process_id)}",
475
- method="GET",
476
- request_options=request_options,
477
- )
478
- try:
479
- if 200 <= _response.status_code < 300:
480
- return typing.cast(
481
- ProcessStatusResponse,
482
- parse_obj_as(
483
- type_=ProcessStatusResponse, # type: ignore
484
- object_=_response.json(),
485
- ),
486
- )
487
- if _response.status_code == 400:
488
- raise BadRequestError(
489
- typing.cast(
490
- typing.Optional[typing.Any],
491
- parse_obj_as(
492
- type_=typing.Optional[typing.Any], # type: ignore
493
- object_=_response.json(),
494
- ),
495
- )
496
- )
497
- if _response.status_code == 401:
498
- raise UnauthorizedError(
499
- typing.cast(
500
- typing.Optional[typing.Any],
501
- parse_obj_as(
502
- type_=typing.Optional[typing.Any], # type: ignore
503
- object_=_response.json(),
504
- ),
505
- )
506
- )
507
- _response_json = _response.json()
508
- except JSONDecodeError:
509
- raise ApiError(status_code=_response.status_code, body=_response.text)
510
- raise ApiError(status_code=_response.status_code, body=_response_json)
299
+ _response = self._raw_client.get_processing_status_by_id(process_id, request_options=request_options)
300
+ return _response.data
511
301
 
512
302
  def lookup(
513
303
  self,
@@ -522,12 +312,12 @@ class DocumentsClient:
522
312
  request_options: typing.Optional[RequestOptions] = None,
523
313
  ) -> DocumentLookupResponse:
524
314
  """
525
- lookup the document(s) associated with a processId, bucketId, groupId, or projectId.
315
+ lookup the document(s) associated with a processId, bucketId, or groupId.
526
316
 
527
317
  Parameters
528
318
  ----------
529
319
  id : int
530
- a processId, bucketId, groupId, or projectId
320
+ a processId, bucketId, or groupId
531
321
 
532
322
  n : typing.Optional[int]
533
323
  The maximum number of returned documents. Accepts 1-100 with a default of 20.
@@ -566,52 +356,17 @@ class DocumentsClient:
566
356
  id=1,
567
357
  )
568
358
  """
569
- _response = self._client_wrapper.httpx_client.request(
570
- f"v1/ingest/documents/{jsonable_encoder(id)}",
571
- method="GET",
572
- params={
573
- "n": n,
574
- "filter": filter,
575
- "sort": sort,
576
- "sortOrder": sort_order,
577
- "status": status,
578
- "nextToken": next_token,
579
- },
359
+ _response = self._raw_client.lookup(
360
+ id,
361
+ n=n,
362
+ filter=filter,
363
+ sort=sort,
364
+ sort_order=sort_order,
365
+ status=status,
366
+ next_token=next_token,
580
367
  request_options=request_options,
581
368
  )
582
- try:
583
- if 200 <= _response.status_code < 300:
584
- return typing.cast(
585
- DocumentLookupResponse,
586
- parse_obj_as(
587
- type_=DocumentLookupResponse, # type: ignore
588
- object_=_response.json(),
589
- ),
590
- )
591
- if _response.status_code == 400:
592
- raise BadRequestError(
593
- typing.cast(
594
- typing.Optional[typing.Any],
595
- parse_obj_as(
596
- type_=typing.Optional[typing.Any], # type: ignore
597
- object_=_response.json(),
598
- ),
599
- )
600
- )
601
- if _response.status_code == 401:
602
- raise UnauthorizedError(
603
- typing.cast(
604
- typing.Optional[typing.Any],
605
- parse_obj_as(
606
- type_=typing.Optional[typing.Any], # type: ignore
607
- object_=_response.json(),
608
- ),
609
- )
610
- )
611
- _response_json = _response.json()
612
- except JSONDecodeError:
613
- raise ApiError(status_code=_response.status_code, body=_response.text)
614
- raise ApiError(status_code=_response.status_code, body=_response_json)
369
+ return _response.data
615
370
 
616
371
  def get(self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentResponse:
617
372
  """
@@ -641,44 +396,8 @@ class DocumentsClient:
641
396
  document_id="documentId",
642
397
  )
643
398
  """
644
- _response = self._client_wrapper.httpx_client.request(
645
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
646
- method="GET",
647
- request_options=request_options,
648
- )
649
- try:
650
- if 200 <= _response.status_code < 300:
651
- return typing.cast(
652
- DocumentResponse,
653
- parse_obj_as(
654
- type_=DocumentResponse, # type: ignore
655
- object_=_response.json(),
656
- ),
657
- )
658
- if _response.status_code == 400:
659
- raise BadRequestError(
660
- typing.cast(
661
- typing.Optional[typing.Any],
662
- parse_obj_as(
663
- type_=typing.Optional[typing.Any], # type: ignore
664
- object_=_response.json(),
665
- ),
666
- )
667
- )
668
- if _response.status_code == 401:
669
- raise UnauthorizedError(
670
- typing.cast(
671
- typing.Optional[typing.Any],
672
- parse_obj_as(
673
- type_=typing.Optional[typing.Any], # type: ignore
674
- object_=_response.json(),
675
- ),
676
- )
677
- )
678
- _response_json = _response.json()
679
- except JSONDecodeError:
680
- raise ApiError(status_code=_response.status_code, body=_response.text)
681
- raise ApiError(status_code=_response.status_code, body=_response_json)
399
+ _response = self._raw_client.get(document_id, request_options=request_options)
400
+ return _response.data
682
401
 
683
402
  def delete_by_id(
684
403
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -710,44 +429,8 @@ class DocumentsClient:
710
429
  document_id="documentId",
711
430
  )
712
431
  """
713
- _response = self._client_wrapper.httpx_client.request(
714
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
715
- method="DELETE",
716
- request_options=request_options,
717
- )
718
- try:
719
- if 200 <= _response.status_code < 300:
720
- return typing.cast(
721
- IngestResponse,
722
- parse_obj_as(
723
- type_=IngestResponse, # type: ignore
724
- object_=_response.json(),
725
- ),
726
- )
727
- if _response.status_code == 400:
728
- raise BadRequestError(
729
- typing.cast(
730
- typing.Optional[typing.Any],
731
- parse_obj_as(
732
- type_=typing.Optional[typing.Any], # type: ignore
733
- object_=_response.json(),
734
- ),
735
- )
736
- )
737
- if _response.status_code == 401:
738
- raise UnauthorizedError(
739
- typing.cast(
740
- typing.Optional[typing.Any],
741
- parse_obj_as(
742
- type_=typing.Optional[typing.Any], # type: ignore
743
- object_=_response.json(),
744
- ),
745
- )
746
- )
747
- _response_json = _response.json()
748
- except JSONDecodeError:
749
- raise ApiError(status_code=_response.status_code, body=_response.text)
750
- raise ApiError(status_code=_response.status_code, body=_response_json)
432
+ _response = self._raw_client.delete_by_id(document_id, request_options=request_options)
433
+ return _response.data
751
434
 
752
435
  def get_processes(
753
436
  self,
@@ -784,33 +467,24 @@ class DocumentsClient:
784
467
  )
785
468
  client.documents.get_processes()
786
469
  """
787
- _response = self._client_wrapper.httpx_client.request(
788
- "v1/ingest",
789
- method="GET",
790
- params={
791
- "n": n,
792
- "status": status,
793
- },
794
- request_options=request_options,
795
- )
796
- try:
797
- if 200 <= _response.status_code < 300:
798
- return typing.cast(
799
- ProcessesStatusResponse,
800
- parse_obj_as(
801
- type_=ProcessesStatusResponse, # type: ignore
802
- object_=_response.json(),
803
- ),
804
- )
805
- _response_json = _response.json()
806
- except JSONDecodeError:
807
- raise ApiError(status_code=_response.status_code, body=_response.text)
808
- raise ApiError(status_code=_response.status_code, body=_response_json)
470
+ _response = self._raw_client.get_processes(n=n, status=status, request_options=request_options)
471
+ return _response.data
809
472
 
810
473
 
811
474
  class AsyncDocumentsClient:
812
475
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
813
- self._client_wrapper = client_wrapper
476
+ self._raw_client = AsyncRawDocumentsClient(client_wrapper=client_wrapper)
477
+
478
+ @property
479
+ def with_raw_response(self) -> AsyncRawDocumentsClient:
480
+ """
481
+ Retrieves a raw implementation of this client that returns raw responses.
482
+
483
+ Returns
484
+ -------
485
+ AsyncRawDocumentsClient
486
+ """
487
+ return self._raw_client
814
488
 
815
489
  async def ingest_remote(
816
490
  self,
@@ -821,6 +495,8 @@ class AsyncDocumentsClient:
821
495
  """
822
496
  Ingest documents hosted on public URLs into a GroundX bucket.
823
497
 
498
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
499
+
824
500
  Parameters
825
501
  ----------
826
502
  documents : typing.Sequence[IngestRemoteDocument]
@@ -859,53 +535,8 @@ class AsyncDocumentsClient:
859
535
 
860
536
  asyncio.run(main())
861
537
  """
862
- _response = await self._client_wrapper.httpx_client.request(
863
- "v1/ingest/documents/remote",
864
- method="POST",
865
- json={
866
- "documents": convert_and_respect_annotation_metadata(
867
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
868
- ),
869
- },
870
- headers={
871
- "content-type": "application/json",
872
- },
873
- request_options=request_options,
874
- omit=OMIT,
875
- )
876
- try:
877
- if 200 <= _response.status_code < 300:
878
- return typing.cast(
879
- IngestResponse,
880
- parse_obj_as(
881
- type_=IngestResponse, # type: ignore
882
- object_=_response.json(),
883
- ),
884
- )
885
- if _response.status_code == 400:
886
- raise BadRequestError(
887
- typing.cast(
888
- typing.Optional[typing.Any],
889
- parse_obj_as(
890
- type_=typing.Optional[typing.Any], # type: ignore
891
- object_=_response.json(),
892
- ),
893
- )
894
- )
895
- if _response.status_code == 401:
896
- raise UnauthorizedError(
897
- typing.cast(
898
- typing.Optional[typing.Any],
899
- parse_obj_as(
900
- type_=typing.Optional[typing.Any], # type: ignore
901
- object_=_response.json(),
902
- ),
903
- )
904
- )
905
- _response_json = _response.json()
906
- except JSONDecodeError:
907
- raise ApiError(status_code=_response.status_code, body=_response.text)
908
- raise ApiError(status_code=_response.status_code, body=_response_json)
538
+ _response = await self._raw_client.ingest_remote(documents=documents, request_options=request_options)
539
+ return _response.data
909
540
 
910
541
  async def ingest_local(
911
542
  self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
@@ -913,6 +544,8 @@ class AsyncDocumentsClient:
913
544
  """
914
545
  Upload documents hosted on a local file system into a GroundX bucket.
915
546
 
547
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
548
+
916
549
  Parameters
917
550
  ----------
918
551
  request : DocumentLocalIngestRequest
@@ -957,57 +590,20 @@ class AsyncDocumentsClient:
957
590
 
958
591
  asyncio.run(main())
959
592
  """
960
- _response = await self._client_wrapper.httpx_client.request(
961
- "v1/ingest/documents/local",
962
- method="POST",
963
- json=convert_and_respect_annotation_metadata(
964
- object_=request, annotation=DocumentLocalIngestRequest, direction="write"
965
- ),
966
- request_options=request_options,
967
- omit=OMIT,
968
- )
969
- try:
970
- if 200 <= _response.status_code < 300:
971
- return typing.cast(
972
- IngestResponse,
973
- parse_obj_as(
974
- type_=IngestResponse, # type: ignore
975
- object_=_response.json(),
976
- ),
977
- )
978
- if _response.status_code == 400:
979
- raise BadRequestError(
980
- typing.cast(
981
- typing.Optional[typing.Any],
982
- parse_obj_as(
983
- type_=typing.Optional[typing.Any], # type: ignore
984
- object_=_response.json(),
985
- ),
986
- )
987
- )
988
- if _response.status_code == 401:
989
- raise UnauthorizedError(
990
- typing.cast(
991
- typing.Optional[typing.Any],
992
- parse_obj_as(
993
- type_=typing.Optional[typing.Any], # type: ignore
994
- object_=_response.json(),
995
- ),
996
- )
997
- )
998
- _response_json = _response.json()
999
- except JSONDecodeError:
1000
- raise ApiError(status_code=_response.status_code, body=_response.text)
1001
- raise ApiError(status_code=_response.status_code, body=_response_json)
593
+ _response = await self._raw_client.ingest_local(request=request, request_options=request_options)
594
+ return _response.data
1002
595
 
1003
596
  async def crawl_website(
1004
597
  self, *, websites: typing.Sequence[WebsiteSource], request_options: typing.Optional[RequestOptions] = None
1005
598
  ) -> IngestResponse:
1006
599
  """
1007
600
  Upload the content of a publicly accessible website for ingestion into a GroundX bucket. This is done by following links within a specified URL, recursively, up to a specified depth or number of pages.
601
+
1008
602
  Note1: This endpoint is currently not supported for on-prem deployments.
1009
603
  Note2: The `source_url` must include the protocol, http:// or https://.
1010
604
 
605
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
606
+
1011
607
  Parameters
1012
608
  ----------
1013
609
  websites : typing.Sequence[WebsiteSource]
@@ -1047,53 +643,8 @@ class AsyncDocumentsClient:
1047
643
 
1048
644
  asyncio.run(main())
1049
645
  """
1050
- _response = await self._client_wrapper.httpx_client.request(
1051
- "v1/ingest/documents/website",
1052
- method="POST",
1053
- json={
1054
- "websites": convert_and_respect_annotation_metadata(
1055
- object_=websites, annotation=typing.Sequence[WebsiteSource], direction="write"
1056
- ),
1057
- },
1058
- headers={
1059
- "content-type": "application/json",
1060
- },
1061
- request_options=request_options,
1062
- omit=OMIT,
1063
- )
1064
- try:
1065
- if 200 <= _response.status_code < 300:
1066
- return typing.cast(
1067
- IngestResponse,
1068
- parse_obj_as(
1069
- type_=IngestResponse, # type: ignore
1070
- object_=_response.json(),
1071
- ),
1072
- )
1073
- if _response.status_code == 400:
1074
- raise BadRequestError(
1075
- typing.cast(
1076
- typing.Optional[typing.Any],
1077
- parse_obj_as(
1078
- type_=typing.Optional[typing.Any], # type: ignore
1079
- object_=_response.json(),
1080
- ),
1081
- )
1082
- )
1083
- if _response.status_code == 401:
1084
- raise UnauthorizedError(
1085
- typing.cast(
1086
- typing.Optional[typing.Any],
1087
- parse_obj_as(
1088
- type_=typing.Optional[typing.Any], # type: ignore
1089
- object_=_response.json(),
1090
- ),
1091
- )
1092
- )
1093
- _response_json = _response.json()
1094
- except JSONDecodeError:
1095
- raise ApiError(status_code=_response.status_code, body=_response.text)
1096
- raise ApiError(status_code=_response.status_code, body=_response_json)
646
+ _response = await self._raw_client.crawl_website(websites=websites, request_options=request_options)
647
+ return _response.data
1097
648
 
1098
649
  async def list(
1099
650
  self,
@@ -1154,32 +705,16 @@ class AsyncDocumentsClient:
1154
705
 
1155
706
  asyncio.run(main())
1156
707
  """
1157
- _response = await self._client_wrapper.httpx_client.request(
1158
- "v1/ingest/documents",
1159
- method="GET",
1160
- params={
1161
- "n": n,
1162
- "filter": filter,
1163
- "sort": sort,
1164
- "sortOrder": sort_order,
1165
- "status": status,
1166
- "nextToken": next_token,
1167
- },
708
+ _response = await self._raw_client.list(
709
+ n=n,
710
+ filter=filter,
711
+ sort=sort,
712
+ sort_order=sort_order,
713
+ status=status,
714
+ next_token=next_token,
1168
715
  request_options=request_options,
1169
716
  )
1170
- try:
1171
- if 200 <= _response.status_code < 300:
1172
- return typing.cast(
1173
- DocumentListResponse,
1174
- parse_obj_as(
1175
- type_=DocumentListResponse, # type: ignore
1176
- object_=_response.json(),
1177
- ),
1178
- )
1179
- _response_json = _response.json()
1180
- except JSONDecodeError:
1181
- raise ApiError(status_code=_response.status_code, body=_response.text)
1182
- raise ApiError(status_code=_response.status_code, body=_response_json)
717
+ return _response.data
1183
718
 
1184
719
  async def delete(
1185
720
  self,
@@ -1222,51 +757,12 @@ class AsyncDocumentsClient:
1222
757
 
1223
758
  asyncio.run(main())
1224
759
  """
1225
- _response = await self._client_wrapper.httpx_client.request(
1226
- "v1/ingest/documents",
1227
- method="DELETE",
1228
- params={
1229
- "documentIds": document_ids,
1230
- },
1231
- request_options=request_options,
1232
- )
1233
- try:
1234
- if 200 <= _response.status_code < 300:
1235
- return typing.cast(
1236
- IngestResponse,
1237
- parse_obj_as(
1238
- type_=IngestResponse, # type: ignore
1239
- object_=_response.json(),
1240
- ),
1241
- )
1242
- if _response.status_code == 400:
1243
- raise BadRequestError(
1244
- typing.cast(
1245
- typing.Optional[typing.Any],
1246
- parse_obj_as(
1247
- type_=typing.Optional[typing.Any], # type: ignore
1248
- object_=_response.json(),
1249
- ),
1250
- )
1251
- )
1252
- if _response.status_code == 401:
1253
- raise UnauthorizedError(
1254
- typing.cast(
1255
- typing.Optional[typing.Any],
1256
- parse_obj_as(
1257
- type_=typing.Optional[typing.Any], # type: ignore
1258
- object_=_response.json(),
1259
- ),
1260
- )
1261
- )
1262
- _response_json = _response.json()
1263
- except JSONDecodeError:
1264
- raise ApiError(status_code=_response.status_code, body=_response.text)
1265
- raise ApiError(status_code=_response.status_code, body=_response_json)
760
+ _response = await self._raw_client.delete(document_ids=document_ids, request_options=request_options)
761
+ return _response.data
1266
762
 
1267
763
  async def get_processing_status_by_id(
1268
764
  self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
1269
- ) -> ProcessStatusResponse:
765
+ ) -> IngestResponse:
1270
766
  """
1271
767
  Get the current status of an ingest, initiated with documents.ingest_remote, documents.ingest_local, or documents.crawl_website, by specifying the processId (the processId is included in the response of the documents.ingest functions).
1272
768
 
@@ -1280,7 +776,7 @@ class AsyncDocumentsClient:
1280
776
 
1281
777
  Returns
1282
778
  -------
1283
- ProcessStatusResponse
779
+ IngestResponse
1284
780
  Look up success
1285
781
 
1286
782
  Examples
@@ -1302,44 +798,8 @@ class AsyncDocumentsClient:
1302
798
 
1303
799
  asyncio.run(main())
1304
800
  """
1305
- _response = await self._client_wrapper.httpx_client.request(
1306
- f"v1/ingest/{jsonable_encoder(process_id)}",
1307
- method="GET",
1308
- request_options=request_options,
1309
- )
1310
- try:
1311
- if 200 <= _response.status_code < 300:
1312
- return typing.cast(
1313
- ProcessStatusResponse,
1314
- parse_obj_as(
1315
- type_=ProcessStatusResponse, # type: ignore
1316
- object_=_response.json(),
1317
- ),
1318
- )
1319
- if _response.status_code == 400:
1320
- raise BadRequestError(
1321
- typing.cast(
1322
- typing.Optional[typing.Any],
1323
- parse_obj_as(
1324
- type_=typing.Optional[typing.Any], # type: ignore
1325
- object_=_response.json(),
1326
- ),
1327
- )
1328
- )
1329
- if _response.status_code == 401:
1330
- raise UnauthorizedError(
1331
- typing.cast(
1332
- typing.Optional[typing.Any],
1333
- parse_obj_as(
1334
- type_=typing.Optional[typing.Any], # type: ignore
1335
- object_=_response.json(),
1336
- ),
1337
- )
1338
- )
1339
- _response_json = _response.json()
1340
- except JSONDecodeError:
1341
- raise ApiError(status_code=_response.status_code, body=_response.text)
1342
- raise ApiError(status_code=_response.status_code, body=_response_json)
801
+ _response = await self._raw_client.get_processing_status_by_id(process_id, request_options=request_options)
802
+ return _response.data
1343
803
 
1344
804
  async def lookup(
1345
805
  self,
@@ -1354,12 +814,12 @@ class AsyncDocumentsClient:
1354
814
  request_options: typing.Optional[RequestOptions] = None,
1355
815
  ) -> DocumentLookupResponse:
1356
816
  """
1357
- lookup the document(s) associated with a processId, bucketId, groupId, or projectId.
817
+ lookup the document(s) associated with a processId, bucketId, or groupId.
1358
818
 
1359
819
  Parameters
1360
820
  ----------
1361
821
  id : int
1362
- a processId, bucketId, groupId, or projectId
822
+ a processId, bucketId, or groupId
1363
823
 
1364
824
  n : typing.Optional[int]
1365
825
  The maximum number of returned documents. Accepts 1-100 with a default of 20.
@@ -1406,52 +866,17 @@ class AsyncDocumentsClient:
1406
866
 
1407
867
  asyncio.run(main())
1408
868
  """
1409
- _response = await self._client_wrapper.httpx_client.request(
1410
- f"v1/ingest/documents/{jsonable_encoder(id)}",
1411
- method="GET",
1412
- params={
1413
- "n": n,
1414
- "filter": filter,
1415
- "sort": sort,
1416
- "sortOrder": sort_order,
1417
- "status": status,
1418
- "nextToken": next_token,
1419
- },
869
+ _response = await self._raw_client.lookup(
870
+ id,
871
+ n=n,
872
+ filter=filter,
873
+ sort=sort,
874
+ sort_order=sort_order,
875
+ status=status,
876
+ next_token=next_token,
1420
877
  request_options=request_options,
1421
878
  )
1422
- try:
1423
- if 200 <= _response.status_code < 300:
1424
- return typing.cast(
1425
- DocumentLookupResponse,
1426
- parse_obj_as(
1427
- type_=DocumentLookupResponse, # type: ignore
1428
- object_=_response.json(),
1429
- ),
1430
- )
1431
- if _response.status_code == 400:
1432
- raise BadRequestError(
1433
- typing.cast(
1434
- typing.Optional[typing.Any],
1435
- parse_obj_as(
1436
- type_=typing.Optional[typing.Any], # type: ignore
1437
- object_=_response.json(),
1438
- ),
1439
- )
1440
- )
1441
- if _response.status_code == 401:
1442
- raise UnauthorizedError(
1443
- typing.cast(
1444
- typing.Optional[typing.Any],
1445
- parse_obj_as(
1446
- type_=typing.Optional[typing.Any], # type: ignore
1447
- object_=_response.json(),
1448
- ),
1449
- )
1450
- )
1451
- _response_json = _response.json()
1452
- except JSONDecodeError:
1453
- raise ApiError(status_code=_response.status_code, body=_response.text)
1454
- raise ApiError(status_code=_response.status_code, body=_response_json)
879
+ return _response.data
1455
880
 
1456
881
  async def get(
1457
882
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1491,44 +916,8 @@ class AsyncDocumentsClient:
1491
916
 
1492
917
  asyncio.run(main())
1493
918
  """
1494
- _response = await self._client_wrapper.httpx_client.request(
1495
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1496
- method="GET",
1497
- request_options=request_options,
1498
- )
1499
- try:
1500
- if 200 <= _response.status_code < 300:
1501
- return typing.cast(
1502
- DocumentResponse,
1503
- parse_obj_as(
1504
- type_=DocumentResponse, # type: ignore
1505
- object_=_response.json(),
1506
- ),
1507
- )
1508
- if _response.status_code == 400:
1509
- raise BadRequestError(
1510
- typing.cast(
1511
- typing.Optional[typing.Any],
1512
- parse_obj_as(
1513
- type_=typing.Optional[typing.Any], # type: ignore
1514
- object_=_response.json(),
1515
- ),
1516
- )
1517
- )
1518
- if _response.status_code == 401:
1519
- raise UnauthorizedError(
1520
- typing.cast(
1521
- typing.Optional[typing.Any],
1522
- parse_obj_as(
1523
- type_=typing.Optional[typing.Any], # type: ignore
1524
- object_=_response.json(),
1525
- ),
1526
- )
1527
- )
1528
- _response_json = _response.json()
1529
- except JSONDecodeError:
1530
- raise ApiError(status_code=_response.status_code, body=_response.text)
1531
- raise ApiError(status_code=_response.status_code, body=_response_json)
919
+ _response = await self._raw_client.get(document_id, request_options=request_options)
920
+ return _response.data
1532
921
 
1533
922
  async def delete_by_id(
1534
923
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1568,44 +957,8 @@ class AsyncDocumentsClient:
1568
957
 
1569
958
  asyncio.run(main())
1570
959
  """
1571
- _response = await self._client_wrapper.httpx_client.request(
1572
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1573
- method="DELETE",
1574
- request_options=request_options,
1575
- )
1576
- try:
1577
- if 200 <= _response.status_code < 300:
1578
- return typing.cast(
1579
- IngestResponse,
1580
- parse_obj_as(
1581
- type_=IngestResponse, # type: ignore
1582
- object_=_response.json(),
1583
- ),
1584
- )
1585
- if _response.status_code == 400:
1586
- raise BadRequestError(
1587
- typing.cast(
1588
- typing.Optional[typing.Any],
1589
- parse_obj_as(
1590
- type_=typing.Optional[typing.Any], # type: ignore
1591
- object_=_response.json(),
1592
- ),
1593
- )
1594
- )
1595
- if _response.status_code == 401:
1596
- raise UnauthorizedError(
1597
- typing.cast(
1598
- typing.Optional[typing.Any],
1599
- parse_obj_as(
1600
- type_=typing.Optional[typing.Any], # type: ignore
1601
- object_=_response.json(),
1602
- ),
1603
- )
1604
- )
1605
- _response_json = _response.json()
1606
- except JSONDecodeError:
1607
- raise ApiError(status_code=_response.status_code, body=_response.text)
1608
- raise ApiError(status_code=_response.status_code, body=_response_json)
960
+ _response = await self._raw_client.delete_by_id(document_id, request_options=request_options)
961
+ return _response.data
1609
962
 
1610
963
  async def get_processes(
1611
964
  self,
@@ -1650,25 +1003,5 @@ class AsyncDocumentsClient:
1650
1003
 
1651
1004
  asyncio.run(main())
1652
1005
  """
1653
- _response = await self._client_wrapper.httpx_client.request(
1654
- "v1/ingest",
1655
- method="GET",
1656
- params={
1657
- "n": n,
1658
- "status": status,
1659
- },
1660
- request_options=request_options,
1661
- )
1662
- try:
1663
- if 200 <= _response.status_code < 300:
1664
- return typing.cast(
1665
- ProcessesStatusResponse,
1666
- parse_obj_as(
1667
- type_=ProcessesStatusResponse, # type: ignore
1668
- object_=_response.json(),
1669
- ),
1670
- )
1671
- _response_json = _response.json()
1672
- except JSONDecodeError:
1673
- raise ApiError(status_code=_response.status_code, body=_response.text)
1674
- raise ApiError(status_code=_response.status_code, body=_response_json)
1006
+ _response = await self._raw_client.get_processes(n=n, status=status, request_options=request_options)
1007
+ return _response.data