groundx 2.3.3__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 (79) hide show
  1. groundx/__init__.py +2 -0
  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 +100 -780
  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/search/__init__.py +2 -0
  31. groundx/search/client.py +64 -213
  32. groundx/search/raw_client.py +442 -0
  33. groundx/search/types/__init__.py +2 -0
  34. groundx/types/__init__.py +2 -0
  35. groundx/types/bounding_box_detail.py +4 -4
  36. groundx/types/bucket_detail.py +5 -5
  37. groundx/types/bucket_list_response.py +3 -3
  38. groundx/types/bucket_response.py +3 -3
  39. groundx/types/bucket_update_detail.py +4 -4
  40. groundx/types/bucket_update_response.py +3 -3
  41. groundx/types/customer_detail.py +2 -2
  42. groundx/types/customer_response.py +3 -3
  43. groundx/types/document.py +4 -4
  44. groundx/types/document_detail.py +4 -4
  45. groundx/types/document_list_response.py +4 -4
  46. groundx/types/document_local_ingest_request.py +1 -0
  47. groundx/types/document_lookup_response.py +3 -3
  48. groundx/types/document_response.py +3 -3
  49. groundx/types/group_detail.py +4 -4
  50. groundx/types/group_list_response.py +3 -3
  51. groundx/types/group_response.py +3 -3
  52. groundx/types/health_response.py +3 -3
  53. groundx/types/health_response_health.py +3 -3
  54. groundx/types/health_service.py +5 -5
  55. groundx/types/ingest_local_document.py +3 -3
  56. groundx/types/ingest_local_document_metadata.py +4 -4
  57. groundx/types/ingest_remote_document.py +4 -4
  58. groundx/types/ingest_response.py +3 -3
  59. groundx/types/ingest_status.py +3 -3
  60. groundx/types/ingest_status_light.py +3 -3
  61. groundx/types/ingest_status_progress.py +3 -3
  62. groundx/types/ingest_status_progress_cancelled.py +3 -3
  63. groundx/types/ingest_status_progress_complete.py +3 -3
  64. groundx/types/ingest_status_progress_errors.py +3 -3
  65. groundx/types/ingest_status_progress_processing.py +3 -3
  66. groundx/types/message_response.py +2 -2
  67. groundx/types/meter_detail.py +2 -2
  68. groundx/types/processes_status_response.py +3 -3
  69. groundx/types/search_response.py +3 -3
  70. groundx/types/search_response_search.py +3 -3
  71. groundx/types/search_result_item.py +5 -5
  72. groundx/types/subscription_detail.py +3 -3
  73. groundx/types/subscription_detail_meters.py +5 -5
  74. groundx/types/website_source.py +4 -4
  75. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/METADATA +1 -1
  76. groundx-2.3.5.dist-info/RECORD +95 -0
  77. groundx-2.3.3.dist-info/RECORD +0 -87
  78. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/LICENSE +0 -0
  79. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/WHEEL +0 -0
@@ -1,27 +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 ..core.jsonable_encoder import jsonable_encoder
8
+ from ..types.document_local_ingest_request import DocumentLocalIngestRequest
21
9
  from ..types.document_lookup_response import DocumentLookupResponse
22
10
  from ..types.document_response import DocumentResponse
11
+ from ..types.ingest_remote_document import IngestRemoteDocument
12
+ from ..types.ingest_response import IngestResponse
23
13
  from ..types.processes_status_response import ProcessesStatusResponse
24
- 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
25
19
 
26
20
  # this is used as the default value for optional parameters
27
21
  OMIT = typing.cast(typing.Any, ...)
@@ -29,7 +23,18 @@ OMIT = typing.cast(typing.Any, ...)
29
23
 
30
24
  class DocumentsClient:
31
25
  def __init__(self, *, client_wrapper: SyncClientWrapper):
32
- 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
33
38
 
34
39
  def ingest_remote(
35
40
  self,
@@ -72,53 +77,8 @@ class DocumentsClient:
72
77
  ],
73
78
  )
