groundx 2.0.11__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 +107 -0
- groundx/buckets/__init__.py +2 -0
- groundx/buckets/client.py +761 -0
- groundx/client.py +160 -0
- groundx/core/__init__.py +47 -0
- groundx/core/api_error.py +15 -0
- groundx/core/client_wrapper.py +54 -0
- groundx/core/datetime_utils.py +28 -0
- groundx/core/file.py +67 -0
- groundx/core/http_client.py +499 -0
- groundx/core/jsonable_encoder.py +101 -0
- groundx/core/pydantic_utilities.py +296 -0
- groundx/core/query_encoder.py +58 -0
- groundx/core/remove_none_from_dict.py +11 -0
- groundx/core/request_options.py +35 -0
- groundx/core/serialization.py +272 -0
- groundx/customer/__init__.py +2 -0
- groundx/customer/client.py +112 -0
- groundx/documents/__init__.py +5 -0
- groundx/documents/client.py +1544 -0
- groundx/documents/types/__init__.py +6 -0
- groundx/documents/types/document_remote_ingest_request_documents_item.py +45 -0
- groundx/documents/types/website_crawl_request_websites_item.py +46 -0
- groundx/environment.py +7 -0
- groundx/errors/__init__.py +6 -0
- groundx/errors/bad_request_error.py +9 -0
- groundx/errors/unauthorized_error.py +9 -0
- groundx/groups/__init__.py +2 -0
- groundx/groups/client.py +1098 -0
- groundx/health/__init__.py +2 -0
- groundx/health/client.py +236 -0
- groundx/py.typed +0 -0
- groundx/search/__init__.py +5 -0
- groundx/search/client.py +489 -0
- groundx/search/types/__init__.py +5 -0
- groundx/search/types/search_content_request_id.py +5 -0
- groundx/types/__init__.py +83 -0
- groundx/types/bounding_box_detail.py +54 -0
- groundx/types/bucket_detail.py +46 -0
- groundx/types/bucket_list_response.py +20 -0
- groundx/types/bucket_response.py +20 -0
- groundx/types/bucket_update_detail.py +22 -0
- groundx/types/bucket_update_response.py +20 -0
- groundx/types/customer_detail.py +39 -0
- groundx/types/customer_response.py +20 -0
- groundx/types/document_detail.py +62 -0
- groundx/types/document_list_response.py +23 -0
- groundx/types/document_lookup_response.py +32 -0
- groundx/types/document_response.py +20 -0
- groundx/types/document_type.py +7 -0
- groundx/types/group_detail.py +52 -0
- groundx/types/group_list_response.py +20 -0
- groundx/types/group_response.py +20 -0
- groundx/types/health_response.py +20 -0
- groundx/types/health_response_health.py +20 -0
- groundx/types/health_service.py +36 -0
- groundx/types/health_service_status.py +5 -0
- groundx/types/ingest_response.py +20 -0
- groundx/types/ingest_response_ingest.py +23 -0
- groundx/types/message_response.py +19 -0
- groundx/types/meter_detail.py +40 -0
- groundx/types/process_status_response.py +20 -0
- groundx/types/process_status_response_ingest.py +26 -0
- groundx/types/process_status_response_ingest_progress.py +26 -0
- groundx/types/process_status_response_ingest_progress_cancelled.py +21 -0
- groundx/types/process_status_response_ingest_progress_complete.py +21 -0
- groundx/types/process_status_response_ingest_progress_errors.py +21 -0
- groundx/types/process_status_response_ingest_progress_processing.py +21 -0
- groundx/types/processing_status.py +5 -0
- groundx/types/search_response.py +20 -0
- groundx/types/search_response_search.py +59 -0
- groundx/types/search_result_item.py +96 -0
- groundx/types/sort.py +5 -0
- groundx/types/sort_order.py +5 -0
- groundx/types/subscription_detail.py +24 -0
- groundx/types/subscription_detail_meters.py +23 -0
- groundx/version.py +3 -0
- groundx-2.0.11.dist-info/METADATA +177 -0
- groundx-2.0.11.dist-info/RECORD +80 -0
- groundx-2.0.11.dist-info/WHEEL +4 -0
groundx/search/client.py
ADDED
@@ -0,0 +1,489 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
5
|
+
from .types.search_content_request_id import SearchContentRequestId
|
6
|
+
from ..core.request_options import RequestOptions
|
7
|
+
from ..types.search_response import SearchResponse
|
8
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
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 ..core.client_wrapper import AsyncClientWrapper
|
15
|
+
|
16
|
+
# this is used as the default value for optional parameters
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
18
|
+
|
19
|
+
|
20
|
+
class SearchClient:
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
22
|
+
self._client_wrapper = client_wrapper
|
23
|
+
|
24
|
+
def content(
|
25
|
+
self,
|
26
|
+
id: SearchContentRequestId,
|
27
|
+
*,
|
28
|
+
query: str,
|
29
|
+
n: typing.Optional[int] = None,
|
30
|
+
next_token: typing.Optional[str] = None,
|
31
|
+
verbosity: typing.Optional[int] = None,
|
32
|
+
relevance: typing.Optional[float] = OMIT,
|
33
|
+
request_options: typing.Optional[RequestOptions] = None,
|
34
|
+
) -> SearchResponse:
|
35
|
+
"""
|
36
|
+
Search documents on GroundX for the most relevant information to a given query.
|
37
|
+
|
38
|
+
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
|
39
|
+
|
40
|
+
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.
|
41
|
+
|
42
|
+
Parameters
|
43
|
+
----------
|
44
|
+
id : SearchContentRequestId
|
45
|
+
The bucketId, groupId, projectId, or documentId to be searched. The document or documents within the specified container will be compared to the query, and relevant information will be extracted.
|
46
|
+
|
47
|
+
query : str
|
48
|
+
The search query to be used to find relevant documentation.
|
49
|
+
|
50
|
+
n : typing.Optional[int]
|
51
|
+
The maximum number of returned search results. Accepts 1-100 with a default of 20.
|
52
|
+
|
53
|
+
next_token : typing.Optional[str]
|
54
|
+
A token for pagination. If the number of search results 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 search results.
|
55
|
+
|
56
|
+
verbosity : typing.Optional[int]
|
57
|
+
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
|
58
|
+
|
59
|
+
relevance : typing.Optional[float]
|
60
|
+
The minimum search relevance score required to include the result. By default, this is 10.0.
|
61
|
+
|
62
|
+
request_options : typing.Optional[RequestOptions]
|
63
|
+
Request-specific configuration.
|
64
|
+
|
65
|
+
Returns
|
66
|
+
-------
|
67
|
+
SearchResponse
|
68
|
+
Search query success
|
69
|
+
|
70
|
+
Examples
|
71
|
+
--------
|
72
|
+
from groundx import GroundX
|
73
|
+
|
74
|
+
client = GroundX(
|
75
|
+
api_key="YOUR_API_KEY",
|
76
|
+
)
|
77
|
+
client.search.content(
|
78
|
+
id=1,
|
79
|
+
next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
|
80
|
+
query="my search query",
|
81
|
+
)
|
82
|
+
"""
|
83
|
+
_response = self._client_wrapper.httpx_client.request(
|
84
|
+
f"v1/search/{jsonable_encoder(id)}",
|
85
|
+
method="POST",
|
86
|
+
params={
|
87
|
+
"n": n,
|
88
|
+
"nextToken": next_token,
|
89
|
+
"verbosity": verbosity,
|
90
|
+
},
|
91
|
+
json={
|
92
|
+
"query": query,
|
93
|
+
"relevance": relevance,
|
94
|
+
},
|
95
|
+
headers={
|
96
|
+
"content-type": "application/json",
|
97
|
+
},
|
98
|
+
request_options=request_options,
|
99
|
+
omit=OMIT,
|
100
|
+
)
|
101
|
+
try:
|
102
|
+
if 200 <= _response.status_code < 300:
|
103
|
+
return typing.cast(
|
104
|
+
SearchResponse,
|
105
|
+
parse_obj_as(
|
106
|
+
type_=SearchResponse, # type: ignore
|
107
|
+
object_=_response.json(),
|
108
|
+
),
|
109
|
+
)
|
110
|
+
if _response.status_code == 400:
|
111
|
+
raise BadRequestError(
|
112
|
+
typing.cast(
|
113
|
+
typing.Optional[typing.Any],
|
114
|
+
parse_obj_as(
|
115
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
116
|
+
object_=_response.json(),
|
117
|
+
),
|
118
|
+
)
|
119
|
+
)
|
120
|
+
if _response.status_code == 401:
|
121
|
+
raise UnauthorizedError(
|
122
|
+
typing.cast(
|
123
|
+
typing.Optional[typing.Any],
|
124
|
+
parse_obj_as(
|
125
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
126
|
+
object_=_response.json(),
|
127
|
+
),
|
128
|
+
)
|
129
|
+
)
|
130
|
+
_response_json = _response.json()
|
131
|
+
except JSONDecodeError:
|
132
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
133
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
134
|
+
|
135
|
+
def documents(
|
136
|
+
self,
|
137
|
+
*,
|
138
|
+
query: str,
|
139
|
+
document_ids: typing.Sequence[str],
|
140
|
+
n: typing.Optional[int] = None,
|
141
|
+
next_token: typing.Optional[str] = None,
|
142
|
+
verbosity: typing.Optional[int] = None,
|
143
|
+
relevance: typing.Optional[float] = OMIT,
|
144
|
+
request_options: typing.Optional[RequestOptions] = None,
|
145
|
+
) -> SearchResponse:
|
146
|
+
"""
|
147
|
+
Search documents on GroundX for the most relevant information to a given query by documentId(s).
|
148
|
+
|
149
|
+
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
|
150
|
+
|
151
|
+
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.
|
152
|
+
|
153
|
+
Parameters
|
154
|
+
----------
|
155
|
+
query : str
|
156
|
+
The search query to be used to find relevant documentation.
|
157
|
+
|
158
|
+
document_ids : typing.Sequence[str]
|
159
|
+
An array of unique documentIds to be searched.
|
160
|
+
|
161
|
+
n : typing.Optional[int]
|
162
|
+
The maximum number of returned search results. Accepts 1-100 with a default of 20.
|
163
|
+
|
164
|
+
next_token : typing.Optional[str]
|
165
|
+
A token for pagination. If the number of search results 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 search results.
|
166
|
+
|
167
|
+
verbosity : typing.Optional[int]
|
168
|
+
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
|
169
|
+
|
170
|
+
relevance : typing.Optional[float]
|
171
|
+
The minimum search relevance score required to include the result. By default, this is 10.0.
|
172
|
+
|
173
|
+
request_options : typing.Optional[RequestOptions]
|
174
|
+
Request-specific configuration.
|
175
|
+
|
176
|
+
Returns
|
177
|
+
-------
|
178
|
+
SearchResponse
|
179
|
+
Search query success
|
180
|
+
|
181
|
+
Examples
|
182
|
+
--------
|
183
|
+
from groundx import GroundX
|
184
|
+
|
185
|
+
client = GroundX(
|
186
|
+
api_key="YOUR_API_KEY",
|
187
|
+
)
|
188
|
+
client.search.documents(
|
189
|
+
next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
|
190
|
+
query="my search query",
|
191
|
+
document_ids=["docUUID1", "docUUID2"],
|
192
|
+
)
|
193
|
+
"""
|
194
|
+
_response = self._client_wrapper.httpx_client.request(
|
195
|
+
"v1/search/documents",
|
196
|
+
method="POST",
|
197
|
+
params={
|
198
|
+
"n": n,
|
199
|
+
"nextToken": next_token,
|
200
|
+
"verbosity": verbosity,
|
201
|
+
},
|
202
|
+
json={
|
203
|
+
"query": query,
|
204
|
+
"documentIds": document_ids,
|
205
|
+
"relevance": relevance,
|
206
|
+
},
|
207
|
+
headers={
|
208
|
+
"content-type": "application/json",
|
209
|
+
},
|
210
|
+
request_options=request_options,
|
211
|
+
omit=OMIT,
|
212
|
+
)
|
213
|
+
try:
|
214
|
+
if 200 <= _response.status_code < 300:
|
215
|
+
return typing.cast(
|
216
|
+
SearchResponse,
|
217
|
+
parse_obj_as(
|
218
|
+
type_=SearchResponse, # type: ignore
|
219
|
+
object_=_response.json(),
|
220
|
+
),
|
221
|
+
)
|
222
|
+
if _response.status_code == 400:
|
223
|
+
raise BadRequestError(
|
224
|
+
typing.cast(
|
225
|
+
typing.Optional[typing.Any],
|
226
|
+
parse_obj_as(
|
227
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
228
|
+
object_=_response.json(),
|
229
|
+
),
|
230
|
+
)
|
231
|
+
)
|
232
|
+
if _response.status_code == 401:
|
233
|
+
raise UnauthorizedError(
|
234
|
+
typing.cast(
|
235
|
+
typing.Optional[typing.Any],
|
236
|
+
parse_obj_as(
|
237
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
238
|
+
object_=_response.json(),
|
239
|
+
),
|
240
|
+
)
|
241
|
+
)
|
242
|
+
_response_json = _response.json()
|
243
|
+
except JSONDecodeError:
|
244
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
245
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
246
|
+
|
247
|
+
|
248
|
+
class AsyncSearchClient:
|
249
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
250
|
+
self._client_wrapper = client_wrapper
|
251
|
+
|
252
|
+
async def content(
|
253
|
+
self,
|
254
|
+
id: SearchContentRequestId,
|
255
|
+
*,
|
256
|
+
query: str,
|
257
|
+
n: typing.Optional[int] = None,
|
258
|
+
next_token: typing.Optional[str] = None,
|
259
|
+
verbosity: typing.Optional[int] = None,
|
260
|
+
relevance: typing.Optional[float] = OMIT,
|
261
|
+
request_options: typing.Optional[RequestOptions] = None,
|
262
|
+
) -> SearchResponse:
|
263
|
+
"""
|
264
|
+
Search documents on GroundX for the most relevant information to a given query.
|
265
|
+
|
266
|
+
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
|
267
|
+
|
268
|
+
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.
|
269
|
+
|
270
|
+
Parameters
|
271
|
+
----------
|
272
|
+
id : SearchContentRequestId
|
273
|
+
The bucketId, groupId, projectId, or documentId to be searched. The document or documents within the specified container will be compared to the query, and relevant information will be extracted.
|
274
|
+
|
275
|
+
query : str
|
276
|
+
The search query to be used to find relevant documentation.
|
277
|
+
|
278
|
+
n : typing.Optional[int]
|
279
|
+
The maximum number of returned search results. Accepts 1-100 with a default of 20.
|
280
|
+
|
281
|
+
next_token : typing.Optional[str]
|
282
|
+
A token for pagination. If the number of search results 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 search results.
|
283
|
+
|
284
|
+
verbosity : typing.Optional[int]
|
285
|
+
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
|
286
|
+
|
287
|
+
relevance : typing.Optional[float]
|
288
|
+
The minimum search relevance score required to include the result. By default, this is 10.0.
|
289
|
+
|
290
|
+
request_options : typing.Optional[RequestOptions]
|
291
|
+
Request-specific configuration.
|
292
|
+
|
293
|
+
Returns
|
294
|
+
-------
|
295
|
+
SearchResponse
|
296
|
+
Search query success
|
297
|
+
|
298
|
+
Examples
|
299
|
+
--------
|
300
|
+
import asyncio
|
301
|
+
|
302
|
+
from groundx import AsyncGroundX
|
303
|
+
|
304
|
+
client = AsyncGroundX(
|
305
|
+
api_key="YOUR_API_KEY",
|
306
|
+
)
|
307
|
+
|
308
|
+
|
309
|
+
async def main() -> None:
|
310
|
+
await client.search.content(
|
311
|
+
id=1,
|
312
|
+
next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
|
313
|
+
query="my search query",
|
314
|
+
)
|
315
|
+
|
316
|
+
|
317
|
+
asyncio.run(main())
|
318
|
+
"""
|
319
|
+
_response = await self._client_wrapper.httpx_client.request(
|
320
|
+
f"v1/search/{jsonable_encoder(id)}",
|
321
|
+
method="POST",
|
322
|
+
params={
|
323
|
+
"n": n,
|
324
|
+
"nextToken": next_token,
|
325
|
+
"verbosity": verbosity,
|
326
|
+
},
|
327
|
+
json={
|
328
|
+
"query": query,
|
329
|
+
"relevance": relevance,
|
330
|
+
},
|
331
|
+
headers={
|
332
|
+
"content-type": "application/json",
|
333
|
+
},
|
334
|
+
request_options=request_options,
|
335
|
+
omit=OMIT,
|
336
|
+
)
|
337
|
+
try:
|
338
|
+
if 200 <= _response.status_code < 300:
|
339
|
+
return typing.cast(
|
340
|
+
SearchResponse,
|
341
|
+
parse_obj_as(
|
342
|
+
type_=SearchResponse, # type: ignore
|
343
|
+
object_=_response.json(),
|
344
|
+
),
|
345
|
+
)
|
346
|
+
if _response.status_code == 400:
|
347
|
+
raise BadRequestError(
|
348
|
+
typing.cast(
|
349
|
+
typing.Optional[typing.Any],
|
350
|
+
parse_obj_as(
|
351
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
352
|
+
object_=_response.json(),
|
353
|
+
),
|
354
|
+
)
|
355
|
+
)
|
356
|
+
if _response.status_code == 401:
|
357
|
+
raise UnauthorizedError(
|
358
|
+
typing.cast(
|
359
|
+
typing.Optional[typing.Any],
|
360
|
+
parse_obj_as(
|
361
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
362
|
+
object_=_response.json(),
|
363
|
+
),
|
364
|
+
)
|
365
|
+
)
|
366
|
+
_response_json = _response.json()
|
367
|
+
except JSONDecodeError:
|
368
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
369
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
370
|
+
|
371
|
+
async def documents(
|
372
|
+
self,
|
373
|
+
*,
|
374
|
+
query: str,
|
375
|
+
document_ids: typing.Sequence[str],
|
376
|
+
n: typing.Optional[int] = None,
|
377
|
+
next_token: typing.Optional[str] = None,
|
378
|
+
verbosity: typing.Optional[int] = None,
|
379
|
+
relevance: typing.Optional[float] = OMIT,
|
380
|
+
request_options: typing.Optional[RequestOptions] = None,
|
381
|
+
) -> SearchResponse:
|
382
|
+
"""
|
383
|
+
Search documents on GroundX for the most relevant information to a given query by documentId(s).
|
384
|
+
|
385
|
+
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
|
386
|
+
|
387
|
+
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.
|
388
|
+
|
389
|
+
Parameters
|
390
|
+
----------
|
391
|
+
query : str
|
392
|
+
The search query to be used to find relevant documentation.
|
393
|
+
|
394
|
+
document_ids : typing.Sequence[str]
|
395
|
+
An array of unique documentIds to be searched.
|
396
|
+
|
397
|
+
n : typing.Optional[int]
|
398
|
+
The maximum number of returned search results. Accepts 1-100 with a default of 20.
|
399
|
+
|
400
|
+
next_token : typing.Optional[str]
|
401
|
+
A token for pagination. If the number of search results 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 search results.
|
402
|
+
|
403
|
+
verbosity : typing.Optional[int]
|
404
|
+
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
|
405
|
+
|
406
|
+
relevance : typing.Optional[float]
|
407
|
+
The minimum search relevance score required to include the result. By default, this is 10.0.
|
408
|
+
|
409
|
+
request_options : typing.Optional[RequestOptions]
|
410
|
+
Request-specific configuration.
|
411
|
+
|
412
|
+
Returns
|
413
|
+
-------
|
414
|
+
SearchResponse
|
415
|
+
Search query success
|
416
|
+
|
417
|
+
Examples
|
418
|
+
--------
|
419
|
+
import asyncio
|
420
|
+
|
421
|
+
from groundx import AsyncGroundX
|
422
|
+
|
423
|
+
client = AsyncGroundX(
|
424
|
+
api_key="YOUR_API_KEY",
|
425
|
+
)
|
426
|
+
|
427
|
+
|
428
|
+
async def main() -> None:
|
429
|
+
await client.search.documents(
|
430
|
+
next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
|
431
|
+
query="my search query",
|
432
|
+
document_ids=["docUUID1", "docUUID2"],
|
433
|
+
)
|
434
|
+
|
435
|
+
|
436
|
+
asyncio.run(main())
|
437
|
+
"""
|
438
|
+
_response = await self._client_wrapper.httpx_client.request(
|
439
|
+
"v1/search/documents",
|
440
|
+
method="POST",
|
441
|
+
params={
|
442
|
+
"n": n,
|
443
|
+
"nextToken": next_token,
|
444
|
+
"verbosity": verbosity,
|
445
|
+
},
|
446
|
+
json={
|
447
|
+
"query": query,
|
448
|
+
"documentIds": document_ids,
|
449
|
+
"relevance": relevance,
|
450
|
+
},
|
451
|
+
headers={
|
452
|
+
"content-type": "application/json",
|
453
|
+
},
|
454
|
+
request_options=request_options,
|
455
|
+
omit=OMIT,
|
456
|
+
)
|
457
|
+
try:
|
458
|
+
if 200 <= _response.status_code < 300:
|
459
|
+
return typing.cast(
|
460
|
+
SearchResponse,
|
461
|
+
parse_obj_as(
|
462
|
+
type_=SearchResponse, # type: ignore
|
463
|
+
object_=_response.json(),
|
464
|
+
),
|
465
|
+
)
|
466
|
+
if _response.status_code == 400:
|
467
|
+
raise BadRequestError(
|
468
|
+
typing.cast(
|
469
|
+
typing.Optional[typing.Any],
|
470
|
+
parse_obj_as(
|
471
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
472
|
+
object_=_response.json(),
|
473
|
+
),
|
474
|
+
)
|
475
|
+
)
|
476
|
+
if _response.status_code == 401:
|
477
|
+
raise UnauthorizedError(
|
478
|
+
typing.cast(
|
479
|
+
typing.Optional[typing.Any],
|
480
|
+
parse_obj_as(
|
481
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
482
|
+
object_=_response.json(),
|
483
|
+
),
|
484
|
+
)
|
485
|
+
)
|
486
|
+
_response_json = _response.json()
|
487
|
+
except JSONDecodeError:
|
488
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
489
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from .bounding_box_detail import BoundingBoxDetail
|
4
|
+
from .bucket_detail import BucketDetail
|
5
|
+
from .bucket_list_response import BucketListResponse
|
6
|
+
from .bucket_response import BucketResponse
|
7
|
+
from .bucket_update_detail import BucketUpdateDetail
|
8
|
+
from .bucket_update_response import BucketUpdateResponse
|
9
|
+
from .customer_detail import CustomerDetail
|
10
|
+
from .customer_response import CustomerResponse
|
11
|
+
from .document_detail import DocumentDetail
|
12
|
+
from .document_list_response import DocumentListResponse
|
13
|
+
from .document_lookup_response import DocumentLookupResponse
|
14
|
+
from .document_response import DocumentResponse
|
15
|
+
from .document_type import DocumentType
|
16
|
+
from .group_detail import GroupDetail
|
17
|
+
from .group_list_response import GroupListResponse
|
18
|
+
from .group_response import GroupResponse
|
19
|
+
from .health_response import HealthResponse
|
20
|
+
from .health_response_health import HealthResponseHealth
|
21
|
+
from .health_service import HealthService
|
22
|
+
from .health_service_status import HealthServiceStatus
|
23
|
+
from .ingest_response import IngestResponse
|
24
|
+
from .ingest_response_ingest import IngestResponseIngest
|
25
|
+
from .message_response import MessageResponse
|
26
|
+
from .meter_detail import MeterDetail
|
27
|
+
from .process_status_response import ProcessStatusResponse
|
28
|
+
from .process_status_response_ingest import ProcessStatusResponseIngest
|
29
|
+
from .process_status_response_ingest_progress import ProcessStatusResponseIngestProgress
|
30
|
+
from .process_status_response_ingest_progress_cancelled import ProcessStatusResponseIngestProgressCancelled
|
31
|
+
from .process_status_response_ingest_progress_complete import ProcessStatusResponseIngestProgressComplete
|
32
|
+
from .process_status_response_ingest_progress_errors import ProcessStatusResponseIngestProgressErrors
|
33
|
+
from .process_status_response_ingest_progress_processing import ProcessStatusResponseIngestProgressProcessing
|
34
|
+
from .processing_status import ProcessingStatus
|
35
|
+
from .search_response import SearchResponse
|
36
|
+
from .search_response_search import SearchResponseSearch
|
37
|
+
from .search_result_item import SearchResultItem
|
38
|
+
from .sort import Sort
|
39
|
+
from .sort_order import SortOrder
|
40
|
+
from .subscription_detail import SubscriptionDetail
|
41
|
+
from .subscription_detail_meters import SubscriptionDetailMeters
|
42
|
+
|
43
|
+
__all__ = [
|
44
|
+
"BoundingBoxDetail",
|
45
|
+
"BucketDetail",
|
46
|
+
"BucketListResponse",
|
47
|
+
"BucketResponse",
|
48
|
+
"BucketUpdateDetail",
|
49
|
+
"BucketUpdateResponse",
|
50
|
+
"CustomerDetail",
|
51
|
+
"CustomerResponse",
|
52
|
+
"DocumentDetail",
|
53
|
+
"DocumentListResponse",
|
54
|
+
"DocumentLookupResponse",
|
55
|
+
"DocumentResponse",
|
56
|
+
"DocumentType",
|
57
|
+
"GroupDetail",
|
58
|
+
"GroupListResponse",
|
59
|
+
"GroupResponse",
|
60
|
+
"HealthResponse",
|
61
|
+
"HealthResponseHealth",
|
62
|
+
"HealthService",
|
63
|
+
"HealthServiceStatus",
|
64
|
+
"IngestResponse",
|
65
|
+
"IngestResponseIngest",
|
66
|
+
"MessageResponse",
|
67
|
+
"MeterDetail",
|
68
|
+
"ProcessStatusResponse",
|
69
|
+
"ProcessStatusResponseIngest",
|
70
|
+
"ProcessStatusResponseIngestProgress",
|
71
|
+
"ProcessStatusResponseIngestProgressCancelled",
|
72
|
+
"ProcessStatusResponseIngestProgressComplete",
|
73
|
+
"ProcessStatusResponseIngestProgressErrors",
|
74
|
+
"ProcessStatusResponseIngestProgressProcessing",
|
75
|
+
"ProcessingStatus",
|
76
|
+
"SearchResponse",
|
77
|
+
"SearchResponseSearch",
|
78
|
+
"SearchResultItem",
|
79
|
+
"Sort",
|
80
|
+
"SortOrder",
|
81
|
+
"SubscriptionDetail",
|
82
|
+
"SubscriptionDetailMeters",
|
83
|
+
]
|
@@ -0,0 +1,54 @@
|
|
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
|
+
import typing
|
6
|
+
from ..core.serialization import FieldMetadata
|
7
|
+
import pydantic
|
8
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
9
|
+
|
10
|
+
|
11
|
+
class BoundingBoxDetail(UniversalBaseModel):
|
12
|
+
bottom_right_x: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="bottomRightX")] = (
|
13
|
+
pydantic.Field(default=None)
|
14
|
+
)
|
15
|
+
"""
|
16
|
+
The x coordinate of the lower right corner of the bounding box
|
17
|
+
"""
|
18
|
+
|
19
|
+
bottom_right_y: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="bottomRightY")] = (
|
20
|
+
pydantic.Field(default=None)
|
21
|
+
)
|
22
|
+
"""
|
23
|
+
The y coordinate of the lower right corner of the bounding box
|
24
|
+
"""
|
25
|
+
|
26
|
+
page_number: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="pageNumber")] = pydantic.Field(
|
27
|
+
default=None
|
28
|
+
)
|
29
|
+
"""
|
30
|
+
The page number the bounding box appears on, using a 1-based array indexing (starts with page 1, not page 0)
|
31
|
+
"""
|
32
|
+
|
33
|
+
top_left_x: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="topLeftX")] = pydantic.Field(
|
34
|
+
default=None
|
35
|
+
)
|
36
|
+
"""
|
37
|
+
The x coordinate of the upper left corner of the bounding box
|
38
|
+
"""
|
39
|
+
|
40
|
+
top_left_y: typing_extensions.Annotated[typing.Optional[float], FieldMetadata(alias="topLeftY")] = pydantic.Field(
|
41
|
+
default=None
|
42
|
+
)
|
43
|
+
"""
|
44
|
+
The y coordinate of the upper left corner of the bounding box
|
45
|
+
"""
|
46
|
+
|
47
|
+
if IS_PYDANTIC_V2:
|
48
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
49
|
+
else:
|
50
|
+
|
51
|
+
class Config:
|
52
|
+
frozen = True
|
53
|
+
smart_union = True
|
54
|
+
extra = pydantic.Extra.allow
|
@@ -0,0 +1,46 @@
|
|
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 typing
|
7
|
+
import datetime as dt
|
8
|
+
import pydantic
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
10
|
+
|
11
|
+
|
12
|
+
class BucketDetail(UniversalBaseModel):
|
13
|
+
bucket_id: typing_extensions.Annotated[int, FieldMetadata(alias="bucketId")]
|
14
|
+
created: typing.Optional[dt.datetime] = pydantic.Field(default=None)
|
15
|
+
"""
|
16
|
+
The data time when the bucket was created, in RFC3339 format
|
17
|
+
"""
|
18
|
+
|
19
|
+
file_count: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="fileCount")] = pydantic.Field(
|
20
|
+
default=None
|
21
|
+
)
|
22
|
+
"""
|
23
|
+
The number of files contained in the content bucket
|
24
|
+
"""
|
25
|
+
|
26
|
+
file_size: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="fileSize")] = pydantic.Field(
|
27
|
+
default=None
|
28
|
+
)
|
29
|
+
"""
|
30
|
+
The total file size of files contained in the content bucket
|
31
|
+
"""
|
32
|
+
|
33
|
+
name: typing.Optional[str] = None
|
34
|
+
updated: typing.Optional[dt.datetime] = pydantic.Field(default=None)
|
35
|
+
"""
|
36
|
+
The data time when the bucket was last updated, in RFC3339 format
|
37
|
+
"""
|
38
|
+
|
39
|
+
if IS_PYDANTIC_V2:
|
40
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
41
|
+
else:
|
42
|
+
|
43
|
+
class Config:
|
44
|
+
frozen = True
|
45
|
+
smart_union = True
|
46
|
+
extra = pydantic.Extra.allow
|