groundx 2.0.16__py3-none-any.whl → 2.0.18__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.
- groundx/__init__.py +2 -0
- groundx/core/client_wrapper.py +1 -1
- groundx/documents/client.py +477 -280
- groundx/types/__init__.py +2 -0
- groundx/types/ingest_document.py +45 -0
- {groundx-2.0.16.dist-info → groundx-2.0.18.dist-info}/METADATA +12 -12
- {groundx-2.0.16.dist-info → groundx-2.0.18.dist-info}/RECORD +9 -8
- {groundx-2.0.16.dist-info → groundx-2.0.18.dist-info}/LICENSE +0 -0
- {groundx-2.0.16.dist-info → groundx-2.0.18.dist-info}/WHEEL +0 -0
groundx/__init__.py
CHANGED
@@ -22,6 +22,7 @@ from .types import (
|
|
22
22
|
HealthResponseHealth,
|
23
23
|
HealthService,
|
24
24
|
HealthServiceStatus,
|
25
|
+
IngestDocument,
|
25
26
|
IngestLocalDocument,
|
26
27
|
IngestRemoteDocument,
|
27
28
|
IngestResponse,
|
@@ -77,6 +78,7 @@ __all__ = [
|
|
77
78
|
"HealthResponseHealth",
|
78
79
|
"HealthService",
|
79
80
|
"HealthServiceStatus",
|
81
|
+
"IngestDocument",
|
80
82
|
"IngestLocalDocument",
|
81
83
|
"IngestRemoteDocument",
|
82
84
|
"IngestResponse",
|
groundx/core/client_wrapper.py
CHANGED
groundx/documents/client.py
CHANGED
@@ -2,24 +2,25 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
5
|
-
from ..types.
|
5
|
+
from ..types.sort import Sort
|
6
|
+
from ..types.sort_order import SortOrder
|
7
|
+
from ..types.processing_status import ProcessingStatus
|
6
8
|
from ..core.request_options import RequestOptions
|
9
|
+
from ..types.document_list_response import DocumentListResponse
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
11
|
+
from json.decoder import JSONDecodeError
|
12
|
+
from ..core.api_error import ApiError
|
13
|
+
from ..types.ingest_document import IngestDocument
|
7
14
|
from ..types.ingest_response import IngestResponse
|
8
15
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
9
|
-
from ..core.pydantic_utilities import parse_obj_as
|
10
16
|
from ..errors.bad_request_error import BadRequestError
|
11
17
|
from ..errors.unauthorized_error import UnauthorizedError
|
12
|
-
from
|
13
|
-
from ..core.api_error import ApiError
|
18
|
+
from ..types.ingest_remote_document import IngestRemoteDocument
|
14
19
|
from ..types.ingest_local_document import IngestLocalDocument
|
15
20
|
from ..types.crawl_website_source import CrawlWebsiteSource
|
16
21
|
from ..types.process_status_response import ProcessStatusResponse
|
17
22
|
from ..core.jsonable_encoder import jsonable_encoder
|
18
|
-
from ..types.sort import Sort
|
19
|
-
from ..types.sort_order import SortOrder
|
20
|
-
from ..types.processing_status import ProcessingStatus
|
21
23
|
from ..types.document_lookup_response import DocumentLookupResponse
|
22
|
-
from ..types.document_list_response import DocumentListResponse
|
23
24
|
from ..types.document_response import DocumentResponse
|
24
25
|
from ..core.client_wrapper import AsyncClientWrapper
|
25
26
|
|
@@ -31,6 +32,248 @@ class DocumentsClient:
|
|
31
32
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
32
33
|
self._client_wrapper = client_wrapper
|
33
34
|
|
35
|
+
def list(
|
36
|
+
self,
|
37
|
+
*,
|
38
|
+
n: typing.Optional[int] = None,
|
39
|
+
filter: typing.Optional[str] = None,
|
40
|
+
sort: typing.Optional[Sort] = None,
|
41
|
+
sort_order: typing.Optional[SortOrder] = None,
|
42
|
+
status: typing.Optional[ProcessingStatus] = None,
|
43
|
+
next_token: typing.Optional[str] = None,
|
44
|
+
request_options: typing.Optional[RequestOptions] = None,
|
45
|
+
) -> DocumentListResponse:
|
46
|
+
"""
|
47
|
+
lookup all documents across all resources which are currently on GroundX
|
48
|
+
|
49
|
+
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
|
+
|
51
|
+
Parameters
|
52
|
+
----------
|
53
|
+
n : typing.Optional[int]
|
54
|
+
The maximum number of returned documents. Accepts 1-100 with a default of 20.
|
55
|
+
|
56
|
+
filter : typing.Optional[str]
|
57
|
+
Only documents with names that contain the filter string will be returned in the results.
|
58
|
+
|
59
|
+
sort : typing.Optional[Sort]
|
60
|
+
The document attribute that will be used to sort the results.
|
61
|
+
|
62
|
+
sort_order : typing.Optional[SortOrder]
|
63
|
+
The order in which to sort the results. A value for sort must also be set.
|
64
|
+
|
65
|
+
status : typing.Optional[ProcessingStatus]
|
66
|
+
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.
|
67
|
+
|
68
|
+
next_token : typing.Optional[str]
|
69
|
+
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.
|
70
|
+
|
71
|
+
request_options : typing.Optional[RequestOptions]
|
72
|
+
Request-specific configuration.
|
73
|
+
|
74
|
+
Returns
|
75
|
+
-------
|
76
|
+
DocumentListResponse
|
77
|
+
Look up success
|
78
|
+
|
79
|
+
Examples
|
80
|
+
--------
|
81
|
+
from groundx import GroundX
|
82
|
+
|
83
|
+
client = GroundX(
|
84
|
+
api_key="YOUR_API_KEY",
|
85
|
+
)
|
86
|
+
client.documents.list()
|
87
|
+
"""
|
88
|
+
_response = self._client_wrapper.httpx_client.request(
|
89
|
+
"v1/ingest/documents",
|
90
|
+
method="GET",
|
91
|
+
params={
|
92
|
+
"n": n,
|
93
|
+
"filter": filter,
|
94
|
+
"sort": sort,
|
95
|
+
"sortOrder": sort_order,
|
96
|
+
"status": status,
|
97
|
+
"nextToken": next_token,
|
98
|
+
},
|
99
|
+
request_options=request_options,
|
100
|
+
)
|
101
|
+
try:
|
102
|
+
if 200 <= _response.status_code < 300:
|
103
|
+
return typing.cast(
|
104
|
+
DocumentListResponse,
|
105
|
+
parse_obj_as(
|
106
|
+
type_=DocumentListResponse, # type: ignore
|
107
|
+
object_=_response.json(),
|
108
|
+
),
|
109
|
+
)
|
110
|
+
_response_json = _response.json()
|
111
|
+
except JSONDecodeError:
|
112
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
113
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
114
|
+
|
115
|
+
def document_ingest(
|
116
|
+
self, *, documents: typing.Sequence[IngestDocument], request_options: typing.Optional[RequestOptions] = None
|
117
|
+
) -> IngestResponse:
|
118
|
+
"""
|
119
|
+
Ingest documents hosted on public URLs or a local file system for ingestion into a GroundX bucket.
|
120
|
+
|
121
|
+
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.
|
122
|
+
|
123
|
+
Parameters
|
124
|
+
----------
|
125
|
+
documents : typing.Sequence[IngestDocument]
|
126
|
+
|
127
|
+
request_options : typing.Optional[RequestOptions]
|
128
|
+
Request-specific configuration.
|
129
|
+
|
130
|
+
Returns
|
131
|
+
-------
|
132
|
+
IngestResponse
|
133
|
+
Documents successfully uploaded
|
134
|
+
|
135
|
+
Examples
|
136
|
+
--------
|
137
|
+
from groundx import GroundX, IngestDocument
|
138
|
+
|
139
|
+
client = GroundX(
|
140
|
+
api_key="YOUR_API_KEY",
|
141
|
+
)
|
142
|
+
client.documents.document_ingest(
|
143
|
+
documents=[
|
144
|
+
IngestDocument(
|
145
|
+
bucket_id=1234,
|
146
|
+
file_name="my_file.txt",
|
147
|
+
file_path="https://my.source.url.com/file.txt",
|
148
|
+
file_type="txt",
|
149
|
+
search_data={"key": "value"},
|
150
|
+
)
|
151
|
+
],
|
152
|
+
)
|
153
|
+
"""
|
154
|
+
_response = self._client_wrapper.httpx_client.request(
|
155
|
+
"v1/ingest/documents",
|
156
|
+
method="POST",
|
157
|
+
json={
|
158
|
+
"documents": convert_and_respect_annotation_metadata(
|
159
|
+
object_=documents, annotation=typing.Sequence[IngestDocument], direction="write"
|
160
|
+
),
|
161
|
+
},
|
162
|
+
headers={
|
163
|
+
"content-type": "application/json",
|
164
|
+
},
|
165
|
+
request_options=request_options,
|
166
|
+
omit=OMIT,
|
167
|
+
)
|
168
|
+
try:
|
169
|
+
if 200 <= _response.status_code < 300:
|
170
|
+
return typing.cast(
|
171
|
+
IngestResponse,
|
172
|
+
parse_obj_as(
|
173
|
+
type_=IngestResponse, # type: ignore
|
174
|
+
object_=_response.json(),
|
175
|
+
),
|
176
|
+
)
|
177
|
+
if _response.status_code == 400:
|
178
|
+
raise BadRequestError(
|
179
|
+
typing.cast(
|
180
|
+
typing.Optional[typing.Any],
|
181
|
+
parse_obj_as(
|
182
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
183
|
+
object_=_response.json(),
|
184
|
+
),
|
185
|
+
)
|
186
|
+
)
|
187
|
+
if _response.status_code == 401:
|
188
|
+
raise UnauthorizedError(
|
189
|
+
typing.cast(
|
190
|
+
typing.Optional[typing.Any],
|
191
|
+
parse_obj_as(
|
192
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
193
|
+
object_=_response.json(),
|
194
|
+
),
|
195
|
+
)
|
196
|
+
)
|
197
|
+
_response_json = _response.json()
|
198
|
+
except JSONDecodeError:
|
199
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
200
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
201
|
+
|
202
|
+
def delete(
|
203
|
+
self,
|
204
|
+
*,
|
205
|
+
document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
206
|
+
request_options: typing.Optional[RequestOptions] = None,
|
207
|
+
) -> IngestResponse:
|
208
|
+
"""
|
209
|
+
Delete multiple documents hosted on GroundX
|
210
|
+
|
211
|
+
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.
|
212
|
+
|
213
|
+
Parameters
|
214
|
+
----------
|
215
|
+
document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
216
|
+
A list of documentIds which correspond to documents ingested by GroundX
|
217
|
+
|
218
|
+
request_options : typing.Optional[RequestOptions]
|
219
|
+
Request-specific configuration.
|
220
|
+
|
221
|
+
Returns
|
222
|
+
-------
|
223
|
+
IngestResponse
|
224
|
+
Documents are queued to be deleted
|
225
|
+
|
226
|
+
Examples
|
227
|
+
--------
|
228
|
+
from groundx import GroundX
|
229
|
+
|
230
|
+
client = GroundX(
|
231
|
+
api_key="YOUR_API_KEY",
|
232
|
+
)
|
233
|
+
client.documents.delete()
|
234
|
+
"""
|
235
|
+
_response = self._client_wrapper.httpx_client.request(
|
236
|
+
"v1/ingest/documents",
|
237
|
+
method="DELETE",
|
238
|
+
params={
|
239
|
+
"documentIds": document_ids,
|
240
|
+
},
|
241
|
+
request_options=request_options,
|
242
|
+
)
|
243
|
+
try:
|
244
|
+
if 200 <= _response.status_code < 300:
|
245
|
+
return typing.cast(
|
246
|
+
IngestResponse,
|
247
|
+
parse_obj_as(
|
248
|
+
type_=IngestResponse, # type: ignore
|
249
|
+
object_=_response.json(),
|
250
|
+
),
|
251
|
+
)
|
252
|
+
if _response.status_code == 400:
|
253
|
+
raise BadRequestError(
|
254
|
+
typing.cast(
|
255
|
+
typing.Optional[typing.Any],
|
256
|
+
parse_obj_as(
|
257
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
258
|
+
object_=_response.json(),
|
259
|
+
),
|
260
|
+
)
|
261
|
+
)
|
262
|
+
if _response.status_code == 401:
|
263
|
+
raise UnauthorizedError(
|
264
|
+
typing.cast(
|
265
|
+
typing.Optional[typing.Any],
|
266
|
+
parse_obj_as(
|
267
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
268
|
+
object_=_response.json(),
|
269
|
+
),
|
270
|
+
)
|
271
|
+
)
|
272
|
+
_response_json = _response.json()
|
273
|
+
except JSONDecodeError:
|
274
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
275
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
276
|
+
|
34
277
|
def ingest_remote(
|
35
278
|
self,
|
36
279
|
*,
|
@@ -122,7 +365,10 @@ class DocumentsClient:
|
|
122
365
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
123
366
|
|
124
367
|
def ingest_local(
|
125
|
-
self,
|
368
|
+
self,
|
369
|
+
*,
|
370
|
+
documents: typing.Optional[typing.List[IngestLocalDocument]] = OMIT,
|
371
|
+
request_options: typing.Optional[RequestOptions] = None,
|
126
372
|
) -> IngestResponse:
|
127
373
|
"""
|
128
374
|
Upload documents hosted on a local file system for ingestion into a GroundX bucket.
|
@@ -131,7 +377,7 @@ class DocumentsClient:
|
|
131
377
|
|
132
378
|
Parameters
|
133
379
|
----------
|
134
|
-
|
380
|
+
documents : typing.Optional[typing.List[IngestLocalDocument]]
|
135
381
|
|
136
382
|
request_options : typing.Optional[RequestOptions]
|
137
383
|
Request-specific configuration.
|
@@ -149,12 +395,13 @@ class DocumentsClient:
|
|
149
395
|
api_key="YOUR_API_KEY",
|
150
396
|
)
|
151
397
|
client.documents.ingest_local(
|
152
|
-
|
398
|
+
documents=[
|
153
399
|
IngestLocalDocument(
|
154
400
|
bucket_id=1234,
|
155
|
-
file_data="binary data
|
401
|
+
file_data="binary data",
|
156
402
|
file_name="my_file.txt",
|
157
403
|
file_type="txt",
|
404
|
+
search_data={"key": "value"},
|
158
405
|
)
|
159
406
|
],
|
160
407
|
)
|
@@ -163,7 +410,7 @@ class DocumentsClient:
|
|
163
410
|
"v1/ingest/documents/local",
|
164
411
|
method="POST",
|
165
412
|
data={
|
166
|
-
"
|
413
|
+
"documents": documents,
|
167
414
|
},
|
168
415
|
files={},
|
169
416
|
request_options=request_options,
|
@@ -233,7 +480,10 @@ class DocumentsClient:
|
|
233
480
|
client.documents.crawl_website(
|
234
481
|
websites=[
|
235
482
|
CrawlWebsiteSource(
|
236
|
-
bucket_id=
|
483
|
+
bucket_id=1234,
|
484
|
+
cap=100,
|
485
|
+
depth=3,
|
486
|
+
search_data={"key": "value"},
|
237
487
|
source_url="https://my.website.com",
|
238
488
|
)
|
239
489
|
],
|
@@ -464,48 +714,23 @@ class DocumentsClient:
|
|
464
714
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
465
715
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
466
716
|
|
467
|
-
def
|
468
|
-
self,
|
469
|
-
*,
|
470
|
-
n: typing.Optional[int] = None,
|
471
|
-
filter: typing.Optional[str] = None,
|
472
|
-
sort: typing.Optional[Sort] = None,
|
473
|
-
sort_order: typing.Optional[SortOrder] = None,
|
474
|
-
status: typing.Optional[ProcessingStatus] = None,
|
475
|
-
next_token: typing.Optional[str] = None,
|
476
|
-
request_options: typing.Optional[RequestOptions] = None,
|
477
|
-
) -> DocumentListResponse:
|
717
|
+
def get(self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentResponse:
|
478
718
|
"""
|
479
|
-
|
719
|
+
Look up an existing document by documentId.
|
480
720
|
|
481
721
|
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.
|
482
722
|
|
483
723
|
Parameters
|
484
724
|
----------
|
485
|
-
|
486
|
-
The
|
487
|
-
|
488
|
-
filter : typing.Optional[str]
|
489
|
-
Only documents with names that contain the filter string will be returned in the results.
|
490
|
-
|
491
|
-
sort : typing.Optional[Sort]
|
492
|
-
The document attribute that will be used to sort the results.
|
493
|
-
|
494
|
-
sort_order : typing.Optional[SortOrder]
|
495
|
-
The order in which to sort the results. A value for sort must also be set.
|
496
|
-
|
497
|
-
status : typing.Optional[ProcessingStatus]
|
498
|
-
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.
|
499
|
-
|
500
|
-
next_token : typing.Optional[str]
|
501
|
-
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.
|
725
|
+
document_id : str
|
726
|
+
The documentId of the document for which GroundX information will be provided.
|
502
727
|
|
503
728
|
request_options : typing.Optional[RequestOptions]
|
504
729
|
Request-specific configuration.
|
505
730
|
|
506
731
|
Returns
|
507
732
|
-------
|
508
|
-
|
733
|
+
DocumentResponse
|
509
734
|
Look up success
|
510
735
|
|
511
736
|
Examples
|
@@ -515,50 +740,61 @@ class DocumentsClient:
|
|
515
740
|
client = GroundX(
|
516
741
|
api_key="YOUR_API_KEY",
|
517
742
|
)
|
518
|
-
client.documents.
|
743
|
+
client.documents.get(
|
744
|
+
document_id="documentId",
|
745
|
+
)
|
519
746
|
"""
|
520
747
|
_response = self._client_wrapper.httpx_client.request(
|
521
|
-
"v1/ingest/
|
748
|
+
f"v1/ingest/document/{jsonable_encoder(document_id)}",
|
522
749
|
method="GET",
|
523
|
-
params={
|
524
|
-
"n": n,
|
525
|
-
"filter": filter,
|
526
|
-
"sort": sort,
|
527
|
-
"sortOrder": sort_order,
|
528
|
-
"status": status,
|
529
|
-
"nextToken": next_token,
|
530
|
-
},
|
531
750
|
request_options=request_options,
|
532
751
|
)
|
533
752
|
try:
|
534
753
|
if 200 <= _response.status_code < 300:
|
535
754
|
return typing.cast(
|
536
|
-
|
755
|
+
DocumentResponse,
|
537
756
|
parse_obj_as(
|
538
|
-
type_=
|
757
|
+
type_=DocumentResponse, # type: ignore
|
539
758
|
object_=_response.json(),
|
540
759
|
),
|
541
760
|
)
|
761
|
+
if _response.status_code == 400:
|
762
|
+
raise BadRequestError(
|
763
|
+
typing.cast(
|
764
|
+
typing.Optional[typing.Any],
|
765
|
+
parse_obj_as(
|
766
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
767
|
+
object_=_response.json(),
|
768
|
+
),
|
769
|
+
)
|
770
|
+
)
|
771
|
+
if _response.status_code == 401:
|
772
|
+
raise UnauthorizedError(
|
773
|
+
typing.cast(
|
774
|
+
typing.Optional[typing.Any],
|
775
|
+
parse_obj_as(
|
776
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
777
|
+
object_=_response.json(),
|
778
|
+
),
|
779
|
+
)
|
780
|
+
)
|
542
781
|
_response_json = _response.json()
|
543
782
|
except JSONDecodeError:
|
544
783
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
545
784
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
546
785
|
|
547
|
-
def
|
548
|
-
self,
|
549
|
-
*,
|
550
|
-
document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
551
|
-
request_options: typing.Optional[RequestOptions] = None,
|
786
|
+
def delete_by_id(
|
787
|
+
self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
552
788
|
) -> IngestResponse:
|
553
789
|
"""
|
554
|
-
Delete
|
790
|
+
Delete a single document hosted on GroundX
|
555
791
|
|
556
792
|
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.
|
557
793
|
|
558
794
|
Parameters
|
559
795
|
----------
|
560
|
-
|
561
|
-
A
|
796
|
+
document_id : str
|
797
|
+
A documentId which correspond to a document ingested by GroundX
|
562
798
|
|
563
799
|
request_options : typing.Optional[RequestOptions]
|
564
800
|
Request-specific configuration.
|
@@ -566,7 +802,7 @@ class DocumentsClient:
|
|
566
802
|
Returns
|
567
803
|
-------
|
568
804
|
IngestResponse
|
569
|
-
|
805
|
+
Document successfully deleted
|
570
806
|
|
571
807
|
Examples
|
572
808
|
--------
|
@@ -575,14 +811,13 @@ class DocumentsClient:
|
|
575
811
|
client = GroundX(
|
576
812
|
api_key="YOUR_API_KEY",
|
577
813
|
)
|
578
|
-
client.documents.
|
814
|
+
client.documents.delete_by_id(
|
815
|
+
document_id="documentId",
|
816
|
+
)
|
579
817
|
"""
|
580
818
|
_response = self._client_wrapper.httpx_client.request(
|
581
|
-
"v1/ingest/
|
819
|
+
f"v1/ingest/document/{jsonable_encoder(document_id)}",
|
582
820
|
method="DELETE",
|
583
|
-
params={
|
584
|
-
"documentIds": document_ids,
|
585
|
-
},
|
586
821
|
request_options=request_options,
|
587
822
|
)
|
588
823
|
try:
|
@@ -619,47 +854,166 @@ class DocumentsClient:
|
|
619
854
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
620
855
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
621
856
|
|
622
|
-
|
857
|
+
|
858
|
+
class AsyncDocumentsClient:
|
859
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
860
|
+
self._client_wrapper = client_wrapper
|
861
|
+
|
862
|
+
async def list(
|
863
|
+
self,
|
864
|
+
*,
|
865
|
+
n: typing.Optional[int] = None,
|
866
|
+
filter: typing.Optional[str] = None,
|
867
|
+
sort: typing.Optional[Sort] = None,
|
868
|
+
sort_order: typing.Optional[SortOrder] = None,
|
869
|
+
status: typing.Optional[ProcessingStatus] = None,
|
870
|
+
next_token: typing.Optional[str] = None,
|
871
|
+
request_options: typing.Optional[RequestOptions] = None,
|
872
|
+
) -> DocumentListResponse:
|
623
873
|
"""
|
624
|
-
|
874
|
+
lookup all documents across all resources which are currently on GroundX
|
625
875
|
|
626
876
|
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.
|
627
877
|
|
628
878
|
Parameters
|
629
879
|
----------
|
630
|
-
|
631
|
-
The
|
880
|
+
n : typing.Optional[int]
|
881
|
+
The maximum number of returned documents. Accepts 1-100 with a default of 20.
|
882
|
+
|
883
|
+
filter : typing.Optional[str]
|
884
|
+
Only documents with names that contain the filter string will be returned in the results.
|
885
|
+
|
886
|
+
sort : typing.Optional[Sort]
|
887
|
+
The document attribute that will be used to sort the results.
|
888
|
+
|
889
|
+
sort_order : typing.Optional[SortOrder]
|
890
|
+
The order in which to sort the results. A value for sort must also be set.
|
891
|
+
|
892
|
+
status : typing.Optional[ProcessingStatus]
|
893
|
+
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.
|
894
|
+
|
895
|
+
next_token : typing.Optional[str]
|
896
|
+
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.
|
632
897
|
|
633
898
|
request_options : typing.Optional[RequestOptions]
|
634
899
|
Request-specific configuration.
|
635
900
|
|
636
901
|
Returns
|
637
902
|
-------
|
638
|
-
|
903
|
+
DocumentListResponse
|
639
904
|
Look up success
|
640
905
|
|
641
906
|
Examples
|
642
907
|
--------
|
643
|
-
|
908
|
+
import asyncio
|
644
909
|
|
645
|
-
|
910
|
+
from groundx import AsyncGroundX
|
911
|
+
|
912
|
+
client = AsyncGroundX(
|
913
|
+
api_key="YOUR_API_KEY",
|
914
|
+
)
|
915
|
+
|
916
|
+
|
917
|
+
async def main() -> None:
|
918
|
+
await client.documents.list()
|
919
|
+
|
920
|
+
|
921
|
+
asyncio.run(main())
|
922
|
+
"""
|
923
|
+
_response = await self._client_wrapper.httpx_client.request(
|
924
|
+
"v1/ingest/documents",
|
925
|
+
method="GET",
|
926
|
+
params={
|
927
|
+
"n": n,
|
928
|
+
"filter": filter,
|
929
|
+
"sort": sort,
|
930
|
+
"sortOrder": sort_order,
|
931
|
+
"status": status,
|
932
|
+
"nextToken": next_token,
|
933
|
+
},
|
934
|
+
request_options=request_options,
|
935
|
+
)
|
936
|
+
try:
|
937
|
+
if 200 <= _response.status_code < 300:
|
938
|
+
return typing.cast(
|
939
|
+
DocumentListResponse,
|
940
|
+
parse_obj_as(
|
941
|
+
type_=DocumentListResponse, # type: ignore
|
942
|
+
object_=_response.json(),
|
943
|
+
),
|
944
|
+
)
|
945
|
+
_response_json = _response.json()
|
946
|
+
except JSONDecodeError:
|
947
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
948
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
949
|
+
|
950
|
+
async def document_ingest(
|
951
|
+
self, *, documents: typing.Sequence[IngestDocument], request_options: typing.Optional[RequestOptions] = None
|
952
|
+
) -> IngestResponse:
|
953
|
+
"""
|
954
|
+
Ingest documents hosted on public URLs or a local file system for ingestion into a GroundX bucket.
|
955
|
+
|
956
|
+
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.
|
957
|
+
|
958
|
+
Parameters
|
959
|
+
----------
|
960
|
+
documents : typing.Sequence[IngestDocument]
|
961
|
+
|
962
|
+
request_options : typing.Optional[RequestOptions]
|
963
|
+
Request-specific configuration.
|
964
|
+
|
965
|
+
Returns
|
966
|
+
-------
|
967
|
+
IngestResponse
|
968
|
+
Documents successfully uploaded
|
969
|
+
|
970
|
+
Examples
|
971
|
+
--------
|
972
|
+
import asyncio
|
973
|
+
|
974
|
+
from groundx import AsyncGroundX, IngestDocument
|
975
|
+
|
976
|
+
client = AsyncGroundX(
|
646
977
|
api_key="YOUR_API_KEY",
|
647
978
|
)
|
648
|
-
|
649
|
-
|
650
|
-
)
|
979
|
+
|
980
|
+
|
981
|
+
async def main() -> None:
|
982
|
+
await client.documents.document_ingest(
|
983
|
+
documents=[
|
984
|
+
IngestDocument(
|
985
|
+
bucket_id=1234,
|
986
|
+
file_name="my_file.txt",
|
987
|
+
file_path="https://my.source.url.com/file.txt",
|
988
|
+
file_type="txt",
|
989
|
+
search_data={"key": "value"},
|
990
|
+
)
|
991
|
+
],
|
992
|
+
)
|
993
|
+
|
994
|
+
|
995
|
+
asyncio.run(main())
|
651
996
|
"""
|
652
|
-
_response = self._client_wrapper.httpx_client.request(
|
653
|
-
|
654
|
-
method="
|
997
|
+
_response = await self._client_wrapper.httpx_client.request(
|
998
|
+
"v1/ingest/documents",
|
999
|
+
method="POST",
|
1000
|
+
json={
|
1001
|
+
"documents": convert_and_respect_annotation_metadata(
|
1002
|
+
object_=documents, annotation=typing.Sequence[IngestDocument], direction="write"
|
1003
|
+
),
|
1004
|
+
},
|
1005
|
+
headers={
|
1006
|
+
"content-type": "application/json",
|
1007
|
+
},
|
655
1008
|
request_options=request_options,
|
1009
|
+
omit=OMIT,
|
656
1010
|
)
|
657
1011
|
try:
|
658
1012
|
if 200 <= _response.status_code < 300:
|
659
1013
|
return typing.cast(
|
660
|
-
|
1014
|
+
IngestResponse,
|
661
1015
|
parse_obj_as(
|
662
|
-
type_=
|
1016
|
+
type_=IngestResponse, # type: ignore
|
663
1017
|
object_=_response.json(),
|
664
1018
|
),
|
665
1019
|
)
|
@@ -688,18 +1042,21 @@ class DocumentsClient:
|
|
688
1042
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
689
1043
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
690
1044
|
|
691
|
-
def
|
692
|
-
self,
|
1045
|
+
async def delete(
|
1046
|
+
self,
|
1047
|
+
*,
|
1048
|
+
document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
1049
|
+
request_options: typing.Optional[RequestOptions] = None,
|
693
1050
|
) -> IngestResponse:
|
694
1051
|
"""
|
695
|
-
Delete
|
1052
|
+
Delete multiple documents hosted on GroundX
|
696
1053
|
|
697
1054
|
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.
|
698
1055
|
|
699
1056
|
Parameters
|
700
1057
|
----------
|
701
|
-
|
702
|
-
A
|
1058
|
+
document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
1059
|
+
A list of documentIds which correspond to documents ingested by GroundX
|
703
1060
|
|
704
1061
|
request_options : typing.Optional[RequestOptions]
|
705
1062
|
Request-specific configuration.
|
@@ -707,22 +1064,31 @@ class DocumentsClient:
|
|
707
1064
|
Returns
|
708
1065
|
-------
|
709
1066
|
IngestResponse
|
710
|
-
|
1067
|
+
Documents are queued to be deleted
|
711
1068
|
|
712
1069
|
Examples
|
713
1070
|
--------
|
714
|
-
|
1071
|
+
import asyncio
|
715
1072
|
|
716
|
-
|
1073
|
+
from groundx import AsyncGroundX
|
1074
|
+
|
1075
|
+
client = AsyncGroundX(
|
717
1076
|
api_key="YOUR_API_KEY",
|
718
1077
|
)
|
719
|
-
|
720
|
-
|
721
|
-
)
|
1078
|
+
|
1079
|
+
|
1080
|
+
async def main() -> None:
|
1081
|
+
await client.documents.delete()
|
1082
|
+
|
1083
|
+
|
1084
|
+
asyncio.run(main())
|
722
1085
|
"""
|
723
|
-
_response = self._client_wrapper.httpx_client.request(
|
724
|
-
|
1086
|
+
_response = await self._client_wrapper.httpx_client.request(
|
1087
|
+
"v1/ingest/documents",
|
725
1088
|
method="DELETE",
|
1089
|
+
params={
|
1090
|
+
"documentIds": document_ids,
|
1091
|
+
},
|
726
1092
|
request_options=request_options,
|
727
1093
|
)
|
728
1094
|
try:
|
@@ -759,11 +1125,6 @@ class DocumentsClient:
|
|
759
1125
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
760
1126
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
761
1127
|
|
762
|
-
|
763
|
-
class AsyncDocumentsClient:
|
764
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
765
|
-
self._client_wrapper = client_wrapper
|
766
|
-
|
767
1128
|
async def ingest_remote(
|
768
1129
|
self,
|
769
1130
|
*,
|
@@ -863,7 +1224,10 @@ class AsyncDocumentsClient:
|
|
863
1224
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
864
1225
|
|
865
1226
|
async def ingest_local(
|
866
|
-
self,
|
1227
|
+
self,
|
1228
|
+
*,
|
1229
|
+
documents: typing.Optional[typing.List[IngestLocalDocument]] = OMIT,
|
1230
|
+
request_options: typing.Optional[RequestOptions] = None,
|
867
1231
|
) -> IngestResponse:
|
868
1232
|
"""
|
869
1233
|
Upload documents hosted on a local file system for ingestion into a GroundX bucket.
|
@@ -872,7 +1236,7 @@ class AsyncDocumentsClient:
|
|
872
1236
|
|
873
1237
|
Parameters
|
874
1238
|
----------
|
875
|
-
|
1239
|
+
documents : typing.Optional[typing.List[IngestLocalDocument]]
|
876
1240
|
|
877
1241
|
request_options : typing.Optional[RequestOptions]
|
878
1242
|
Request-specific configuration.
|
@@ -895,12 +1259,13 @@ class AsyncDocumentsClient:
|
|
895
1259
|
|
896
1260
|
async def main() -> None:
|
897
1261
|
await client.documents.ingest_local(
|
898
|
-
|
1262
|
+
documents=[
|
899
1263
|
IngestLocalDocument(
|
900
1264
|
bucket_id=1234,
|
901
|
-
file_data="binary data
|
1265
|
+
file_data="binary data",
|
902
1266
|
file_name="my_file.txt",
|
903
1267
|
file_type="txt",
|
1268
|
+
search_data={"key": "value"},
|
904
1269
|
)
|
905
1270
|
],
|
906
1271
|
)
|
@@ -912,7 +1277,7 @@ class AsyncDocumentsClient:
|
|
912
1277
|
"v1/ingest/documents/local",
|
913
1278
|
method="POST",
|
914
1279
|
data={
|
915
|
-
"
|
1280
|
+
"documents": documents,
|
916
1281
|
},
|
917
1282
|
files={},
|
918
1283
|
request_options=request_options,
|
@@ -987,7 +1352,10 @@ class AsyncDocumentsClient:
|
|
987
1352
|
await client.documents.crawl_website(
|
988
1353
|
websites=[
|
989
1354
|
CrawlWebsiteSource(
|
990
|
-
bucket_id=
|
1355
|
+
bucket_id=1234,
|
1356
|
+
cap=100,
|
1357
|
+
depth=3,
|
1358
|
+
search_data={"key": "value"},
|
991
1359
|
source_url="https://my.website.com",
|
992
1360
|
)
|
993
1361
|
],
|
@@ -1237,177 +1605,6 @@ class AsyncDocumentsClient:
|
|
1237
1605
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
1238
1606
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
1239
1607
|
|
1240
|
-
async def list(
|
1241
|
-
self,
|
1242
|
-
*,
|
1243
|
-
n: typing.Optional[int] = None,
|
1244
|
-
filter: typing.Optional[str] = None,
|
1245
|
-
sort: typing.Optional[Sort] = None,
|
1246
|
-
sort_order: typing.Optional[SortOrder] = None,
|
1247
|
-
status: typing.Optional[ProcessingStatus] = None,
|
1248
|
-
next_token: typing.Optional[str] = None,
|
1249
|
-
request_options: typing.Optional[RequestOptions] = None,
|
1250
|
-
) -> DocumentListResponse:
|
1251
|
-
"""
|
1252
|
-
lookup all documents across all resources which are currently on GroundX
|
1253
|
-
|
1254
|
-
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.
|
1255
|
-
|
1256
|
-
Parameters
|
1257
|
-
----------
|
1258
|
-
n : typing.Optional[int]
|
1259
|
-
The maximum number of returned documents. Accepts 1-100 with a default of 20.
|
1260
|
-
|
1261
|
-
filter : typing.Optional[str]
|
1262
|
-
Only documents with names that contain the filter string will be returned in the results.
|
1263
|
-
|
1264
|
-
sort : typing.Optional[Sort]
|
1265
|
-
The document attribute that will be used to sort the results.
|
1266
|
-
|
1267
|
-
sort_order : typing.Optional[SortOrder]
|
1268
|
-
The order in which to sort the results. A value for sort must also be set.
|
1269
|
-
|
1270
|
-
status : typing.Optional[ProcessingStatus]
|
1271
|
-
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.
|
1272
|
-
|
1273
|
-
next_token : typing.Optional[str]
|
1274
|
-
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.
|
1275
|
-
|
1276
|
-
request_options : typing.Optional[RequestOptions]
|
1277
|
-
Request-specific configuration.
|
1278
|
-
|
1279
|
-
Returns
|
1280
|
-
-------
|
1281
|
-
DocumentListResponse
|
1282
|
-
Look up success
|
1283
|
-
|
1284
|
-
Examples
|
1285
|
-
--------
|
1286
|
-
import asyncio
|
1287
|
-
|
1288
|
-
from groundx import AsyncGroundX
|
1289
|
-
|
1290
|
-
client = AsyncGroundX(
|
1291
|
-
api_key="YOUR_API_KEY",
|
1292
|
-
)
|
1293
|
-
|
1294
|
-
|
1295
|
-
async def main() -> None:
|
1296
|
-
await client.documents.list()
|
1297
|
-
|
1298
|
-
|
1299
|
-
asyncio.run(main())
|
1300
|
-
"""
|
1301
|
-
_response = await self._client_wrapper.httpx_client.request(
|
1302
|
-
"v1/ingest/documents",
|
1303
|
-
method="GET",
|
1304
|
-
params={
|
1305
|
-
"n": n,
|
1306
|
-
"filter": filter,
|
1307
|
-
"sort": sort,
|
1308
|
-
"sortOrder": sort_order,
|
1309
|
-
"status": status,
|
1310
|
-
"nextToken": next_token,
|
1311
|
-
},
|
1312
|
-
request_options=request_options,
|
1313
|
-
)
|
1314
|
-
try:
|
1315
|
-
if 200 <= _response.status_code < 300:
|
1316
|
-
return typing.cast(
|
1317
|
-
DocumentListResponse,
|
1318
|
-
parse_obj_as(
|
1319
|
-
type_=DocumentListResponse, # type: ignore
|
1320
|
-
object_=_response.json(),
|
1321
|
-
),
|
1322
|
-
)
|
1323
|
-
_response_json = _response.json()
|
1324
|
-
except JSONDecodeError:
|
1325
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
1326
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
1327
|
-
|
1328
|
-
async def delete(
|
1329
|
-
self,
|
1330
|
-
*,
|
1331
|
-
document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
1332
|
-
request_options: typing.Optional[RequestOptions] = None,
|
1333
|
-
) -> IngestResponse:
|
1334
|
-
"""
|
1335
|
-
Delete multiple documents hosted on GroundX
|
1336
|
-
|
1337
|
-
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.
|
1338
|
-
|
1339
|
-
Parameters
|
1340
|
-
----------
|
1341
|
-
document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
1342
|
-
A list of documentIds which correspond to documents ingested by GroundX
|
1343
|
-
|
1344
|
-
request_options : typing.Optional[RequestOptions]
|
1345
|
-
Request-specific configuration.
|
1346
|
-
|
1347
|
-
Returns
|
1348
|
-
-------
|
1349
|
-
IngestResponse
|
1350
|
-
Documents are queued to be deleted
|
1351
|
-
|
1352
|
-
Examples
|
1353
|
-
--------
|
1354
|
-
import asyncio
|
1355
|
-
|
1356
|
-
from groundx import AsyncGroundX
|
1357
|
-
|
1358
|
-
client = AsyncGroundX(
|
1359
|
-
api_key="YOUR_API_KEY",
|
1360
|
-
)
|
1361
|
-
|
1362
|
-
|
1363
|
-
async def main() -> None:
|
1364
|
-
await client.documents.delete()
|
1365
|
-
|
1366
|
-
|
1367
|
-
asyncio.run(main())
|
1368
|
-
"""
|
1369
|
-
_response = await self._client_wrapper.httpx_client.request(
|
1370
|
-
"v1/ingest/documents",
|
1371
|
-
method="DELETE",
|
1372
|
-
params={
|
1373
|
-
"documentIds": document_ids,
|
1374
|
-
},
|
1375
|
-
request_options=request_options,
|
1376
|
-
)
|
1377
|
-
try:
|
1378
|
-
if 200 <= _response.status_code < 300:
|
1379
|
-
return typing.cast(
|
1380
|
-
IngestResponse,
|
1381
|
-
parse_obj_as(
|
1382
|
-
type_=IngestResponse, # type: ignore
|
1383
|
-
object_=_response.json(),
|
1384
|
-
),
|
1385
|
-
)
|
1386
|
-
if _response.status_code == 400:
|
1387
|
-
raise BadRequestError(
|
1388
|
-
typing.cast(
|
1389
|
-
typing.Optional[typing.Any],
|
1390
|
-
parse_obj_as(
|
1391
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
1392
|
-
object_=_response.json(),
|
1393
|
-
),
|
1394
|
-
)
|
1395
|
-
)
|
1396
|
-
if _response.status_code == 401:
|
1397
|
-
raise UnauthorizedError(
|
1398
|
-
typing.cast(
|
1399
|
-
typing.Optional[typing.Any],
|
1400
|
-
parse_obj_as(
|
1401
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
1402
|
-
object_=_response.json(),
|
1403
|
-
),
|
1404
|
-
)
|
1405
|
-
)
|
1406
|
-
_response_json = _response.json()
|
1407
|
-
except JSONDecodeError:
|
1408
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
1409
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
1410
|
-
|
1411
1608
|
async def get(
|
1412
1609
|
self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
1413
1610
|
) -> DocumentResponse:
|
groundx/types/__init__.py
CHANGED
@@ -21,6 +21,7 @@ from .health_response import HealthResponse
|
|
21
21
|
from .health_response_health import HealthResponseHealth
|
22
22
|
from .health_service import HealthService
|
23
23
|
from .health_service_status import HealthServiceStatus
|
24
|
+
from .ingest_document import IngestDocument
|
24
25
|
from .ingest_local_document import IngestLocalDocument
|
25
26
|
from .ingest_remote_document import IngestRemoteDocument
|
26
27
|
from .ingest_response import IngestResponse
|
@@ -65,6 +66,7 @@ __all__ = [
|
|
65
66
|
"HealthResponseHealth",
|
66
67
|
"HealthService",
|
67
68
|
"HealthServiceStatus",
|
69
|
+
"IngestDocument",
|
68
70
|
"IngestLocalDocument",
|
69
71
|
"IngestRemoteDocument",
|
70
72
|
"IngestResponse",
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from ..core.pydantic_utilities import UniversalBaseModel
|
4
|
+
import typing_extensions
|
5
|
+
from ..core.serialization import FieldMetadata
|
6
|
+
import pydantic
|
7
|
+
import typing
|
8
|
+
from .document_type import DocumentType
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
10
|
+
|
11
|
+
|
12
|
+
class IngestDocument(UniversalBaseModel):
|
13
|
+
bucket_id: typing_extensions.Annotated[int, FieldMetadata(alias="bucketId")] = pydantic.Field()
|
14
|
+
"""
|
15
|
+
the bucketId of the bucket which this remote file will be ingested to.
|
16
|
+
"""
|
17
|
+
|
18
|
+
file_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="fileName")] = pydantic.Field(
|
19
|
+
default=None
|
20
|
+
)
|
21
|
+
"""
|
22
|
+
The name of the file being ingested
|
23
|
+
"""
|
24
|
+
|
25
|
+
file_path: typing_extensions.Annotated[str, FieldMetadata(alias="filePath")] = pydantic.Field()
|
26
|
+
"""
|
27
|
+
The local file path or remote URL of the document being ingested by GroundX.
|
28
|
+
"""
|
29
|
+
|
30
|
+
file_type: typing_extensions.Annotated[typing.Optional[DocumentType], FieldMetadata(alias="fileType")] = None
|
31
|
+
search_data: typing_extensions.Annotated[
|
32
|
+
typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="searchData")
|
33
|
+
] = pydantic.Field(default=None)
|
34
|
+
"""
|
35
|
+
Custom metadata which can be used to influence GroundX's search functionality. This data can be used to further hone GroundX search.
|
36
|
+
"""
|
37
|
+
|
38
|
+
if IS_PYDANTIC_V2:
|
39
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
40
|
+
else:
|
41
|
+
|
42
|
+
class Config:
|
43
|
+
frozen = True
|
44
|
+
smart_union = True
|
45
|
+
extra = pydantic.Extra.allow
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: groundx
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.18
|
4
4
|
Summary:
|
5
5
|
License: MIT
|
6
6
|
Requires-Python: >=3.8,<4.0
|
@@ -52,19 +52,19 @@ A full reference for this library is available [here](./reference.md).
|
|
52
52
|
Instantiate and use the client with the following:
|
53
53
|
|
54
54
|
```python
|
55
|
-
from groundx import GroundX,
|
55
|
+
from groundx import GroundX, IngestDocument
|
56
56
|
|
57
57
|
client = GroundX(
|
58
58
|
api_key="YOUR_API_KEY",
|
59
59
|
)
|
60
|
-
client.documents.
|
60
|
+
client.documents.document_ingest(
|
61
61
|
documents=[
|
62
|
-
|
62
|
+
IngestDocument(
|
63
63
|
bucket_id=1234,
|
64
64
|
file_name="my_file.txt",
|
65
|
+
file_path="https://my.source.url.com/file.txt",
|
65
66
|
file_type="txt",
|
66
67
|
search_data={"key": "value"},
|
67
|
-
source_url="https://my.source.url.com/file.txt",
|
68
68
|
)
|
69
69
|
],
|
70
70
|
)
|
@@ -77,7 +77,7 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
|
|
77
77
|
```python
|
78
78
|
import asyncio
|
79
79
|
|
80
|
-
from groundx import AsyncGroundX,
|
80
|
+
from groundx import AsyncGroundX, IngestDocument
|
81
81
|
|
82
82
|
client = AsyncGroundX(
|
83
83
|
api_key="YOUR_API_KEY",
|
@@ -85,14 +85,14 @@ client = AsyncGroundX(
|
|
85
85
|
|
86
86
|
|
87
87
|
async def main() -> None:
|
88
|
-
await client.documents.
|
88
|
+
await client.documents.document_ingest(
|
89
89
|
documents=[
|
90
|
-
|
90
|
+
IngestDocument(
|
91
91
|
bucket_id=1234,
|
92
92
|
file_name="my_file.txt",
|
93
|
+
file_path="https://my.source.url.com/file.txt",
|
93
94
|
file_type="txt",
|
94
95
|
search_data={"key": "value"},
|
95
|
-
source_url="https://my.source.url.com/file.txt",
|
96
96
|
)
|
97
97
|
],
|
98
98
|
)
|
@@ -110,7 +110,7 @@ will be thrown.
|
|
110
110
|
from groundx.core.api_error import ApiError
|
111
111
|
|
112
112
|
try:
|
113
|
-
client.documents.
|
113
|
+
client.documents.document_ingest(...)
|
114
114
|
except ApiError as e:
|
115
115
|
print(e.status_code)
|
116
116
|
print(e.body)
|
@@ -133,7 +133,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
|
|
133
133
|
Use the `max_retries` request option to configure this behavior.
|
134
134
|
|
135
135
|
```python
|
136
|
-
client.documents.
|
136
|
+
client.documents.document_ingest(..., request_options={
|
137
137
|
"max_retries": 1
|
138
138
|
})
|
139
139
|
```
|
@@ -153,7 +153,7 @@ client = GroundX(
|
|
153
153
|
|
154
154
|
|
155
155
|
# Override timeout for a specific method
|
156
|
-
client.documents.
|
156
|
+
client.documents.document_ingest(..., request_options={
|
157
157
|
"timeout_in_seconds": 1
|
158
158
|
})
|
159
159
|
```
|
@@ -1,10 +1,10 @@
|
|
1
|
-
groundx/__init__.py,sha256=
|
1
|
+
groundx/__init__.py,sha256=k9TpTModn8DZ6OiU_90cp_F5o40BSbwuo9z5Pd5xRlo,2893
|
2
2
|
groundx/buckets/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
3
3
|
groundx/buckets/client.py,sha256=TofNrkej1AC_-FU5rf_y8KG8ubFUpHtLa8PQ7rqax6E,26537
|
4
4
|
groundx/client.py,sha256=Q1Kw0z6K-z-ShhNyuuPe5fYonM9M2I_55-ukUrUWk1U,6507
|
5
5
|
groundx/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
|
6
6
|
groundx/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
7
|
-
groundx/core/client_wrapper.py,sha256=
|
7
|
+
groundx/core/client_wrapper.py,sha256=Z-ZEBnqD06tDJsvCV9J77eEZYKXnWnOJny79xUUPQ18,1803
|
8
8
|
groundx/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
9
9
|
groundx/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
10
10
|
groundx/core/http_client.py,sha256=siUQ6UV0ARZALlxubqWSSAAPC9B4VW8y6MGlHStfaeo,19552
|
@@ -17,7 +17,7 @@ groundx/core/serialization.py,sha256=D9h_t-RQON3-CHWs1C4ESY9B-Yd5d-l5lnTLb_X896g
|
|
17
17
|
groundx/customer/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
18
18
|
groundx/customer/client.py,sha256=C_JANeDewRD1Kg-q7LPxdiOSWbYSTOiYlBYZLRYPI44,3467
|
19
19
|
groundx/documents/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
|
20
|
-
groundx/documents/client.py,sha256=
|
20
|
+
groundx/documents/client.py,sha256=QbQelu46lRfrrMpb1fXdjQfPUrc7d2KvTO4KrLOS1Og,65667
|
21
21
|
groundx/environment.py,sha256=CInm1_DKtZ1mrxutmKb1qqv82P33r_S87hZD3Hc1VB0,159
|
22
22
|
groundx/errors/__init__.py,sha256=-prNYsFd8xxM4va0vR1raZjcd10tllOJKyEWjX_pwdU,214
|
23
23
|
groundx/errors/bad_request_error.py,sha256=_EbO8mWqN9kFZPvIap8qa1lL_EWkRcsZe1HKV9GDWJY,264
|
@@ -31,7 +31,7 @@ groundx/search/__init__.py,sha256=RagVzjShP33mDg9o4N3kGzV0egL1RYNjCpXPE8VzMYE,14
|
|
31
31
|
groundx/search/client.py,sha256=10ifg9GyIwIZF13ULfCXF8iFIydq6H6QRDrGPDjpanw,19756
|
32
32
|
groundx/search/types/__init__.py,sha256=fNFXQloPa1PHHO8VZim6KQNMA9N5EZtfSkissdxtY_c,165
|
33
33
|
groundx/search/types/search_content_request_id.py,sha256=us7mYdzR0qPur_wR5I9BhHaLEzC5nLBRna6-xq4M1ec,128
|
34
|
-
groundx/types/__init__.py,sha256=
|
34
|
+
groundx/types/__init__.py,sha256=ms9d1ANY2mUuAvKUOTd76dWc5Ujza4w31Dw6luDxQ-k,3633
|
35
35
|
groundx/types/bounding_box_detail.py,sha256=51qcen326NTHY2ZqH1cFXut0_MCmk39EbLoDAwotdq4,1832
|
36
36
|
groundx/types/bucket_detail.py,sha256=bQjCvfyWydjItmzNNTvH-iWxNDOggd7R7X1alFZzlEY,1511
|
37
37
|
groundx/types/bucket_list_response.py,sha256=jC0NBsLCYDSwQrBzuW0g3PWFycjtKl8YRkKhic_-1DA,650
|
@@ -53,6 +53,7 @@ groundx/types/health_response.py,sha256=3UpYL2IZb56tTo-fOpSU-0OTRyWgpYiB3pMU3sfj
|
|
53
53
|
groundx/types/health_response_health.py,sha256=I0QeEljFp6l5LCJbCTArW031Om84egePgnGdtE6WXlI,632
|
54
54
|
groundx/types/health_service.py,sha256=M1-h1EJSpAXw-j3pY-09_g_WKkO0spdj8e7pgPzSGf0,1083
|
55
55
|
groundx/types/health_service_status.py,sha256=ugKJXlx8QGi83n_J6s1frFrW1hYfOn3Dlb_pPNexwMA,185
|
56
|
+
groundx/types/ingest_document.py,sha256=hIVo62aYNOpwmpUbyUya_u1WJy4qXfBNouuyPFMK7eU,1701
|
56
57
|
groundx/types/ingest_local_document.py,sha256=2T1HXR2a-BDj5LEOTM98Sl4sgjVMWbVShQLn8MTR6QA,1602
|
57
58
|
groundx/types/ingest_remote_document.py,sha256=xlPA4SYoUgoGXpxZhyORdezxIPGmr4wneav2ZEVmmOY,1683
|
58
59
|
groundx/types/ingest_response.py,sha256=139rn8wpT44jlUzYXiy0r8XzN2U_OtdLltpSbRU0TyA,633
|
@@ -75,7 +76,7 @@ groundx/types/sort_order.py,sha256=hfJkStz6zHf3iWQFaVLkNCZPdyj5JS7TsQlN4Ij8Q5A,1
|
|
75
76
|
groundx/types/subscription_detail.py,sha256=WNfUw2EMVECIvNYcV2s51zZ6T3Utc4zYXw63bPaeM6U,768
|
76
77
|
groundx/types/subscription_detail_meters.py,sha256=lBa8-1QlMVHjr5RLGqhiTKnD1KMM0AAHTWvz9TVtG8w,830
|
77
78
|
groundx/version.py,sha256=1yVogKaq260fQfckM2RYN2144SEw0QROsZW8ICtkG4U,74
|
78
|
-
groundx-2.0.
|
79
|
-
groundx-2.0.
|
80
|
-
groundx-2.0.
|
81
|
-
groundx-2.0.
|
79
|
+
groundx-2.0.18.dist-info/LICENSE,sha256=8dMPYAFBTA7O4DUxhrEKEks8CL2waCMYM6dHohW4xrI,1065
|
80
|
+
groundx-2.0.18.dist-info/METADATA,sha256=HJlHWrgOt9oD1z1UtEVheD5ZVwZMjYeyqIWQPDsJgug,5190
|
81
|
+
groundx-2.0.18.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
82
|
+
groundx-2.0.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|