74
79
  """
75
- _response = self._client_wrapper.httpx_client.request(
76
- "v1/ingest/documents/remote",
77
- method="POST",
78
- json={
79
- "documents": convert_and_respect_annotation_metadata(
80
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
81
- ),
82
- },
83
- headers={
84
- "content-type": "application/json",
85
- },
86
- request_options=request_options,
87
- omit=OMIT,
88
- )
89
- try:
90
- if 200 <= _response.status_code < 300:
91
- return typing.cast(
92
- IngestResponse,
93
- parse_obj_as(
94
- type_=IngestResponse, # type: ignore
95
- object_=_response.json(),
96
- ),
97
- )
98
- if _response.status_code == 400:
99
- raise BadRequestError(
100
- typing.cast(
101
- typing.Optional[typing.Any],
102
- parse_obj_as(
103
- type_=typing.Optional[typing.Any], # type: ignore
104
- object_=_response.json(),
105
- ),
106
- )
107
- )
108
- if _response.status_code == 401:
109
- raise UnauthorizedError(
110
- typing.cast(
111
- typing.Optional[typing.Any],
112
- parse_obj_as(
113
- type_=typing.Optional[typing.Any], # type: ignore
114
- object_=_response.json(),
115
- ),
116
- )
117
- )
118
- _response_json = _response.json()
119
- except JSONDecodeError:
120
- raise ApiError(status_code=_response.status_code, body=_response.text)
121
- 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
122
82
 
123
83
  def ingest_local(
124
84
  self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
@@ -160,48 +120,8 @@ class DocumentsClient:
160
120
  ],
161
121
  )
162
122
  """
163
- _response = self._client_wrapper.httpx_client.request(
164
- "v1/ingest/documents/local",
165
- method="POST",
166
- json=convert_and_respect_annotation_metadata(
167
- object_=request, annotation=DocumentLocalIngestRequest, direction="write"
168
- ),
169
- request_options=request_options,
170
- omit=OMIT,
171
- )
172
- try:
173
- if 200 <= _response.status_code < 300:
174
- return typing.cast(
175
- IngestResponse,
176
- parse_obj_as(
177
- type_=IngestResponse, # type: ignore
178
- object_=_response.json(),
179
- ),
180
- )
181
- if _response.status_code == 400:
182
- raise BadRequestError(
183
- typing.cast(
184
- typing.Optional[typing.Any],
185
- parse_obj_as(
186
- type_=typing.Optional[typing.Any], # type: ignore
187
- object_=_response.json(),
188
- ),
189
- )
190
- )
191
- if _response.status_code == 401:
192
- raise UnauthorizedError(
193
- typing.cast(
194
- typing.Optional[typing.Any],
195
- parse_obj_as(
196
- type_=typing.Optional[typing.Any], # type: ignore
197
- object_=_response.json(),
198
- ),
199
- )
200
- )
201
- _response_json = _response.json()
202
- except JSONDecodeError:
203
- raise ApiError(status_code=_response.status_code, body=_response.text)
204
- 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
205
125
 
206
126
  def crawl_website(
207
127
  self, *, websites: typing.Sequence[WebsiteSource], request_options: typing.Optional[RequestOptions] = None
@@ -245,53 +165,8 @@ class DocumentsClient:
245
165
  ],
246
166
  )
247
167
  """
248
- _response = self._client_wrapper.httpx_client.request(
249
- "v1/ingest/documents/website",
250
- method="POST",
251
- json={
252
- "websites": convert_and_respect_annotation_metadata(
253
- object_=websites, annotation=typing.Sequence[WebsiteSource], direction="write"
254
- ),
255
- },
256
- headers={
257
- "content-type": "application/json",
258
- },
259
- request_options=request_options,
260
- omit=OMIT,
261
- )
262
- try:
263
- if 200 <= _response.status_code < 300:
264
- return typing.cast(
265
- IngestResponse,
266
- parse_obj_as(
267
- type_=IngestResponse, # type: ignore
268
- object_=_response.json(),
269
- ),
270
- )
271
- if _response.status_code == 400:
272
- raise BadRequestError(
273
- typing.cast(
274
- typing.Optional[typing.Any],
275
- parse_obj_as(
276
- type_=typing.Optional[typing.Any], # type: ignore
277
- object_=_response.json(),
278
- ),
279
- )
280
- )
281
- if _response.status_code == 401:
282
- raise UnauthorizedError(
283
- typing.cast(
284
- typing.Optional[typing.Any],
285
- parse_obj_as(
286
- type_=typing.Optional[typing.Any], # type: ignore
287
- object_=_response.json(),
288
- ),
289
- )
290
- )
291
- _response_json = _response.json()
292
- except JSONDecodeError:
293
- raise ApiError(status_code=_response.status_code, body=_response.text)
294
- 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
295
170
 
296
171
  def list(
297
172
  self,
@@ -344,32 +219,16 @@ class DocumentsClient:
344
219
  )
345
220
  client.documents.list()
346
221
  """
