groundx 2.0.15__py3-none-any.whl → 2.7.7__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 (147) hide show
  1. groundx/__init__.py +73 -21
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +55 -388
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +22 -21
  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 +76 -32
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +71 -112
  14. groundx/core/serialization.py +7 -3
  15. groundx/csv_splitter.py +64 -0
  16. groundx/customer/__init__.py +2 -0
  17. groundx/customer/client.py +31 -43
  18. groundx/customer/raw_client.py +91 -0
  19. groundx/documents/__init__.py +1 -2
  20. groundx/documents/client.py +455 -953
  21. groundx/documents/raw_client.py +1450 -0
  22. groundx/errors/__init__.py +2 -0
  23. groundx/errors/bad_request_error.py +4 -3
  24. groundx/errors/unauthorized_error.py +4 -3
  25. groundx/extract/__init__.py +48 -0
  26. groundx/extract/agents/__init__.py +7 -0
  27. groundx/extract/agents/agent.py +202 -0
  28. groundx/extract/classes/__init__.py +24 -0
  29. groundx/extract/classes/agent.py +23 -0
  30. groundx/extract/classes/api.py +15 -0
  31. groundx/extract/classes/document.py +338 -0
  32. groundx/extract/classes/field.py +88 -0
  33. groundx/extract/classes/groundx.py +147 -0
  34. groundx/extract/classes/prompt.py +36 -0
  35. groundx/extract/classes/test_document.py +109 -0
  36. groundx/extract/classes/test_field.py +43 -0
  37. groundx/extract/classes/test_groundx.py +223 -0
  38. groundx/extract/classes/test_prompt.py +68 -0
  39. groundx/extract/post_process/__init__.py +7 -0
  40. groundx/extract/post_process/post_process.py +33 -0
  41. groundx/extract/services/.DS_Store +0 -0
  42. groundx/extract/services/__init__.py +14 -0
  43. groundx/extract/services/csv.py +76 -0
  44. groundx/extract/services/logger.py +126 -0
  45. groundx/extract/services/logging_cfg.py +53 -0
  46. groundx/extract/services/ratelimit.py +104 -0
  47. groundx/extract/services/sheets_client.py +160 -0
  48. groundx/extract/services/status.py +197 -0
  49. groundx/extract/services/upload.py +68 -0
  50. groundx/extract/services/upload_minio.py +122 -0
  51. groundx/extract/services/upload_s3.py +91 -0
  52. groundx/extract/services/utility.py +52 -0
  53. groundx/extract/settings/__init__.py +15 -0
  54. groundx/extract/settings/settings.py +212 -0
  55. groundx/extract/settings/test_settings.py +512 -0
  56. groundx/extract/tasks/__init__.py +6 -0
  57. groundx/extract/tasks/utility.py +27 -0
  58. groundx/extract/utility/__init__.py +15 -0
  59. groundx/extract/utility/classes.py +193 -0
  60. groundx/extract/utility/test_utility.py +81 -0
  61. groundx/groups/__init__.py +2 -0
  62. groundx/groups/client.py +63 -550
  63. groundx/groups/raw_client.py +901 -0
  64. groundx/health/__init__.py +2 -0
  65. groundx/health/client.py +35 -101
  66. groundx/health/raw_client.py +193 -0
  67. groundx/ingest.py +771 -0
  68. groundx/search/__init__.py +2 -0
  69. groundx/search/client.py +94 -227
  70. groundx/search/raw_client.py +442 -0
  71. groundx/search/types/__init__.py +2 -0
  72. groundx/types/__init__.py +68 -16
  73. groundx/types/bounding_box_detail.py +4 -4
  74. groundx/types/bucket_detail.py +5 -5
  75. groundx/types/bucket_list_response.py +17 -3
  76. groundx/types/bucket_response.py +3 -3
  77. groundx/types/bucket_update_detail.py +4 -4
  78. groundx/types/bucket_update_response.py +3 -3
  79. groundx/types/customer_detail.py +2 -2
  80. groundx/types/customer_response.py +3 -3
  81. groundx/types/document.py +54 -0
  82. groundx/types/document_detail.py +16 -4
  83. groundx/types/document_list_response.py +4 -4
  84. groundx/types/document_local_ingest_request.py +7 -0
  85. groundx/types/document_lookup_response.py +8 -3
  86. groundx/types/document_response.py +3 -3
  87. groundx/types/document_type.py +21 -1
  88. groundx/types/group_detail.py +4 -4
  89. groundx/types/group_list_response.py +17 -3
  90. groundx/types/group_response.py +3 -3
  91. groundx/types/health_response.py +3 -3
  92. groundx/types/health_response_health.py +3 -3
  93. groundx/types/health_service.py +5 -5
  94. groundx/types/ingest_local_document.py +25 -0
  95. groundx/types/ingest_local_document_metadata.py +51 -0
  96. groundx/types/ingest_remote_document.py +15 -6
  97. groundx/types/ingest_response.py +4 -4
  98. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  99. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  100. groundx/types/ingest_status_progress.py +26 -0
  101. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  102. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  103. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  104. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  105. groundx/types/message_response.py +2 -2
  106. groundx/types/meter_detail.py +2 -2
  107. groundx/types/process_level.py +5 -0
  108. groundx/types/{process_status_response.py → processes_status_response.py} +8 -5
  109. groundx/types/processing_status.py +3 -1
  110. groundx/types/search_response.py +3 -3
  111. groundx/types/search_response_search.py +3 -3
  112. groundx/types/search_result_item.py +7 -5
  113. groundx/types/search_result_item_pages_item.py +41 -0
  114. groundx/types/subscription_detail.py +3 -3
  115. groundx/types/subscription_detail_meters.py +5 -5
  116. groundx/{documents/types/website_crawl_request_websites_item.py → types/website_source.py} +7 -7
  117. groundx/types/workflow_apply_request.py +24 -0
  118. groundx/types/workflow_detail.py +59 -0
  119. groundx/types/workflow_detail_chunk_strategy.py +5 -0
  120. groundx/types/workflow_detail_relationships.py +36 -0
  121. groundx/types/workflow_engine.py +58 -0
  122. groundx/types/workflow_engine_reasoning_effort.py +5 -0
  123. groundx/types/workflow_engine_service.py +7 -0
  124. groundx/types/workflow_prompt.py +37 -0
  125. groundx/types/workflow_prompt_group.py +25 -0
  126. groundx/types/workflow_prompt_role.py +5 -0
  127. groundx/types/workflow_request.py +31 -0
  128. groundx/types/workflow_request_chunk_strategy.py +5 -0
  129. groundx/types/workflow_response.py +20 -0
  130. groundx/types/workflow_step.py +33 -0
  131. groundx/types/workflow_step_config.py +33 -0
  132. groundx/types/workflow_step_config_field.py +8 -0
  133. groundx/types/workflow_steps.py +38 -0
  134. groundx/types/workflows_response.py +20 -0
  135. groundx/workflows/__init__.py +7 -0
  136. groundx/workflows/client.py +736 -0
  137. groundx/workflows/raw_client.py +841 -0
  138. groundx/workflows/types/__init__.py +7 -0
  139. groundx/workflows/types/workflows_get_request_id.py +5 -0
  140. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/LICENSE +1 -1
  141. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/METADATA +39 -22
  142. groundx-2.7.7.dist-info/RECORD +155 -0
  143. groundx/documents/types/__init__.py +0 -6
  144. groundx/documents/types/documents_ingest_local_request_files_item.py +0 -43
  145. groundx/types/process_status_response_ingest_progress.py +0 -26
  146. groundx-2.0.15.dist-info/RECORD +0 -82
  147. {groundx-2.0.15.dist-info → groundx-2.7.7.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.document_list_response import DocumentListResponse
8
+ from ..types.document_local_ingest_request import DocumentLocalIngestRequest
9
+ from ..types.document_lookup_response import DocumentLookupResponse
10
+ from ..types.document_response import DocumentResponse
11
+ from ..types.ingest_remote_document import IngestRemoteDocument
7
12
  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.documents_ingest_local_request_files_item import DocumentsIngestLocalRequestFilesItem
15
- from .types.website_crawl_request_websites_item import WebsiteCrawlRequestWebsitesItem
16
- from ..types.process_status_response import ProcessStatusResponse
17
- from ..core.jsonable_encoder import jsonable_encoder
13
+ from ..types.processes_status_response import ProcessesStatusResponse
14
+ from ..types.processing_status import ProcessingStatus
18
15
  from ..types.sort import Sort
19
16
  from ..types.sort_order import SortOrder
20
- from ..types.processing_status import ProcessingStatus
21
- from ..types.document_lookup_response import DocumentLookupResponse
22
- from ..types.document_list_response import DocumentListResponse
23
- from ..types.document_response import DocumentResponse
24
- from ..core.client_wrapper import AsyncClientWrapper
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,23 +23,42 @@ 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,
36
41
  *,
37
42
  documents: typing.Sequence[IngestRemoteDocument],
43
+ callback_url: typing.Optional[str] = OMIT,
44
+ callback_data: typing.Optional[str] = OMIT,
38
45
  request_options: typing.Optional[RequestOptions] = None,
39
46
  ) -> IngestResponse:
40
47
  """
41
- Ingest documents hosted on public URLs to a GroundX bucket.
48
+ Ingest documents hosted on public URLs into a GroundX bucket.
42
49
 
43
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
50
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
44
51
 
45
52
  Parameters
46
53
  ----------
47
54
  documents : typing.Sequence[IngestRemoteDocument]
48
55
 
56
+ callback_url : typing.Optional[str]
57
+ An endpoint that will receive processing event updates as POST.
58
+
59
+ callback_data : typing.Optional[str]
60
+ A string that is returned, along with processing event updates, to the callback URL.
61
+
49
62
  request_options : typing.Optional[RequestOptions]
50
63
  Request-specific configuration.
51
64
 
@@ -65,76 +78,29 @@ class DocumentsClient:
65
78
  documents=[
66
79
  IngestRemoteDocument(
67
80
  bucket_id=1234,
68
- file_name="my_file.txt",
81
+ file_name="my_file1.txt",
69
82
  file_type="txt",
70
- search_data={"key": "value"},
71
- source_url="https://my.source.url.com/file.txt",
83
+ source_url="https://my.source.url.com/file1.txt",
72
84
  )
73
85
  ],
74
86
  )
75
87
  """
76
- _response = self._client_wrapper.httpx_client.request(
77
- "v1/ingest/documents/remote",
78
- method="POST",
79
- json={
80
- "documents": convert_and_respect_annotation_metadata(
81
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
82
- ),
83
- },
84
- headers={
85
- "content-type": "application/json",
86
- },
87
- request_options=request_options,
88
- omit=OMIT,
88
+ _response = self._raw_client.ingest_remote(
89
+ documents=documents, callback_url=callback_url, callback_data=callback_data, request_options=request_options
89
90
  )
90
- try:
91
- if 200 <= _response.status_code < 300:
92
- return typing.cast(
93
- IngestResponse,
94
- parse_obj_as(
95
- type_=IngestResponse, # type: ignore
96
- object_=_response.json(),
97
- ),
98
- )
99
- if _response.status_code == 400:
100
- raise BadRequestError(
101
- typing.cast(
102
- typing.Optional[typing.Any],
103
- parse_obj_as(
104
- type_=typing.Optional[typing.Any], # type: ignore
105
- object_=_response.json(),
106
- ),
107
- )
108
- )
109
- if _response.status_code == 401:
110
- raise UnauthorizedError(
111
- typing.cast(
112
- typing.Optional[typing.Any],
113
- parse_obj_as(
114
- type_=typing.Optional[typing.Any], # type: ignore
115
- object_=_response.json(),
116
- ),
117
- )
118
- )
119
- _response_json = _response.json()
120
- except JSONDecodeError:
121
- raise ApiError(status_code=_response.status_code, body=_response.text)
122
- raise ApiError(status_code=_response.status_code, body=_response_json)
91
+ return _response.data
123
92
 
124
93
  def ingest_local(
125
- self,
126
- *,
127
- files: typing.List[DocumentsIngestLocalRequestFilesItem],
128
- request_options: typing.Optional[RequestOptions] = None,
94
+ self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
129
95
  ) -> IngestResponse:
130
96
  """
131
- Upload documents hosted on a local file system for ingestion into a GroundX bucket.
97
+ Upload documents hosted on a local file system into a GroundX bucket.
132
98
 
133
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
99
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
134
100
 
135
101
  Parameters
136
102
  ----------
137
- files : typing.List[DocumentsIngestLocalRequestFilesItem]
103
+ request : DocumentLocalIngestRequest
138
104
 
139
105
  request_options : typing.Optional[RequestOptions]
140
106
  Request-specific configuration.
@@ -146,81 +112,52 @@ class DocumentsClient:
146
112
 
147
113
  Examples
148
114
  --------
149
- from groundx import GroundX
150
- from groundx.documents import DocumentsIngestLocalRequestFilesItem
115
+ from groundx import GroundX, IngestLocalDocument, IngestLocalDocumentMetadata
151
116
 
152
117
  client = GroundX(
153
118
  api_key="YOUR_API_KEY",
154
119
  )
155
120
  client.documents.ingest_local(
156
- files=[
157
- DocumentsIngestLocalRequestFilesItem(
158
- bucket_id=1,
159
- file_data="fileData",
160
- file_name="fileName",
161
- file_type="txt",
121
+ request=[
122
+ IngestLocalDocument(
123
+ blob="blob",
124
+ metadata=IngestLocalDocumentMetadata(
125
+ bucket_id=1234,
126
+ file_name="my_file1.txt",
127
+ file_type="txt",
128
+ ),
162
129
  )
163
130
  ],
164
131
  )
165
132
  """
166
- _response = self._client_wrapper.httpx_client.request(
167
- "v1/ingest/documents/local",
168
- method="POST",
169
- data={
170
- "files": files,
171
- },
172
- files={},
173
- request_options=request_options,
174
- omit=OMIT,
175
- )
176
- try:
177
- if 200 <= _response.status_code < 300:
178
- return typing.cast(
179
- IngestResponse,
180
- parse_obj_as(
181
- type_=IngestResponse, # type: ignore
182
- object_=_response.json(),
183
- ),
184
- )
185
- if _response.status_code == 400:
186
- raise BadRequestError(
187
- typing.cast(
188
- typing.Optional[typing.Any],
189
- parse_obj_as(
190
- type_=typing.Optional[typing.Any], # type: ignore
191
- object_=_response.json(),
192
- ),
193
- )
194
- )
195
- if _response.status_code == 401:
196
- raise UnauthorizedError(
197
- typing.cast(
198
- typing.Optional[typing.Any],
199
- parse_obj_as(
200
- type_=typing.Optional[typing.Any], # type: ignore
201
- object_=_response.json(),
202
- ),
203
- )
204
- )
205
- _response_json = _response.json()
206
- except JSONDecodeError:
207
- raise ApiError(status_code=_response.status_code, body=_response.text)
208
- raise ApiError(status_code=_response.status_code, body=_response_json)
133
+ _response = self._raw_client.ingest_local(request=request, request_options=request_options)
134
+ return _response.data
209
135
 
210
136
  def crawl_website(
211
137
  self,
212
138
  *,
213
- websites: typing.Sequence[WebsiteCrawlRequestWebsitesItem],
139
+ websites: typing.Sequence[WebsiteSource],
140
+ callback_url: typing.Optional[str] = OMIT,
141
+ callback_data: typing.Optional[str] = OMIT,
214
142
  request_options: typing.Optional[RequestOptions] = None,
215
143
  ) -> IngestResponse:
216
144
  """
217
145
  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.
218
146
 
219
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
147
+ Note1: This endpoint is currently not supported for on-prem deployments.
148
+ Note2: The `source_url` must include the protocol, http:// or https://.
149
+
150
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
220
151
 
221
152
  Parameters
222
153
  ----------
223
- websites : typing.Sequence[WebsiteCrawlRequestWebsitesItem]
154
+ websites : typing.Sequence[WebsiteSource]
155
+
156
+ callback_url : typing.Optional[str]
157
+ The URL that will receive processing event updates.
158
+
159
+ callback_data : typing.Optional[str]
160
+ A string that is returned, along with processing event updates, to the callback URL.
224
161
 
225
162
  request_options : typing.Optional[RequestOptions]
226
163
  Request-specific configuration.
@@ -232,88 +169,68 @@ class DocumentsClient:
232
169
 
233
170
  Examples
234
171
  --------
235
- from groundx import GroundX
236
- from groundx.documents import WebsiteCrawlRequestWebsitesItem
172
+ from groundx import GroundX, WebsiteSource
237
173
 
238
174
  client = GroundX(
239
175
  api_key="YOUR_API_KEY",
240
176
  )
241
177
  client.documents.crawl_website(
242
178
  websites=[
243
- WebsiteCrawlRequestWebsitesItem(
244
- bucket_id=123,
179
+ WebsiteSource(
180
+ bucket_id=1234,
181
+ cap=10,
182
+ depth=2,
183
+ search_data={"key": "value"},
245
184
  source_url="https://my.website.com",
246
185
  )
247
186
  ],
248
187
  )
249
188
  """
250
- _response = self._client_wrapper.httpx_client.request(
251
- "v1/ingest/documents/website",
252
- method="POST",
253
- json={
254
- "websites": convert_and_respect_annotation_metadata(
255
- object_=websites, annotation=typing.Sequence[WebsiteCrawlRequestWebsitesItem], direction="write"
256
- ),
257
- },
258
- headers={
259
- "content-type": "application/json",
260
- },
261
- request_options=request_options,
262
- omit=OMIT,
189
+ _response = self._raw_client.crawl_website(
190
+ websites=websites, callback_url=callback_url, callback_data=callback_data, request_options=request_options
263
191
  )
264
- try:
265
- if 200 <= _response.status_code < 300:
266
- return typing.cast(
267
- IngestResponse,
268
- parse_obj_as(
269
- type_=IngestResponse, # type: ignore
270
- object_=_response.json(),
271
- ),
272
- )
273
- if _response.status_code == 400:
274
- raise BadRequestError(
275
- typing.cast(
276
- typing.Optional[typing.Any],
277
- parse_obj_as(
278
- type_=typing.Optional[typing.Any], # type: ignore
279
- object_=_response.json(),
280
- ),
281
- )
282
- )
283
- if _response.status_code == 401:
284
- raise UnauthorizedError(
285
- typing.cast(
286
- typing.Optional[typing.Any],
287
- parse_obj_as(
288
- type_=typing.Optional[typing.Any], # type: ignore
289
- object_=_response.json(),
290
- ),
291
- )
292
- )
293
- _response_json = _response.json()
294
- except JSONDecodeError:
295
- raise ApiError(status_code=_response.status_code, body=_response.text)
296
- raise ApiError(status_code=_response.status_code, body=_response_json)
192
+ return _response.data
297
193
 
298
- def get_processing_status_by_id(
299
- self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
300
- ) -> ProcessStatusResponse:
194
+ def list(
195
+ self,
196
+ *,
197
+ n: typing.Optional[int] = None,
198
+ filter: typing.Optional[str] = None,
199
+ sort: typing.Optional[Sort] = None,
200
+ sort_order: typing.Optional[SortOrder] = None,
201
+ status: typing.Optional[ProcessingStatus] = None,
202
+ next_token: typing.Optional[str] = None,
203
+ request_options: typing.Optional[RequestOptions] = None,
204
+ ) -> DocumentListResponse:
301
205
  """
302
- 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).
303
-
304
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
206
+ lookup all documents across all resources which are currently on GroundX
305
207
 
306
208
  Parameters
307
209
  ----------
308
- process_id : str
309
- the processId for the ingest process being checked
210
+ n : typing.Optional[int]
211
+ The maximum number of returned documents. Accepts 1-100 with a default of 20.
212
+
213
+ filter : typing.Optional[str]
214
+ Only documents with names that contain the filter string will be returned in the results.
215
+
216
+ sort : typing.Optional[Sort]
217
+ The document attribute that will be used to sort the results.
218
+
219
+ sort_order : typing.Optional[SortOrder]
220
+ The order in which to sort the results. A value for sort must also be set.
221
+
222
+ status : typing.Optional[ProcessingStatus]
223
+ A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
224
+
225
+ next_token : typing.Optional[str]
226
+ A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
310
227
 
311
228
  request_options : typing.Optional[RequestOptions]
312
229
  Request-specific configuration.
313
230
 
314
231
  Returns
315
232
  -------
316
- ProcessStatusResponse
233
+ DocumentListResponse
317
234
  Look up success
318
235
 
319
236
  Examples
@@ -323,95 +240,79 @@ class DocumentsClient:
323
240
  client = GroundX(
324
241
  api_key="YOUR_API_KEY",
325
242
  )
326
- client.documents.get_processing_status_by_id(
327
- process_id="processId",
243
+ client.documents.list(
244
+ n=1,
245
+ filter="filter",
246
+ sort="name",
247
+ sort_order="asc",
248
+ status="queued",
249
+ next_token="nextToken",
328
250
  )
329
251
  """
330
- _response = self._client_wrapper.httpx_client.request(
331
- f"v1/ingest/{jsonable_encoder(process_id)}",
332
- method="GET",
252
+ _response = self._raw_client.list(
253
+ n=n,
254
+ filter=filter,
255
+ sort=sort,
256
+ sort_order=sort_order,
257
+ status=status,
258
+ next_token=next_token,
333
259
  request_options=request_options,
334
260
  )
335
- try:
336
- if 200 <= _response.status_code < 300:
337
- return typing.cast(
338
- ProcessStatusResponse,
339
- parse_obj_as(
340
- type_=ProcessStatusResponse, # type: ignore
341
- object_=_response.json(),
342
- ),
343
- )
344
- if _response.status_code == 400:
345
- raise BadRequestError(
346
- typing.cast(
347
- typing.Optional[typing.Any],
348
- parse_obj_as(
349
- type_=typing.Optional[typing.Any], # type: ignore
350
- object_=_response.json(),
351
- ),
352
- )
353
- )
354
- if _response.status_code == 401:
355
- raise UnauthorizedError(
356
- typing.cast(
357
- typing.Optional[typing.Any],
358
- parse_obj_as(
359
- type_=typing.Optional[typing.Any], # type: ignore
360
- object_=_response.json(),
361
- ),
362
- )
363
- )
364
- _response_json = _response.json()
365
- except JSONDecodeError:
366
- raise ApiError(status_code=_response.status_code, body=_response.text)
367
- raise ApiError(status_code=_response.status_code, body=_response_json)
261
+ return _response.data
368
262
 
369
- def lookup(
263
+ def delete(
370
264
  self,
371
- id: int,
372
265
  *,
373
- n: typing.Optional[int] = None,
374
- filter: typing.Optional[str] = None,
375
- sort: typing.Optional[Sort] = None,
376
- sort_order: typing.Optional[SortOrder] = None,
377
- status: typing.Optional[ProcessingStatus] = None,
378
- next_token: typing.Optional[str] = None,
266
+ document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
379
267
  request_options: typing.Optional[RequestOptions] = None,
380
- ) -> DocumentLookupResponse:
268
+ ) -> IngestResponse:
381
269
  """
382
- lookup the document(s) associated with a processId, bucketId, groupId, or projectId.
383
-
384
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
270
+ Delete multiple documents hosted on GroundX
385
271
 
386
272
  Parameters
387
273
  ----------
388
- id : int
389
- a processId, bucketId, groupId, or projectId
274
+ document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
275
+ A list of documentIds which correspond to documents ingested by GroundX
390
276
 
391
- n : typing.Optional[int]
392
- The maximum number of returned documents. Accepts 1-100 with a default of 20.
277
+ request_options : typing.Optional[RequestOptions]
278
+ Request-specific configuration.
393
279
 
394
- filter : typing.Optional[str]
395
- Only documents with names that contain the filter string will be returned in the results.
280
+ Returns
281
+ -------
282
+ IngestResponse
283
+ Documents are queued to be deleted
396
284
 
397
- sort : typing.Optional[Sort]
398
- The document attribute that will be used to sort the results.
285
+ Examples
286
+ --------
287
+ from groundx import GroundX
399
288
 
400
- sort_order : typing.Optional[SortOrder]
401
- The order in which to sort the results. A value for sort must also be set.
289
+ client = GroundX(
290
+ api_key="YOUR_API_KEY",
291
+ )
292
+ client.documents.delete(
293
+ document_ids="123e4567-e89b-12d3-a456-426614174000,9f7c11a6-24b8-4d52-a9f3-90a7e70a9e49",
294
+ )
295
+ """
296
+ _response = self._raw_client.delete(document_ids=document_ids, request_options=request_options)
297
+ return _response.data
402
298
 
403
- status : typing.Optional[ProcessingStatus]
404
- A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
299
+ def get_processing_status_by_id(
300
+ self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
301
+ ) -> IngestResponse:
302
+ """
303
+ 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).
405
304
 
406
- next_token : typing.Optional[str]
407
- A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
305
+ Parameters
306
+ ----------
307
+ process_id : str
308
+ the processId for the ingest process being checked
408
309
 
409
310
  request_options : typing.Optional[RequestOptions]
410
311
  Request-specific configuration.
411
312
 
412
313
  Returns
413
314
  -------
414
- DocumentLookupResponse
315
+ IngestResponse
415
316
  Look up success
416
317
 
417
318
  Examples
@@ -421,59 +322,16 @@ class DocumentsClient:
421
322
  client = GroundX(
422
323
  api_key="YOUR_API_KEY",
423
324
  )
424
- client.documents.lookup(
425
- id=1,
325
+ client.documents.get_processing_status_by_id(
326
+ process_id="processId",
426
327
  )
427
328
  """
428
- _response = self._client_wrapper.httpx_client.request(
429
- f"v1/ingest/documents/{jsonable_encoder(id)}",
430
- method="GET",
431
- params={
432
- "n": n,
433
- "filter": filter,
434
- "sort": sort,
435
- "sortOrder": sort_order,
436
- "status": status,
437
- "nextToken": next_token,
438
- },
439
- request_options=request_options,
440
- )
441
- try:
442
- if 200 <= _response.status_code < 300:
443
- return typing.cast(
444
- DocumentLookupResponse,
445
- parse_obj_as(
446
- type_=DocumentLookupResponse, # type: ignore
447
- object_=_response.json(),
448
- ),
449
- )
450
- if _response.status_code == 400:
451
- raise BadRequestError(
452
- typing.cast(
453
- typing.Optional[typing.Any],
454
- parse_obj_as(
455
- type_=typing.Optional[typing.Any], # type: ignore
456
- object_=_response.json(),
457
- ),
458
- )
459
- )
460
- if _response.status_code == 401:
461
- raise UnauthorizedError(
462
- typing.cast(
463
- typing.Optional[typing.Any],
464
- parse_obj_as(
465
- type_=typing.Optional[typing.Any], # type: ignore
466
- object_=_response.json(),
467
- ),
468
- )
469
- )
470
- _response_json = _response.json()
471
- except JSONDecodeError:
472
- raise ApiError(status_code=_response.status_code, body=_response.text)
473
- raise ApiError(status_code=_response.status_code, body=_response_json)
329
+ _response = self._raw_client.get_processing_status_by_id(process_id, request_options=request_options)
330
+ return _response.data
474
331
 
475
- def list(
332
+ def lookup(
476
333
  self,
334
+ id: int,
477
335
  *,
478
336
  n: typing.Optional[int] = None,
479
337
  filter: typing.Optional[str] = None,
@@ -482,14 +340,15 @@ class DocumentsClient:
482
340
  status: typing.Optional[ProcessingStatus] = None,
483
341
  next_token: typing.Optional[str] = None,
484
342
  request_options: typing.Optional[RequestOptions] = None,
485
- ) -> DocumentListResponse:
343
+ ) -> DocumentLookupResponse:
486
344
  """
487
- lookup all documents across all resources which are currently on GroundX
488
-
489
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
345
+ lookup the document(s) associated with a processId, bucketId, or groupId.
490
346
 
491
347
  Parameters
492
348
  ----------
349
+ id : int
350
+ a processId, bucketId, or groupId
351
+
493
352
  n : typing.Optional[int]
494
353
  The maximum number of returned documents. Accepts 1-100 with a default of 20.
495
354
 
@@ -513,7 +372,7 @@ class DocumentsClient:
513
372
 
514
373
  Returns
515
374
  -------
516
- DocumentListResponse
375
+ DocumentLookupResponse
517
376
  Look up success
518
377
 
519
378
  Examples
@@ -523,58 +382,44 @@ class DocumentsClient:
523
382
  client = GroundX(
524
383
  api_key="YOUR_API_KEY",
525
384
  )
526
- client.documents.list()
385
+ client.documents.lookup(
386
+ id=1,
387
+ n=1,
388
+ filter="filter",
389
+ sort="name",
390
+ sort_order="asc",
391
+ status="queued",
392
+ next_token="nextToken",
393
+ )
527
394
  """
528
- _response = self._client_wrapper.httpx_client.request(
529
- "v1/ingest/documents",
530
- method="GET",
531
- params={
532
- "n": n,
533
- "filter": filter,
534
- "sort": sort,
535
- "sortOrder": sort_order,
536
- "status": status,
537
- "nextToken": next_token,
538
- },
395
+ _response = self._raw_client.lookup(
396
+ id,
397
+ n=n,
398
+ filter=filter,
399
+ sort=sort,
400
+ sort_order=sort_order,
401
+ status=status,
402
+ next_token=next_token,
539
403
  request_options=request_options,
540
404
  )
541
- try:
542
- if 200 <= _response.status_code < 300:
543
- return typing.cast(
544
- DocumentListResponse,
545
- parse_obj_as(
546
- type_=DocumentListResponse, # type: ignore
547
- object_=_response.json(),
548
- ),
549
- )
550
- _response_json = _response.json()
551
- except JSONDecodeError:
552
- raise ApiError(status_code=_response.status_code, body=_response.text)
553
- raise ApiError(status_code=_response.status_code, body=_response_json)
405
+ return _response.data
554
406
 
555
- def delete(
556
- self,
557
- *,
558
- document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
559
- request_options: typing.Optional[RequestOptions] = None,
560
- ) -> IngestResponse:
407
+ def get(self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentResponse:
561
408
  """
562
- Delete multiple documents hosted on GroundX
563
-
564
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
409
+ Look up an existing document by documentId.
565
410
 
566
411
  Parameters
567
412
  ----------
568
- document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
569
- A list of documentIds which correspond to documents ingested by GroundX
413
+ document_id : str
414
+ The documentId of the document for which GroundX information will be provided.
570
415
 
571
416
  request_options : typing.Optional[RequestOptions]
572
417
  Request-specific configuration.
573
418
 
574
419
  Returns
575
420
  -------
576
- IngestResponse
577
- Documents are queued to be deleted
421
+ DocumentResponse
422
+ Look up success
578
423
 
579
424
  Examples
580
425
  --------
@@ -583,68 +428,31 @@ class DocumentsClient:
583
428
  client = GroundX(
584
429
  api_key="YOUR_API_KEY",
585
430
  )
586
- client.documents.delete()
587
- """
588
- _response = self._client_wrapper.httpx_client.request(
589
- "v1/ingest/documents",
590
- method="DELETE",
591
- params={
592
- "documentIds": document_ids,
593
- },
594
- request_options=request_options,
431
+ client.documents.get(
432
+ document_id="documentId",
595
433
  )
596
- try:
597
- if 200 <= _response.status_code < 300:
598
- return typing.cast(
599
- IngestResponse,
600
- parse_obj_as(
601
- type_=IngestResponse, # type: ignore
602
- object_=_response.json(),
603
- ),
604
- )
605
- if _response.status_code == 400:
606
- raise BadRequestError(
607
- typing.cast(
608
- typing.Optional[typing.Any],
609
- parse_obj_as(
610
- type_=typing.Optional[typing.Any], # type: ignore
611
- object_=_response.json(),
612
- ),
613
- )
614
- )
615
- if _response.status_code == 401:
616
- raise UnauthorizedError(
617
- typing.cast(
618
- typing.Optional[typing.Any],
619
- parse_obj_as(
620
- type_=typing.Optional[typing.Any], # type: ignore
621
- object_=_response.json(),
622
- ),
623
- )
624
- )
625
- _response_json = _response.json()
626
- except JSONDecodeError:
627
- raise ApiError(status_code=_response.status_code, body=_response.text)
628
- raise ApiError(status_code=_response.status_code, body=_response_json)
629
-
630
- def get(self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentResponse:
631
434
  """
632
- Look up an existing document by documentId.
435
+ _response = self._raw_client.get(document_id, request_options=request_options)
436
+ return _response.data
633
437
 
634
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
438
+ def delete_by_id(
439
+ self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
440
+ ) -> IngestResponse:
441
+ """
442
+ Delete a single document hosted on GroundX
635
443
 
636
444
  Parameters
637
445
  ----------
638
446
  document_id : str
639
- The documentId of the document for which GroundX information will be provided.
447
+ A documentId which correspond to a document ingested by GroundX
640
448
 
641
449
  request_options : typing.Optional[RequestOptions]
642
450
  Request-specific configuration.
643
451
 
644
452
  Returns
645
453
  -------
646
- DocumentResponse
647
- Look up success
454
+ IngestResponse
455
+ Document successfully deleted
648
456
 
649
457
  Examples
650
458
  --------
@@ -653,69 +461,38 @@ class DocumentsClient:
653
461
  client = GroundX(
654
462
  api_key="YOUR_API_KEY",
655
463
  )
656
- client.documents.get(
464
+ client.documents.delete_by_id(
657
465
  document_id="documentId",
658
466
  )
659
467
  """
660
- _response = self._client_wrapper.httpx_client.request(
661
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
662
- method="GET",
663
- request_options=request_options,
664
- )
665
- try:
666
- if 200 <= _response.status_code < 300:
667
- return typing.cast(
668
- DocumentResponse,
669
- parse_obj_as(
670
- type_=DocumentResponse, # type: ignore
671
- object_=_response.json(),
672
- ),
673
- )
674
- if _response.status_code == 400:
675
- raise BadRequestError(
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
- if _response.status_code == 401:
685
- raise UnauthorizedError(
686
- typing.cast(
687
- typing.Optional[typing.Any],
688
- parse_obj_as(
689
- type_=typing.Optional[typing.Any], # type: ignore
690
- object_=_response.json(),
691
- ),
692
- )
693
- )
694
- _response_json = _response.json()
695
- except JSONDecodeError:
696
- raise ApiError(status_code=_response.status_code, body=_response.text)
697
- raise ApiError(status_code=_response.status_code, body=_response_json)
468
+ _response = self._raw_client.delete_by_id(document_id, request_options=request_options)
469
+ return _response.data
698
470
 
699
- def delete_by_id(
700
- self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
701
- ) -> IngestResponse:
471
+ def get_processes(
472
+ self,
473
+ *,
474
+ n: typing.Optional[int] = None,
475
+ status: typing.Optional[ProcessingStatus] = None,
476
+ request_options: typing.Optional[RequestOptions] = None,
477
+ ) -> ProcessesStatusResponse:
702
478
  """
703
- Delete a single document hosted on GroundX
704
-
705
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
479
+ Get a list of ingest process requests, sorted from most recent to least.
706
480
 
707
481
  Parameters
708
482
  ----------
709
- document_id : str
710
- A documentId which correspond to a document ingested by GroundX
483
+ n : typing.Optional[int]
484
+ The maximum number of returned processes. Accepts 1-100 with a default of 20.
485
+
486
+ status : typing.Optional[ProcessingStatus]
487
+ A status filter on the processing status. If this value is set, then only processes with this status will be returned in the results.
711
488
 
712
489
  request_options : typing.Optional[RequestOptions]
713
490
  Request-specific configuration.
714
491
 
715
492
  Returns
716
493
  -------
717
- IngestResponse
718
- Document successfully deleted
494
+ ProcessesStatusResponse
495
+ Look up success
719
496
 
720
497
  Examples
721
498
  --------
@@ -724,69 +501,53 @@ class DocumentsClient:
724
501
  client = GroundX(
725
502
  api_key="YOUR_API_KEY",
726
503
  )
727
- client.documents.delete_by_id(
728
- document_id="documentId",
504
+ client.documents.get_processes(
505
+ n=1,
506
+ status="queued",
729
507
  )
730
508
  """
731
- _response = self._client_wrapper.httpx_client.request(
732
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
733
- method="DELETE",
734
- request_options=request_options,
735
- )
736
- try:
737
- if 200 <= _response.status_code < 300:
738
- return typing.cast(
739
- IngestResponse,
740
- parse_obj_as(
741
- type_=IngestResponse, # type: ignore
742
- object_=_response.json(),
743
- ),
744
- )
745
- if _response.status_code == 400:
746
- raise BadRequestError(
747
- typing.cast(
748
- typing.Optional[typing.Any],
749
- parse_obj_as(
750
- type_=typing.Optional[typing.Any], # type: ignore
751
- object_=_response.json(),
752
- ),
753
- )
754
- )
755
- if _response.status_code == 401:
756
- raise UnauthorizedError(
757
- typing.cast(
758
- typing.Optional[typing.Any],
759
- parse_obj_as(
760
- type_=typing.Optional[typing.Any], # type: ignore
761
- object_=_response.json(),
762
- ),
763
- )
764
- )
765
- _response_json = _response.json()
766
- except JSONDecodeError:
767
- raise ApiError(status_code=_response.status_code, body=_response.text)
768
- raise ApiError(status_code=_response.status_code, body=_response_json)
509
+ _response = self._raw_client.get_processes(n=n, status=status, request_options=request_options)
510
+ return _response.data
769
511
 
770
512
 
771
513
  class AsyncDocumentsClient:
772
514
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
773
- self._client_wrapper = client_wrapper
515
+ self._raw_client = AsyncRawDocumentsClient(client_wrapper=client_wrapper)
516
+
517
+ @property
518
+ def with_raw_response(self) -> AsyncRawDocumentsClient:
519
+ """
520
+ Retrieves a raw implementation of this client that returns raw responses.
521
+
522
+ Returns
523
+ -------
524
+ AsyncRawDocumentsClient
525
+ """
526
+ return self._raw_client
774
527
 
775
528
  async def ingest_remote(
776
529
  self,
777
530
  *,
778
531
  documents: typing.Sequence[IngestRemoteDocument],
532
+ callback_url: typing.Optional[str] = OMIT,
533
+ callback_data: typing.Optional[str] = OMIT,
779
534
  request_options: typing.Optional[RequestOptions] = None,
780
535
  ) -> IngestResponse:
781
536
  """
782
- Ingest documents hosted on public URLs to a GroundX bucket.
537
+ Ingest documents hosted on public URLs into a GroundX bucket.
783
538
 
784
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
539
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
785
540
 
786
541
  Parameters
787
542
  ----------
788
543
  documents : typing.Sequence[IngestRemoteDocument]
789
544
 
545
+ callback_url : typing.Optional[str]
546
+ An endpoint that will receive processing event updates as POST.
547
+
548
+ callback_data : typing.Optional[str]
549
+ A string that is returned, along with processing event updates, to the callback URL.
550
+
790
551
  request_options : typing.Optional[RequestOptions]
791
552
  Request-specific configuration.
792
553
 
@@ -811,10 +572,9 @@ class AsyncDocumentsClient:
811
572
  documents=[
812
573
  IngestRemoteDocument(
813
574
  bucket_id=1234,
814
- file_name="my_file.txt",
575
+ file_name="my_file1.txt",
815
576
  file_type="txt",
816
- search_data={"key": "value"},
817
- source_url="https://my.source.url.com/file.txt",
577
+ source_url="https://my.source.url.com/file1.txt",
818
578
  )
819
579
  ],
820
580
  )
@@ -822,68 +582,22 @@ class AsyncDocumentsClient:
822
582
 
823
583
  asyncio.run(main())
824
584
  """
825
- _response = await self._client_wrapper.httpx_client.request(
826
- "v1/ingest/documents/remote",
827
- method="POST",
828
- json={
829
- "documents": convert_and_respect_annotation_metadata(
830
- object_=documents, annotation=typing.Sequence[IngestRemoteDocument], direction="write"
831
- ),
832
- },
833
- headers={
834
- "content-type": "application/json",
835
- },
836
- request_options=request_options,
837
- omit=OMIT,
585
+ _response = await self._raw_client.ingest_remote(
586
+ documents=documents, callback_url=callback_url, callback_data=callback_data, request_options=request_options
838
587
  )
839
- try:
840
- if 200 <= _response.status_code < 300:
841
- return typing.cast(
842
- IngestResponse,
843
- parse_obj_as(
844
- type_=IngestResponse, # type: ignore
845
- object_=_response.json(),
846
- ),
847
- )
848
- if _response.status_code == 400:
849
- raise BadRequestError(
850
- typing.cast(
851
- typing.Optional[typing.Any],
852
- parse_obj_as(
853
- type_=typing.Optional[typing.Any], # type: ignore
854
- object_=_response.json(),
855
- ),
856
- )
857
- )
858
- if _response.status_code == 401:
859
- raise UnauthorizedError(
860
- typing.cast(
861
- typing.Optional[typing.Any],
862
- parse_obj_as(
863
- type_=typing.Optional[typing.Any], # type: ignore
864
- object_=_response.json(),
865
- ),
866
- )
867
- )
868
- _response_json = _response.json()
869
- except JSONDecodeError:
870
- raise ApiError(status_code=_response.status_code, body=_response.text)
871
- raise ApiError(status_code=_response.status_code, body=_response_json)
588
+ return _response.data
872
589
 
873
- async def ingest_local(
874
- self,
875
- *,
876
- files: typing.List[DocumentsIngestLocalRequestFilesItem],
877
- request_options: typing.Optional[RequestOptions] = None,
590
+ async def ingest_local(
591
+ self, *, request: DocumentLocalIngestRequest, request_options: typing.Optional[RequestOptions] = None
878
592
  ) -> IngestResponse:
879
593
  """
880
- Upload documents hosted on a local file system for ingestion into a GroundX bucket.
594
+ Upload documents hosted on a local file system into a GroundX bucket.
881
595
 
882
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
596
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
883
597
 
884
598
  Parameters
885
599
  ----------
886
- files : typing.List[DocumentsIngestLocalRequestFilesItem]
600
+ request : DocumentLocalIngestRequest
887
601
 
888
602
  request_options : typing.Optional[RequestOptions]
889
603
  Request-specific configuration.
@@ -897,8 +611,11 @@ class AsyncDocumentsClient:
897
611
  --------
898
612
  import asyncio
899
613
 
900
- from groundx import AsyncGroundX
901
- from groundx.documents import DocumentsIngestLocalRequestFilesItem
614
+ from groundx import (
615
+ AsyncGroundX,
616
+ IngestLocalDocument,
617
+ IngestLocalDocumentMetadata,
618
+ )
902
619
 
903
620
  client = AsyncGroundX(
904
621
  api_key="YOUR_API_KEY",
@@ -907,12 +624,14 @@ class AsyncDocumentsClient:
907
624
 
908
625
  async def main() -> None:
909
626
  await client.documents.ingest_local(
910
- files=[
911
- DocumentsIngestLocalRequestFilesItem(
912
- bucket_id=1,
913
- file_data="fileData",
914
- file_name="fileName",
915
- file_type="txt",
627
+ request=[
628
+ IngestLocalDocument(
629
+ blob="blob",
630
+ metadata=IngestLocalDocumentMetadata(
631
+ bucket_id=1234,
632
+ file_name="my_file1.txt",
633
+ file_type="txt",
634
+ ),
916
635
  )
917
636
  ],
918
637
  )
@@ -920,64 +639,34 @@ class AsyncDocumentsClient:
920
639
 
921
640
  asyncio.run(main())
922
641
  """
923
- _response = await self._client_wrapper.httpx_client.request(
924
- "v1/ingest/documents/local",
925
- method="POST",
926
- data={
927
- "files": files,
928
- },
929
- files={},
930
- request_options=request_options,
931
- omit=OMIT,
932
- )
933
- try:
934
- if 200 <= _response.status_code < 300:
935
- return typing.cast(
936
- IngestResponse,
937
- parse_obj_as(
938
- type_=IngestResponse, # type: ignore
939
- object_=_response.json(),
940
- ),
941
- )
942
- if _response.status_code == 400:
943
- raise BadRequestError(
944
- typing.cast(
945
- typing.Optional[typing.Any],
946
- parse_obj_as(
947
- type_=typing.Optional[typing.Any], # type: ignore
948
- object_=_response.json(),
949
- ),
950
- )
951
- )
952
- if _response.status_code == 401:
953
- raise UnauthorizedError(
954
- typing.cast(
955
- typing.Optional[typing.Any],
956
- parse_obj_as(
957
- type_=typing.Optional[typing.Any], # type: ignore
958
- object_=_response.json(),
959
- ),
960
- )
961
- )
962
- _response_json = _response.json()
963
- except JSONDecodeError:
964
- raise ApiError(status_code=_response.status_code, body=_response.text)
965
- raise ApiError(status_code=_response.status_code, body=_response_json)
642
+ _response = await self._raw_client.ingest_local(request=request, request_options=request_options)
643
+ return _response.data
966
644
 
967
645
  async def crawl_website(
968
646
  self,
969
647
  *,
970
- websites: typing.Sequence[WebsiteCrawlRequestWebsitesItem],
648
+ websites: typing.Sequence[WebsiteSource],
649
+ callback_url: typing.Optional[str] = OMIT,
650
+ callback_data: typing.Optional[str] = OMIT,
971
651
  request_options: typing.Optional[RequestOptions] = None,
972
652
  ) -> IngestResponse:
973
653
  """
974
654
  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.
975
655
 
976
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
656
+ Note1: This endpoint is currently not supported for on-prem deployments.
657
+ Note2: The `source_url` must include the protocol, http:// or https://.
658
+
659
+ [Supported Document Types and Ingest Capacities](https://docs.eyelevel.ai/documentation/fundamentals/document-types-and-ingest-capacities)
977
660
 
978
661
  Parameters
979
662
  ----------
980
- websites : typing.Sequence[WebsiteCrawlRequestWebsitesItem]
663
+ websites : typing.Sequence[WebsiteSource]
664
+
665
+ callback_url : typing.Optional[str]
666
+ The URL that will receive processing event updates.
667
+
668
+ callback_data : typing.Optional[str]
669
+ A string that is returned, along with processing event updates, to the callback URL.
981
670
 
982
671
  request_options : typing.Optional[RequestOptions]
983
672
  Request-specific configuration.
@@ -991,8 +680,7 @@ class AsyncDocumentsClient:
991
680
  --------
992
681
  import asyncio
993
682
 
994
- from groundx import AsyncGroundX
995
- from groundx.documents import WebsiteCrawlRequestWebsitesItem
683
+ from groundx import AsyncGroundX, WebsiteSource
996
684
 
997
685
  client = AsyncGroundX(
998
686
  api_key="YOUR_API_KEY",
@@ -1002,8 +690,11 @@ class AsyncDocumentsClient:
1002
690
  async def main() -> None:
1003
691
  await client.documents.crawl_website(
1004
692
  websites=[
1005
- WebsiteCrawlRequestWebsitesItem(
1006
- bucket_id=123,
693
+ WebsiteSource(
694
+ bucket_id=1234,
695
+ cap=10,
696
+ depth=2,
697
+ search_data={"key": "value"},
1007
698
  source_url="https://my.website.com",
1008
699
  )
1009
700
  ],
@@ -1012,73 +703,51 @@ class AsyncDocumentsClient:
1012
703
 
1013
704
  asyncio.run(main())
1014
705
  """
1015
- _response = await self._client_wrapper.httpx_client.request(
1016
- "v1/ingest/documents/website",
1017
- method="POST",
1018
- json={
1019
- "websites": convert_and_respect_annotation_metadata(
1020
- object_=websites, annotation=typing.Sequence[WebsiteCrawlRequestWebsitesItem], direction="write"
1021
- ),
1022
- },
1023
- headers={
1024
- "content-type": "application/json",
1025
- },
1026
- request_options=request_options,
1027
- omit=OMIT,
706
+ _response = await self._raw_client.crawl_website(
707
+ websites=websites, callback_url=callback_url, callback_data=callback_data, request_options=request_options
1028
708
  )
1029
- try:
1030
- if 200 <= _response.status_code < 300:
1031
- return typing.cast(
1032
- IngestResponse,
1033
- parse_obj_as(
1034
- type_=IngestResponse, # type: ignore
1035
- object_=_response.json(),
1036
- ),
1037
- )
1038
- if _response.status_code == 400:
1039
- raise BadRequestError(
1040
- typing.cast(
1041
- typing.Optional[typing.Any],
1042
- parse_obj_as(
1043
- type_=typing.Optional[typing.Any], # type: ignore
1044
- object_=_response.json(),
1045
- ),
1046
- )
1047
- )
1048
- if _response.status_code == 401:
1049
- raise UnauthorizedError(
1050
- typing.cast(
1051
- typing.Optional[typing.Any],
1052
- parse_obj_as(
1053
- type_=typing.Optional[typing.Any], # type: ignore
1054
- object_=_response.json(),
1055
- ),
1056
- )
1057
- )
1058
- _response_json = _response.json()
1059
- except JSONDecodeError:
1060
- raise ApiError(status_code=_response.status_code, body=_response.text)
1061
- raise ApiError(status_code=_response.status_code, body=_response_json)
709
+ return _response.data
1062
710
 
1063
- async def get_processing_status_by_id(
1064
- self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
1065
- ) -> ProcessStatusResponse:
711
+ async def list(
712
+ self,
713
+ *,
714
+ n: typing.Optional[int] = None,
715
+ filter: typing.Optional[str] = None,
716
+ sort: typing.Optional[Sort] = None,
717
+ sort_order: typing.Optional[SortOrder] = None,
718
+ status: typing.Optional[ProcessingStatus] = None,
719
+ next_token: typing.Optional[str] = None,
720
+ request_options: typing.Optional[RequestOptions] = None,
721
+ ) -> DocumentListResponse:
1066
722
  """
1067
- 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).
1068
-
1069
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
723
+ lookup all documents across all resources which are currently on GroundX
1070
724
 
1071
725
  Parameters
1072
726
  ----------
1073
- process_id : str
1074
- the processId for the ingest process being checked
727
+ n : typing.Optional[int]
728
+ The maximum number of returned documents. Accepts 1-100 with a default of 20.
729
+
730
+ filter : typing.Optional[str]
731
+ Only documents with names that contain the filter string will be returned in the results.
732
+
733
+ sort : typing.Optional[Sort]
734
+ The document attribute that will be used to sort the results.
735
+
736
+ sort_order : typing.Optional[SortOrder]
737
+ The order in which to sort the results. A value for sort must also be set.
738
+
739
+ status : typing.Optional[ProcessingStatus]
740
+ A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
741
+
742
+ next_token : typing.Optional[str]
743
+ A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
1075
744
 
1076
745
  request_options : typing.Optional[RequestOptions]
1077
746
  Request-specific configuration.
1078
747
 
1079
748
  Returns
1080
749
  -------
1081
- ProcessStatusResponse
750
+ DocumentListResponse
1082
751
  Look up success
1083
752
 
1084
753
  Examples
@@ -1093,98 +762,90 @@ class AsyncDocumentsClient:
1093
762
 
1094
763
 
1095
764
  async def main() -> None:
1096
- await client.documents.get_processing_status_by_id(
1097
- process_id="processId",
765
+ await client.documents.list(
766
+ n=1,
767
+ filter="filter",
768
+ sort="name",
769
+ sort_order="asc",
770
+ status="queued",
771
+ next_token="nextToken",
1098
772
  )
1099
773
 
1100
774
 
1101
775
  asyncio.run(main())
1102
776
  """
1103
- _response = await self._client_wrapper.httpx_client.request(
1104
- f"v1/ingest/{jsonable_encoder(process_id)}",
1105
- method="GET",
777
+ _response = await self._raw_client.list(
778
+ n=n,
779
+ filter=filter,
780
+ sort=sort,
781
+ sort_order=sort_order,
782
+ status=status,
783
+ next_token=next_token,
1106
784
  request_options=request_options,
1107
785
  )
1108
- try:
1109
- if 200 <= _response.status_code < 300:
1110
- return typing.cast(
1111
- ProcessStatusResponse,
1112
- parse_obj_as(
1113
- type_=ProcessStatusResponse, # type: ignore
1114
- object_=_response.json(),
1115
- ),
1116
- )
1117
- if _response.status_code == 400:
1118
- raise BadRequestError(
1119
- typing.cast(
1120
- typing.Optional[typing.Any],
1121
- parse_obj_as(
1122
- type_=typing.Optional[typing.Any], # type: ignore
1123
- object_=_response.json(),
1124
- ),
1125
- )
1126
- )
1127
- if _response.status_code == 401:
1128
- raise UnauthorizedError(
1129
- typing.cast(
1130
- typing.Optional[typing.Any],
1131
- parse_obj_as(
1132
- type_=typing.Optional[typing.Any], # type: ignore
1133
- object_=_response.json(),
1134
- ),
1135
- )
1136
- )
1137
- _response_json = _response.json()
1138
- except JSONDecodeError:
1139
- raise ApiError(status_code=_response.status_code, body=_response.text)
1140
- raise ApiError(status_code=_response.status_code, body=_response_json)
786
+ return _response.data
1141
787
 
1142
- async def lookup(
788
+ async def delete(
1143
789
  self,
1144
- id: int,
1145
790
  *,
1146
- n: typing.Optional[int] = None,
1147
- filter: typing.Optional[str] = None,
1148
- sort: typing.Optional[Sort] = None,
1149
- sort_order: typing.Optional[SortOrder] = None,
1150
- status: typing.Optional[ProcessingStatus] = None,
1151
- next_token: typing.Optional[str] = None,
791
+ document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1152
792
  request_options: typing.Optional[RequestOptions] = None,
1153
- ) -> DocumentLookupResponse:
793
+ ) -> IngestResponse:
1154
794
  """
1155
- lookup the document(s) associated with a processId, bucketId, groupId, or projectId.
1156
-
1157
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
795
+ Delete multiple documents hosted on GroundX
1158
796
 
1159
797
  Parameters
1160
798
  ----------
1161
- id : int
1162
- a processId, bucketId, groupId, or projectId
799
+ document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
800
+ A list of documentIds which correspond to documents ingested by GroundX
1163
801
 
1164
- n : typing.Optional[int]
1165
- The maximum number of returned documents. Accepts 1-100 with a default of 20.
802
+ request_options : typing.Optional[RequestOptions]
803
+ Request-specific configuration.
1166
804
 
1167
- filter : typing.Optional[str]
1168
- Only documents with names that contain the filter string will be returned in the results.
805
+ Returns
806
+ -------
807
+ IngestResponse
808
+ Documents are queued to be deleted
1169
809
 
1170
- sort : typing.Optional[Sort]
1171
- The document attribute that will be used to sort the results.
810
+ Examples
811
+ --------
812
+ import asyncio
1172
813
 
1173
- sort_order : typing.Optional[SortOrder]
1174
- The order in which to sort the results. A value for sort must also be set.
814
+ from groundx import AsyncGroundX
1175
815
 
1176
- status : typing.Optional[ProcessingStatus]
1177
- A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
816
+ client = AsyncGroundX(
817
+ api_key="YOUR_API_KEY",
818
+ )
1178
819
 
1179
- next_token : typing.Optional[str]
1180
- A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
820
+
821
+ async def main() -> None:
822
+ await client.documents.delete(
823
+ document_ids="123e4567-e89b-12d3-a456-426614174000,9f7c11a6-24b8-4d52-a9f3-90a7e70a9e49",
824
+ )
825
+
826
+
827
+ asyncio.run(main())
828
+ """
829
+ _response = await self._raw_client.delete(document_ids=document_ids, request_options=request_options)
830
+ return _response.data
831
+
832
+ async def get_processing_status_by_id(
833
+ self, process_id: str, *, request_options: typing.Optional[RequestOptions] = None
834
+ ) -> IngestResponse:
835
+ """
836
+ 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).
837
+
838
+ Parameters
839
+ ----------
840
+ process_id : str
841
+ the processId for the ingest process being checked
1181
842
 
1182
843
  request_options : typing.Optional[RequestOptions]
1183
844
  Request-specific configuration.
1184
845
 
1185
846
  Returns
1186
847
  -------
1187
- DocumentLookupResponse
848
+ IngestResponse
1188
849
  Look up success
1189
850
 
1190
851
  Examples
@@ -1199,62 +860,19 @@ class AsyncDocumentsClient:
1199
860
 
1200
861
 
1201
862
  async def main() -> None:
1202
- await client.documents.lookup(
1203
- id=1,
863
+ await client.documents.get_processing_status_by_id(
864
+ process_id="processId",
1204
865
  )
1205
866
 
1206
867
 
1207
868
  asyncio.run(main())
1208
869
  """
1209
- _response = await self._client_wrapper.httpx_client.request(
1210
- f"v1/ingest/documents/{jsonable_encoder(id)}",
1211
- method="GET",
1212
- params={
1213
- "n": n,
1214
- "filter": filter,
1215
- "sort": sort,
1216
- "sortOrder": sort_order,
1217
- "status": status,
1218
- "nextToken": next_token,
1219
- },
1220
- request_options=request_options,
1221
- )
1222
- try:
1223
- if 200 <= _response.status_code < 300:
1224
- return typing.cast(
1225
- DocumentLookupResponse,
1226
- parse_obj_as(
1227
- type_=DocumentLookupResponse, # type: ignore
1228
- object_=_response.json(),
1229
- ),
1230
- )
1231
- if _response.status_code == 400:
1232
- raise BadRequestError(
1233
- typing.cast(
1234
- typing.Optional[typing.Any],
1235
- parse_obj_as(
1236
- type_=typing.Optional[typing.Any], # type: ignore
1237
- object_=_response.json(),
1238
- ),
1239
- )
1240
- )
1241
- if _response.status_code == 401:
1242
- raise UnauthorizedError(
1243
- typing.cast(
1244
- typing.Optional[typing.Any],
1245
- parse_obj_as(
1246
- type_=typing.Optional[typing.Any], # type: ignore
1247
- object_=_response.json(),
1248
- ),
1249
- )
1250
- )
1251
- _response_json = _response.json()
1252
- except JSONDecodeError:
1253
- raise ApiError(status_code=_response.status_code, body=_response.text)
1254
- raise ApiError(status_code=_response.status_code, body=_response_json)
870
+ _response = await self._raw_client.get_processing_status_by_id(process_id, request_options=request_options)
871
+ return _response.data
1255
872
 
1256
- async def list(
873
+ async def lookup(
1257
874
  self,
875
+ id: int,
1258
876
  *,
1259
877
  n: typing.Optional[int] = None,
1260
878
  filter: typing.Optional[str] = None,
@@ -1263,14 +881,15 @@ class AsyncDocumentsClient:
1263
881
  status: typing.Optional[ProcessingStatus] = None,
1264
882
  next_token: typing.Optional[str] = None,
1265
883
  request_options: typing.Optional[RequestOptions] = None,
1266
- ) -> DocumentListResponse:
884
+ ) -> DocumentLookupResponse:
1267
885
  """
1268
- lookup all documents across all resources which are currently on GroundX
1269
-
1270
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
886
+ lookup the document(s) associated with a processId, bucketId, or groupId.
1271
887
 
1272
888
  Parameters
1273
889
  ----------
890
+ id : int
891
+ a processId, bucketId, or groupId
892
+
1274
893
  n : typing.Optional[int]
1275
894
  The maximum number of returned documents. Accepts 1-100 with a default of 20.
1276
895
 
@@ -1294,7 +913,7 @@ class AsyncDocumentsClient:
1294
913
 
1295
914
  Returns
1296
915
  -------
1297
- DocumentListResponse
916
+ DocumentLookupResponse
1298
917
  Look up success
1299
918
 
1300
919
  Examples
@@ -1309,61 +928,49 @@ class AsyncDocumentsClient:
1309
928
 
1310
929
 
1311
930
  async def main() -> None:
1312
- await client.documents.list()
931
+ await client.documents.lookup(
932
+ id=1,
933
+ n=1,
934
+ filter="filter",
935
+ sort="name",
936
+ sort_order="asc",
937
+ status="queued",
938
+ next_token="nextToken",
939
+ )
1313
940
 
1314
941
 
1315
942
  asyncio.run(main())
1316
943
  """
1317
- _response = await self._client_wrapper.httpx_client.request(
1318
- "v1/ingest/documents",
1319
- method="GET",
1320
- params={
1321
- "n": n,
1322
- "filter": filter,
1323
- "sort": sort,
1324
- "sortOrder": sort_order,
1325
- "status": status,
1326
- "nextToken": next_token,
1327
- },
944
+ _response = await self._raw_client.lookup(
945
+ id,
946
+ n=n,
947
+ filter=filter,
948
+ sort=sort,
949
+ sort_order=sort_order,
950
+ status=status,
951
+ next_token=next_token,
1328
952
  request_options=request_options,
1329
953
  )
1330
- try:
1331
- if 200 <= _response.status_code < 300:
1332
- return typing.cast(
1333
- DocumentListResponse,
1334
- parse_obj_as(
1335
- type_=DocumentListResponse, # type: ignore
1336
- object_=_response.json(),
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)
954
+ return _response.data
1343
955
 
1344
- async def delete(
1345
- self,
1346
- *,
1347
- document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1348
- request_options: typing.Optional[RequestOptions] = None,
1349
- ) -> IngestResponse:
956
+ async def get(
957
+ self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
958
+ ) -> DocumentResponse:
1350
959
  """
1351
- Delete multiple documents hosted on GroundX
1352
-
1353
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
960
+ Look up an existing document by documentId.
1354
961
 
1355
962
  Parameters
1356
963
  ----------
1357
- document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1358
- A list of documentIds which correspond to documents ingested by GroundX
964
+ document_id : str
965
+ The documentId of the document for which GroundX information will be provided.
1359
966
 
1360
967
  request_options : typing.Optional[RequestOptions]
1361
968
  Request-specific configuration.
1362
969
 
1363
970
  Returns
1364
971
  -------
1365
- IngestResponse
1366
- Documents are queued to be deleted
972
+ DocumentResponse
973
+ Look up success
1367
974
 
1368
975
  Examples
1369
976
  --------
@@ -1377,73 +984,34 @@ class AsyncDocumentsClient:
1377
984
 
1378
985
 
1379
986
  async def main() -> None:
1380
- await client.documents.delete()
987
+ await client.documents.get(
988
+ document_id="documentId",
989
+ )
1381
990
 
1382
991
 
1383
992
  asyncio.run(main())
1384
993
  """
1385
- _response = await self._client_wrapper.httpx_client.request(
1386
- "v1/ingest/documents",
1387
- method="DELETE",
1388
- params={
1389
- "documentIds": document_ids,
1390
- },
1391
- request_options=request_options,
1392
- )
1393
- try:
1394
- if 200 <= _response.status_code < 300:
1395
- return typing.cast(
1396
- IngestResponse,
1397
- parse_obj_as(
1398
- type_=IngestResponse, # type: ignore
1399
- object_=_response.json(),
1400
- ),
1401
- )
1402
- if _response.status_code == 400:
1403
- raise BadRequestError(
1404
- typing.cast(
1405
- typing.Optional[typing.Any],
1406
- parse_obj_as(
1407
- type_=typing.Optional[typing.Any], # type: ignore
1408
- object_=_response.json(),
1409
- ),
1410
- )
1411
- )
1412
- if _response.status_code == 401:
1413
- raise UnauthorizedError(
1414
- typing.cast(
1415
- typing.Optional[typing.Any],
1416
- parse_obj_as(
1417
- type_=typing.Optional[typing.Any], # type: ignore
1418
- object_=_response.json(),
1419
- ),
1420
- )
1421
- )
1422
- _response_json = _response.json()
1423
- except JSONDecodeError:
1424
- raise ApiError(status_code=_response.status_code, body=_response.text)
1425
- raise ApiError(status_code=_response.status_code, body=_response_json)
994
+ _response = await self._raw_client.get(document_id, request_options=request_options)
995
+ return _response.data
1426
996
 
1427
- async def get(
997
+ async def delete_by_id(
1428
998
  self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
1429
- ) -> DocumentResponse:
999
+ ) -> IngestResponse:
1430
1000
  """
1431
- Look up an existing document by documentId.
1432
-
1433
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
1001
+ Delete a single document hosted on GroundX
1434
1002
 
1435
1003
  Parameters
1436
1004
  ----------
1437
1005
  document_id : str
1438
- The documentId of the document for which GroundX information will be provided.
1006
+ A documentId which correspond to a document ingested by GroundX
1439
1007
 
1440
1008
  request_options : typing.Optional[RequestOptions]
1441
1009
  Request-specific configuration.
1442
1010
 
1443
1011
  Returns
1444
1012
  -------
1445
- DocumentResponse
1446
- Look up success
1013
+ IngestResponse
1014
+ Document successfully deleted
1447
1015
 
1448
1016
  Examples
1449
1017
  --------
@@ -1457,72 +1025,41 @@ class AsyncDocumentsClient:
1457
1025
 
1458
1026
 
1459
1027
  async def main() -> None:
1460
- await client.documents.get(
1028
+ await client.documents.delete_by_id(
1461
1029
  document_id="documentId",
1462
1030
  )
1463
1031
 
1464
1032
 
1465
1033
  asyncio.run(main())
1466
1034
  """
1467
- _response = await self._client_wrapper.httpx_client.request(
1468
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1469
- method="GET",
1470
- request_options=request_options,
1471
- )
1472
- try:
1473
- if 200 <= _response.status_code < 300:
1474
- return typing.cast(
1475
- DocumentResponse,
1476
- parse_obj_as(
1477
- type_=DocumentResponse, # type: ignore
1478
- object_=_response.json(),
1479
- ),
1480
- )
1481
- if _response.status_code == 400:
1482
- raise BadRequestError(
1483
- typing.cast(
1484
- typing.Optional[typing.Any],
1485
- parse_obj_as(
1486
- type_=typing.Optional[typing.Any], # type: ignore
1487
- object_=_response.json(),
1488
- ),
1489
- )
1490
- )
1491
- if _response.status_code == 401:
1492
- raise UnauthorizedError(
1493
- typing.cast(
1494
- typing.Optional[typing.Any],
1495
- parse_obj_as(
1496
- type_=typing.Optional[typing.Any], # type: ignore
1497
- object_=_response.json(),
1498
- ),
1499
- )
1500
- )
1501
- _response_json = _response.json()
1502
- except JSONDecodeError:
1503
- raise ApiError(status_code=_response.status_code, body=_response.text)
1504
- raise ApiError(status_code=_response.status_code, body=_response_json)
1035
+ _response = await self._raw_client.delete_by_id(document_id, request_options=request_options)
1036
+ return _response.data
1505
1037
 
1506
- async def delete_by_id(
1507
- self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
1508
- ) -> IngestResponse:
1038
+ async def get_processes(
1039
+ self,
1040
+ *,
1041
+ n: typing.Optional[int] = None,
1042
+ status: typing.Optional[ProcessingStatus] = None,
1043
+ request_options: typing.Optional[RequestOptions] = None,
1044
+ ) -> ProcessesStatusResponse:
1509
1045
  """
1510
- Delete a single document hosted on GroundX
1511
-
1512
- Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
1046
+ Get a list of ingest process requests, sorted from most recent to least.
1513
1047
 
1514
1048
  Parameters
1515
1049
  ----------
1516
- document_id : str
1517
- A documentId which correspond to a document ingested by GroundX
1050
+ n : typing.Optional[int]
1051
+ The maximum number of returned processes. Accepts 1-100 with a default of 20.
1052
+
1053
+ status : typing.Optional[ProcessingStatus]
1054
+ A status filter on the processing status. If this value is set, then only processes with this status will be returned in the results.
1518
1055
 
1519
1056
  request_options : typing.Optional[RequestOptions]
1520
1057
  Request-specific configuration.
1521
1058
 
1522
1059
  Returns
1523
1060
  -------
1524
- IngestResponse
1525
- Document successfully deleted
1061
+ ProcessesStatusResponse
1062
+ Look up success
1526
1063
 
1527
1064
  Examples
1528
1065
  --------
@@ -1536,48 +1073,13 @@ class AsyncDocumentsClient:
1536
1073
 
1537
1074
 
1538
1075
  async def main() -> None:
1539
- await client.documents.delete_by_id(
1540
- document_id="documentId",
1076
+ await client.documents.get_processes(
1077
+ n=1,
1078
+ status="queued",
1541
1079
  )
1542
1080
 
1543
1081
 
1544
1082
  asyncio.run(main())
1545
1083
  """
1546
- _response = await self._client_wrapper.httpx_client.request(
1547
- f"v1/ingest/document/{jsonable_encoder(document_id)}",
1548
- method="DELETE",
1549
- request_options=request_options,
1550
- )
1551
- try:
1552
- if 200 <= _response.status_code < 300:
1553
- return typing.cast(
1554
- IngestResponse,
1555
- parse_obj_as(
1556
- type_=IngestResponse, # type: ignore
1557
- object_=_response.json(),
1558
- ),
1559
- )
1560
- if _response.status_code == 400:
1561
- raise BadRequestError(
1562
- typing.cast(
1563
- typing.Optional[typing.Any],
1564
- parse_obj_as(
1565
- type_=typing.Optional[typing.Any], # type: ignore
1566
- object_=_response.json(),
1567
- ),
1568
- )
1569
- )
1570
- if _response.status_code == 401:
1571
- raise UnauthorizedError(
1572
- typing.cast(
1573
- typing.Optional[typing.Any],
1574
- parse_obj_as(
1575
- type_=typing.Optional[typing.Any], # type: ignore
1576
- object_=_response.json(),
1577
- ),
1578
- )
1579
- )
1580
- _response_json = _response.json()
1581
- except JSONDecodeError:
1582
- raise ApiError(status_code=_response.status_code, body=_response.text)
1583
- raise ApiError(status_code=_response.status_code, body=_response_json)
1084
+ _response = await self._raw_client.get_processes(n=n, status=status, request_options=request_options)
1085
+ return _response.data