347
- _response = self._client_wrapper.httpx_client.request(
348
- "v1/ingest/documents",
349
- method="GET",
350
- params={
351
- "n": n,
352
- "filter": filter,
353
- "sort": sort,
354
- "sortOrder": sort_order,
355
- "status": status,
356
- "nextToken": next_token,
357
- },
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,
358
229
  request_options=request_options,
359
230
  )
360
- try:
361
- if 200 <= _response.status_code < 300:
362
- return typing.cast(
363
- DocumentListResponse,
364
- parse_obj_as(
365
- type_=DocumentListResponse, # type: ignore
366
- object_=_response.json(),
367
- ),
368
- )
369
- _response_json = _response.json()
370
- except JSONDecodeError:
371
- raise ApiError(status_code=_response.status_code, body=_response.text)
372
- raise ApiError(status_code=_response.status_code, body=_response_json)
231
+ return _response.data
373
232
 
374
233
  def delete(
375
234
  self,
@@ -404,47 +263,8 @@ class DocumentsClient:
404
263
  document_ids="123e4567-e89b-12d3-a456-426614174000,9f7c11a6-24b8-4d52-a9f3-90a7e70a9e49",
405
264
  )
406
265
  """
407
- _response = self._client_wrapper.httpx_client.request(
408
- "v1/ingest/documents",
409
- method="DELETE",
410
- params={
411
- "documentIds": document_ids,
412
- },
413
- request_options=request_options,
414
- )
415
- try:
416
- if 200 <= _response.status_code < 300:
417
- return typing.cast(
418
- IngestResponse,
419
- parse_obj_as(
420
- type_=IngestResponse, # type: ignore
421
- object_=_response.json(),
422
- ),
423
- )
424
- if _response.status_code == 400:
425
- raise BadRequestError(
426
- typing.cast(
427
- typing.Optional[typing.Any],
428
- parse_obj_as(
429
- type_=typing.Optional[typing.Any], # type: ignore
430
- object_=_response.json(),
431
- ),
432
- )
433
- )
434
- if _response.status_code == 401:
435
- raise UnauthorizedError(
436
- typing.cast(
437
- typing.Optional[typing.Any],
438
- parse_obj_as(
439
- type_=typing.Optional[typing.Any], # type: ignore
440
- object_=_response.json(),
441
- ),
442
- )
443
- )
444
- _response_json = _response.json()
445
- except JSONDecodeError:
446
- raise ApiError(status_code=_response.status_code, body=_response.text)
447
- 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
448
268
 
449
269
  def get_processing_status_by_id(
450
270
  self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -476,44 +296,8 @@ class DocumentsClient:
476
296
  process_id="processId",
477
297
  )
478
298
  """
479
- _response = self._client_wrapper.httpx_client.request(
480
- f"v1/ingest/{jsonable_encoder(process_id)}",
481
- method="GET",
482
- request_options=request_options,
483
- )
484
- try:
485
- if 200 <= _response.status_code < 300:
486
- return typing.cast(
487
- IngestResponse,
488
- parse_obj_as(
489
- type_=IngestResponse, # type: ignore
490
- object_=_response.json(),
491
- ),
492
- )
493
- if _response.status_code == 400:
494
- raise BadRequestError(
495
- typing.cast(
496
- typing.Optional[typing.Any],
497
- parse_obj_as(
498
- type_=typing.Optional[typing.Any], # type: ignore
499
- object_=_response.json(),
500
- ),
501
- )
502
- )
503
- if _response.status_code == 401:
504
- raise UnauthorizedError(
505
- typing.cast(
506
- typing.Optional[typing.Any],
507
- parse_obj_as(
508
- type_=typing.Optional[typing.Any], # type: ignore
509
- object_=_response.json(),
510
- ),
511
- )
512
- )
513
- _response_json = _response.json()
514
- except JSONDecodeError:
515
- raise ApiError(status_code=_response.status_code, body=_response.text)
516
- 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
517
301
 
518
302
  def lookup(
519
303
  self,
@@ -572,52 +356,17 @@ class DocumentsClient:
572
356
  id=1,
573
357
  )
574
358
  """
575
- _response = self._client_wrapper.httpx_client.request(
576
- f"v1/ingest/documents/{jsonable_encoder(id)}",
577
- method="GET",
578
- params={
579
- "n": n,
580
- "filter": filter,
581
- "sort": sort,
582
- "sortOrder": sort_order,
583
- "status": status,
584
- "nextToken": next_token,
585
- },
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,
586
367
  request_options=request_options,
587
368
  )
588
- try:
589
- if 200 <= _response.status_code < 300:
590
- return typing.cast(
591
- DocumentLookupResponse,
592
- parse_obj_as(
593
- type_=DocumentLookupResponse, # type: ignore
594
- object_=_response.json(),
595
- ),
596
- )
597
- if _response.status_code == 400:
598
- raise BadRequestError(
599
- typing.cast(
600
- typing.Optional[typing.Any],
601
- parse_obj_as(
602
- type_=typing.Optional[typing.Any], # type: ignore
603
- object_=_response.json(),
604
- ),
605
- )
606
- )
607
- if _response.status_code == 401:
608
- raise UnauthorizedError(
609
- typing.cast(
610
- typing.Optional[typing.Any],
611
- parse_obj_as(
612
- type_=typing.Optional[typing.Any], # type: ignore
613
- object_=_response.json(),
614
- ),
615
- )
616
- )
617
- _response_json = _response.json()
618
- except JSONDecodeError:
619
- raise ApiError(status_code=_response.status_code, body=_response.text)
620
- raise ApiError(status_code=_response.status_code, body=_response_json)
369
+ return _response.data
621
370
 
622
371
  def get(self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentResponse:
623
372
  """
@@ -647,44 +396,8 @@ class DocumentsClient:
647
396
  document_id="documentId",
648
397
  )
649
398
  """
650
- _response = self._client_wrapper.httpx_client.request(
651
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
652
- method="GET",
653
- request_options=request_options,
654
- )
655
- try:
656
- if 200 <= _response.status_code < 300:
657
- return typing.cast(
658
- DocumentResponse,
659
- parse_obj_as(
660
- type_=DocumentResponse, # type: ignore
661
- object_=_response.json(),
662
- ),
663
- )
664
- if _response.status_code == 400:
665
- raise BadRequestError(
666
- typing.cast(
667
- typing.Optional[typing.Any],
668
- parse_obj_as(
669
- type_=typing.Optional[typing.Any], # type: ignore
670
- object_=_response.json(),
671
- ),
672
- )
673
- )
674
- if _response.status_code == 401:
675
- raise UnauthorizedError(
676
- typing.cast(
677
- typing.Optional[typing.Any],
678
- parse_obj_as(
679
- type_=typing.Optional[typing.Any], # type: ignore
680
- object_=_response.json(),
681
- ),
682
- )
683
- )
684
- _response_json = _response.json()
685
- except JSONDecodeError:
686
- raise ApiError(status_code=_response.status_code, body=_response.text)
687
- 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
688
401
 
689
402
  def delete_by_id(
690
403
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -716,44 +429,8 @@ class DocumentsClient:
716
429
  document_id="documentId",
717
430
  )
718
431
  """
719
- _response = self._client_wrapper.httpx_client.request(
720
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
721
- method="DELETE",
722
- request_options=request_options,
723
- )
724
- try:
725
- if 200 <= _response.status_code < 300:
726
- return typing.cast(
727
- IngestResponse,
728
- parse_obj_as(
729
- type_=IngestResponse, # type: ignore
730
- object_=_response.json(),
731
- ),
732
- )
733
- if _response.status_code == 400:
734
- raise BadRequestError(
735
- typing.cast(
736
- typing.Optional[typing.Any],
737
- parse_obj_as(
738
- type_=typing.Optional[typing.Any], # type: ignore
739
- object_=_response.json(),
740
- ),
741
- )
742
- )
743
- if _response.status_code == 401:
744
- raise UnauthorizedError(
745
- typing.cast(
746
- typing.Optional[typing.Any],
747
- parse_obj_as(
748
- type_=typing.Optional[typing.Any], # type: ignore
749
- object_=_response.json(),
750
- ),
751
- )
752
- )
753
- _response_json = _response.json()
754
- except JSONDecodeError:
755
- raise ApiError(status_code=_response.status_code, body=_response.text)
756
- 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
757
434
 
758
435
  def get_processes(
759
436
  self,
@@ -790,33 +467,24 @@ class DocumentsClient:
790
467
  )
791
468
  client.documents.get_processes()
792
469
  """
793
- _response = self._client_wrapper.httpx_client.request(
794
- "v1/ingest",
795
- method="GET",
796
- params={
797
- "n": n,
798
- "status": status,
799
- },
800
- request_options=request_options,
801
- )
802
- try:
803
- if 200 <= _response.status_code < 300:
804
- return typing.cast(
805
- ProcessesStatusResponse,
806
- parse_obj_as(
807
- type_=ProcessesStatusResponse, # type: ignore
808
- object_=_response.json(),
809
- ),
810
- )
811
- _response_json = _response.json()
812
- except JSONDecodeError:
813
- raise ApiError(status_code=_response.status_code, body=_response.text)
814
- 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
815
472
 
816
473
 
817
474
  class AsyncDocumentsClient:
818
475
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
819
- 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
820
488
 
821
489
  async def ingest_remote(
822
490
  self,
@@ -867,53 +535,8 @@ class AsyncDocumentsClient:
867
535
 
868
536
  asyncio.run(main())
869
537
  """
870
- _response = await self._client_wrapper.httpx_client.request(
871
- "v1/ingest/documents/remote",
872
- method="POST",
873
- json={
874
- "documents": convert_and_respect_annotation_metadata(
875
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
876
- ),
877
- },
878
- headers={
879
- "content-type": "application/json",
880
- },
881
- request_options=request_options,
882
- omit=OMIT,
883
- )
884
- try:
885
- if 200 <= _response.status_code < 300:
886
- return typing.cast(
887
- IngestResponse,
888
- parse_obj_as(
889
- type_=IngestResponse, # type: ignore
890
- object_=_response.json(),
891
- ),
892
- )
893
- if _response.status_code == 400:
894
- raise BadRequestError(
895
- typing.cast(
896
- typing.Optional[typing.Any],
897
- parse_obj_as(
898
- type_=typing.Optional[typing.Any], # type: ignore
899
- object_=_response.json(),
900
- ),
901
- )
902
- )
903
- if _response.status_code == 401:
904
- raise UnauthorizedError(
905
- typing.cast(
906
- typing.Optional[typing.Any],
907
- parse_obj_as(
908
- type_=typing.Optional[typing.Any], # type: ignore
909
- object_=_response.json(),
910
- ),
911
- )
912
- )
913
- _response_json = _response.json()
914
- except JSONDecodeError:
915
- raise ApiError(status_code=_response.status_code, body=_response.text)
916
- 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
917
540
 
918
541
  async def ingest_local(
919
542
  self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
@@ -967,48 +590,8 @@ class AsyncDocumentsClient:
967
590
 
968
591
  asyncio.run(main())
969
592
  """
970
- _response = await self._client_wrapper.httpx_client.request(
971
- "v1/ingest/documents/local",
972
- method="POST",
973
- json=convert_and_respect_annotation_metadata(
974
- object_=request, annotation=DocumentLocalIngestRequest, direction="write"
975
- ),
976
- request_options=request_options,
977
- omit=OMIT,
978
- )
979
- try:
980
- if 200 <= _response.status_code < 300:
981
- return typing.cast(
982
- IngestResponse,
983
- parse_obj_as(
984
- type_=IngestResponse, # type: ignore
985
- object_=_response.json(),
986
- ),
987
- )
988
- if _response.status_code == 400:
989
- raise BadRequestError(
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
- if _response.status_code == 401:
999
- raise UnauthorizedError(
1000
- typing.cast(
1001
- typing.Optional[typing.Any],
1002
- parse_obj_as(
1003
- type_=typing.Optional[typing.Any], # type: ignore
1004
- object_=_response.json(),
1005
- ),
1006
- )
1007
- )
1008
- _response_json = _response.json()
1009
- except JSONDecodeError:
1010
- raise ApiError(status_code=_response.status_code, body=_response.text)
1011
- 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
1012
595
 
1013
596
  async def crawl_website(
1014
597
  self, *, websites: typing.Sequence[WebsiteSource], request_options: typing.Optional[RequestOptions] = None
@@ -1060,53 +643,8 @@ class AsyncDocumentsClient:
1060
643
 
1061
644
  asyncio.run(main())
1062
645
  """
1063
- _response = await self._client_wrapper.httpx_client.request(
1064
- "v1/ingest/documents/website",
1065
- method="POST",
1066
- json={
1067
- "websites": convert_and_respect_annotation_metadata(
1068
- object_=websites, annotation=typing.Sequence[WebsiteSource], direction="write"
1069
- ),
1070
- },
1071
- headers={
1072
- "content-type": "application/json",
1073
- },
1074
- request_options=request_options,
1075
- omit=OMIT,
1076
- )
1077
- try:
1078
- if 200 <= _response.status_code < 300:
1079
- return typing.cast(
1080
- IngestResponse,
1081
- parse_obj_as(
1082
- type_=IngestResponse, # type: ignore
1083
- object_=_response.json(),
1084
- ),
1085
- )
1086
- if _response.status_code == 400:
1087
- raise BadRequestError(
1088
- typing.cast(
1089
- typing.Optional[typing.Any],
1090
- parse_obj_as(
1091
- type_=typing.Optional[typing.Any], # type: ignore
1092
- object_=_response.json(),
1093
- ),
1094
- )
1095
- )
1096
- if _response.status_code == 401:
1097
- raise UnauthorizedError(
1098
- typing.cast(
1099
- typing.Optional[typing.Any],
1100
- parse_obj_as(
1101
- type_=typing.Optional[typing.Any], # type: ignore
1102
- object_=_response.json(),
1103
- ),
1104
- )
1105
- )
1106
- _response_json = _response.json()
1107
- except JSONDecodeError:
1108
- raise ApiError(status_code=_response.status_code, body=_response.text)
1109
- 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
1110
648
 
1111
649
  async def list(
1112
650
  self,
@@ -1167,32 +705,16 @@ class AsyncDocumentsClient:
1167
705
 
1168
706
  asyncio.run(main())
1169
707
  """
1170
- _response = await self._client_wrapper.httpx_client.request(
1171
- "v1/ingest/documents",
1172
- method="GET",
1173
- params={
1174
- "n": n,
1175
- "filter": filter,
1176
- "sort": sort,
1177
- "sortOrder": sort_order,
1178
- "status": status,
1179
- "nextToken": next_token,
1180
- },
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,
1181
715
  request_options=request_options,
1182
716
  )
1183
- try:
1184
- if 200 <= _response.status_code < 300:
1185
- return typing.cast(
1186
- DocumentListResponse,
1187
- parse_obj_as(
1188
- type_=DocumentListResponse, # type: ignore
1189
- object_=_response.json(),
1190
- ),
1191
- )
1192
- _response_json = _response.json()
1193
- except JSONDecodeError:
1194
- raise ApiError(status_code=_response.status_code, body=_response.text)
1195
- raise ApiError(status_code=_response.status_code, body=_response_json)
717
+ return _response.data
1196
718
 
1197
719
  async def delete(
1198
720
  self,
@@ -1235,47 +757,8 @@ class AsyncDocumentsClient:
1235
757
 
1236
758
  asyncio.run(main())
1237
759
  """
1238
- _response = await self._client_wrapper.httpx_client.request(
1239
- "v1/ingest/documents",
1240
- method="DELETE",
1241
- params={
1242
- "documentIds": document_ids,
1243
- },
1244
- request_options=request_options,
1245
- )
1246
- try:
1247
- if 200 <= _response.status_code < 300:
1248
- return typing.cast(
1249
- IngestResponse,
1250
- parse_obj_as(
1251
- type_=IngestResponse, # type: ignore
1252
- object_=_response.json(),
1253
- ),
1254
- )
1255
- if _response.status_code == 400:
1256
- raise BadRequestError(
1257
- typing.cast(
1258
- typing.Optional[typing.Any],
1259
- parse_obj_as(
1260
- type_=typing.Optional[typing.Any], # type: ignore
1261
- object_=_response.json(),
1262
- ),
1263
- )
1264
- )
1265
- if _response.status_code == 401:
1266
- raise UnauthorizedError(
1267
- typing.cast(
1268
- typing.Optional[typing.Any],
1269
- parse_obj_as(
1270
- type_=typing.Optional[typing.Any], # type: ignore
1271
- object_=_response.json(),
1272
- ),
1273
- )
1274
- )
1275
- _response_json = _response.json()
1276
- except JSONDecodeError:
1277
- raise ApiError(status_code=_response.status_code, body=_response.text)
1278
- 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
1279
762
 
1280
763
  async def get_processing_status_by_id(
1281
764
  self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1315,44 +798,8 @@ class AsyncDocumentsClient:
1315
798
 
1316
799
  asyncio.run(main())
1317
800
  """
1318
- _response = await self._client_wrapper.httpx_client.request(
1319
- f"v1/ingest/{jsonable_encoder(process_id)}",
1320
- method="GET",
1321
- request_options=request_options,
1322
- )
1323
- try:
1324
- if 200 <= _response.status_code < 300:
1325
- return typing.cast(
1326
- IngestResponse,
1327
- parse_obj_as(
1328
- type_=IngestResponse, # type: ignore
1329
- object_=_response.json(),
1330
- ),
1331
- )
1332
- if _response.status_code == 400:
1333
- raise BadRequestError(
1334
- typing.cast(
1335
- typing.Optional[typing.Any],
1336
- parse_obj_as(
1337
- type_=typing.Optional[typing.Any], # type: ignore
1338
- object_=_response.json(),
1339
- ),
1340
- )
1341
- )
1342
- if _response.status_code == 401:
1343
- raise UnauthorizedError(
1344
- typing.cast(
1345
- typing.Optional[typing.Any],
1346
- parse_obj_as(
1347
- type_=typing.Optional[typing.Any], # type: ignore
1348
- object_=_response.json(),
1349
- ),
1350
- )
1351
- )
1352
- _response_json = _response.json()
1353
- except JSONDecodeError:
1354
- raise ApiError(status_code=_response.status_code, body=_response.text)
1355
- 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
1356
803
 
1357
804
  async def lookup(
1358
805
  self,
@@ -1419,52 +866,17 @@ class AsyncDocumentsClient:
1419
866
 
1420
867
  asyncio.run(main())
1421
868
  """
1422
- _response = await self._client_wrapper.httpx_client.request(
1423
- f"v1/ingest/documents/{jsonable_encoder(id)}",
1424
- method="GET",
1425
- params={
1426
- "n": n,
1427
- "filter": filter,
1428
- "sort": sort,
1429
- "sortOrder": sort_order,
1430
- "status": status,
1431
- "nextToken": next_token,
1432
- },
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,
1433
877
  request_options=request_options,
1434
878
  )
1435
- try:
1436
- if 200 <= _response.status_code < 300:
1437
- return typing.cast(
1438
- DocumentLookupResponse,
1439
- parse_obj_as(
1440
- type_=DocumentLookupResponse, # type: ignore
1441
- object_=_response.json(),
1442
- ),
1443
- )
1444
- if _response.status_code == 400:
1445
- raise BadRequestError(
1446
- typing.cast(
1447
- typing.Optional[typing.Any],
1448
- parse_obj_as(
1449
- type_=typing.Optional[typing.Any], # type: ignore
1450
- object_=_response.json(),
1451
- ),
1452
- )
1453
- )
1454
- if _response.status_code == 401:
1455
- raise UnauthorizedError(
1456
- typing.cast(
1457
- typing.Optional[typing.Any],
1458
- parse_obj_as(
1459
- type_=typing.Optional[typing.Any], # type: ignore
1460
- object_=_response.json(),
1461
- ),
1462
- )
1463
- )
1464
- _response_json = _response.json()
1465
- except JSONDecodeError:
1466
- raise ApiError(status_code=_response.status_code, body=_response.text)
1467
- raise ApiError(status_code=_response.status_code, body=_response_json)
879
+ return _response.data
1468
880
 
1469
881
  async def get(
1470
882
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1504,44 +916,8 @@ class AsyncDocumentsClient:
1504
916
 
1505
917
  asyncio.run(main())
1506
918
  """
1507
- _response = await self._client_wrapper.httpx_client.request(
1508
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1509
- method="GET",
1510
- request_options=request_options,
1511
- )
1512
- try:
1513
- if 200 <= _response.status_code < 300:
1514
- return typing.cast(
1515
- DocumentResponse,
1516
- parse_obj_as(
1517
- type_=DocumentResponse, # type: ignore
1518
- object_=_response.json(),
1519
- ),
1520
- )
1521
- if _response.status_code == 400:
1522
- raise BadRequestError(
1523
- typing.cast(
1524
- typing.Optional[typing.Any],
1525
- parse_obj_as(
1526
- type_=typing.Optional[typing.Any], # type: ignore
1527
- object_=_response.json(),
1528
- ),
1529
- )
1530
- )
1531
- if _response.status_code == 401:
1532
- raise UnauthorizedError(
1533
- typing.cast(
1534
- typing.Optional[typing.Any],
1535
- parse_obj_as(
1536
- type_=typing.Optional[typing.Any], # type: ignore
1537
- object_=_response.json(),
1538
- ),
1539
- )
1540
- )
1541
- _response_json = _response.json()
1542
- except JSONDecodeError:
1543
- raise ApiError(status_code=_response.status_code, body=_response.text)
1544
- 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
1545
921
 
1546
922
  async def delete_by_id(
1547
923
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -1581,44 +957,8 @@ class AsyncDocumentsClient:
1581
957
 
1582
958
  asyncio.run(main())
1583
959
  """
1584
- _response = await self._client_wrapper.httpx_client.request(
1585
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1586
- method="DELETE",
1587
- request_options=request_options,
1588
- )
1589
- try:
1590
- if 200 <= _response.status_code < 300:
1591
- return typing.cast(
1592
- IngestResponse,
1593
- parse_obj_as(
1594
- type_=IngestResponse, # type: ignore
1595
- object_=_response.json(),
1596
- ),
1597
- )
1598
- if _response.status_code == 400:
1599
- raise BadRequestError(
1600
- typing.cast(
1601
- typing.Optional[typing.Any],
1602
- parse_obj_as(
1603
- type_=typing.Optional[typing.Any], # type: ignore
1604
- object_=_response.json(),
1605
- ),
1606
- )
1607
- )
1608
- if _response.status_code == 401:
1609
- raise UnauthorizedError(
1610
- typing.cast(
1611
- typing.Optional[typing.Any],
1612
- parse_obj_as(
1613
- type_=typing.Optional[typing.Any], # type: ignore
1614
- object_=_response.json(),
1615
- ),
1616
- )
1617
- )
1618
- _response_json = _response.json()
1619
- except JSONDecodeError:
1620
- raise ApiError(status_code=_response.status_code, body=_response.text)
1621
- 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
1622
962
 
1623
963
  async def get_processes(
1624
964
  self,
@@ -1663,25 +1003,5 @@ class AsyncDocumentsClient:
1663
1003
 
1664
1004
  asyncio.run(main())
1665
1005
  """
1666
- _response = await self._client_wrapper.httpx_client.request(
1667
- "v1/ingest",
1668
- method="GET",
1669
- params={
1670
- "n": n,
1671
- "status": status,
1672
- },
1673
- request_options=request_options,
1674
- )
1675
- try:
1676
- if 200 <= _response.status_code < 300:
1677
- return typing.cast(
1678
- ProcessesStatusResponse,
1679
- parse_obj_as(
1680
- type_=ProcessesStatusResponse, # type: ignore
1681
- object_=_response.json(),
1682
- ),
1683
- )
1684
- _response_json = _response.json()
1685
- except JSONDecodeError:
1686
- raise ApiError(status_code=_response.status_code, body=_response.text)
1687
- 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