groundx 2.3.3__py3-none-any.whl → 2.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. groundx/__init__.py +2 -0
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +47 -366
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +15 -17
  6. groundx/core/__init__.py +5 -0
  7. groundx/core/api_error.py +13 -5
  8. groundx/core/client_wrapper.py +4 -3
  9. groundx/core/force_multipart.py +16 -0
  10. groundx/core/http_client.py +70 -26
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +69 -110
  14. groundx/core/serialization.py +7 -3
  15. groundx/customer/__init__.py +2 -0
  16. groundx/customer/client.py +31 -43
  17. groundx/customer/raw_client.py +91 -0
  18. groundx/documents/__init__.py +2 -0
  19. groundx/documents/client.py +100 -780
  20. groundx/documents/raw_client.py +1404 -0
  21. groundx/errors/__init__.py +2 -0
  22. groundx/errors/bad_request_error.py +4 -3
  23. groundx/errors/unauthorized_error.py +4 -3
  24. groundx/groups/__init__.py +2 -0
  25. groundx/groups/client.py +55 -520
  26. groundx/groups/raw_client.py +901 -0
  27. groundx/health/__init__.py +2 -0
  28. groundx/health/client.py +35 -101
  29. groundx/health/raw_client.py +193 -0
  30. groundx/search/__init__.py +2 -0
  31. groundx/search/client.py +64 -213
  32. groundx/search/raw_client.py +442 -0
  33. groundx/search/types/__init__.py +2 -0
  34. groundx/types/__init__.py +2 -0
  35. groundx/types/bounding_box_detail.py +4 -4
  36. groundx/types/bucket_detail.py +5 -5
  37. groundx/types/bucket_list_response.py +3 -3
  38. groundx/types/bucket_response.py +3 -3
  39. groundx/types/bucket_update_detail.py +4 -4
  40. groundx/types/bucket_update_response.py +3 -3
  41. groundx/types/customer_detail.py +2 -2
  42. groundx/types/customer_response.py +3 -3
  43. groundx/types/document.py +4 -4
  44. groundx/types/document_detail.py +4 -4
  45. groundx/types/document_list_response.py +4 -4
  46. groundx/types/document_local_ingest_request.py +1 -0
  47. groundx/types/document_lookup_response.py +3 -3
  48. groundx/types/document_response.py +3 -3
  49. groundx/types/group_detail.py +4 -4
  50. groundx/types/group_list_response.py +3 -3
  51. groundx/types/group_response.py +3 -3
  52. groundx/types/health_response.py +3 -3
  53. groundx/types/health_response_health.py +3 -3
  54. groundx/types/health_service.py +5 -5
  55. groundx/types/ingest_local_document.py +3 -3
  56. groundx/types/ingest_local_document_metadata.py +4 -4
  57. groundx/types/ingest_remote_document.py +4 -4
  58. groundx/types/ingest_response.py +3 -3
  59. groundx/types/ingest_status.py +3 -3
  60. groundx/types/ingest_status_light.py +3 -3
  61. groundx/types/ingest_status_progress.py +3 -3
  62. groundx/types/ingest_status_progress_cancelled.py +3 -3
  63. groundx/types/ingest_status_progress_complete.py +3 -3
  64. groundx/types/ingest_status_progress_errors.py +3 -3
  65. groundx/types/ingest_status_progress_processing.py +3 -3
  66. groundx/types/message_response.py +2 -2
  67. groundx/types/meter_detail.py +2 -2
  68. groundx/types/processes_status_response.py +3 -3
  69. groundx/types/search_response.py +3 -3
  70. groundx/types/search_response_search.py +3 -3
  71. groundx/types/search_result_item.py +5 -5
  72. groundx/types/subscription_detail.py +3 -3
  73. groundx/types/subscription_detail_meters.py +5 -5
  74. groundx/types/website_source.py +4 -4
  75. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/METADATA +1 -1
  76. groundx-2.3.5.dist-info/RECORD +95 -0
  77. groundx-2.3.3.dist-info/RECORD +0 -87
  78. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/LICENSE +0 -0
  79. {groundx-2.3.3.dist-info → groundx-2.3.5.dist-info}/WHEEL +0 -0
groundx/search/client.py CHANGED
@@ -1,17 +1,12 @@
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.search_content_request_id import SearchContentRequestId
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
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
8
+ from .raw_client import AsyncRawSearchClient, RawSearchClient
9
+ from .types.search_content_request_id import SearchContentRequestId
15
10
 
16
11
  # this is used as the default value for optional parameters
17
12
  OMIT = typing.cast(typing.Any, ...)
@@ -19,7 +14,18 @@ OMIT = typing.cast(typing.Any, ...)
19
14
 
20
15
  class SearchClient:
21
16
  def __init__(self, *, client_wrapper: SyncClientWrapper):
22
- self._client_wrapper = client_wrapper
17
+ self._raw_client = RawSearchClient(client_wrapper=client_wrapper)
18
+
19
+ @property
20
+ def with_raw_response(self) -> RawSearchClient:
21
+ """
22
+ Retrieves a raw implementation of this client that returns raw responses.
23
+
24
+ Returns
25
+ -------
26
+ RawSearchClient
27
+ """
28
+ return self._raw_client
23
29
 
24
30
  def content(
25
31
  self,
@@ -81,58 +87,17 @@ class SearchClient:
81
87
  query="my search query",
82
88
  )
83
89
  """
84
- _response = self._client_wrapper.httpx_client.request(
85
- f"v1/search/{jsonable_encoder(id)}",
86
- method="POST",
87
- params={
88
- "n": n,
89
- "nextToken": next_token,
90
- "verbosity": verbosity,
91
- },
92
- json={
93
- "query": query,
94
- "filter": filter,
95
- "relevance": relevance,
96
- },
97
- headers={
98
- "content-type": "application/json",
99
- },
90
+ _response = self._raw_client.content(
91
+ id,
92
+ query=query,
93
+ n=n,
94
+ next_token=next_token,
95
+ verbosity=verbosity,
96
+ filter=filter,
97
+ relevance=relevance,
100
98
  request_options=request_options,
101
- omit=OMIT,
102
99
  )
103
- try:
104
- if 200 <= _response.status_code < 300:
105
- return typing.cast(
106
- SearchResponse,
107
- parse_obj_as(
108
- type_=SearchResponse, # type: ignore
109
- object_=_response.json(),
110
- ),
111
- )
112
- if _response.status_code == 400:
113
- raise BadRequestError(
114
- typing.cast(
115
- typing.Optional[typing.Any],
116
- parse_obj_as(
117
- type_=typing.Optional[typing.Any], # type: ignore
118
- object_=_response.json(),
119
- ),
120
- )
121
- )
122
- if _response.status_code == 401:
123
- raise UnauthorizedError(
124
- typing.cast(
125
- typing.Optional[typing.Any],
126
- parse_obj_as(
127
- type_=typing.Optional[typing.Any], # type: ignore
128
- object_=_response.json(),
129
- ),
130
- )
131
- )
132
- _response_json = _response.json()
133
- except JSONDecodeError:
134
- raise ApiError(status_code=_response.status_code, body=_response.text)
135
- raise ApiError(status_code=_response.status_code, body=_response_json)
100
+ return _response.data
136
101
 
137
102
  def documents(
138
103
  self,
@@ -194,64 +159,33 @@ class SearchClient:
194
159
  document_ids=["docUUID1", "docUUID2"],
195
160
  )
196
161
  """
197
- _response = self._client_wrapper.httpx_client.request(
198
- "v1/search/documents",
199
- method="POST",
200
- params={
201
- "n": n,
202
- "nextToken": next_token,
203
- "verbosity": verbosity,
204
- },
205
- json={
206
- "query": query,
207
- "documentIds": document_ids,
208
- "filter": filter,
209
- "relevance": relevance,
210
- },
211
- headers={
212
- "content-type": "application/json",
213
- },
162
+ _response = self._raw_client.documents(
163
+ query=query,
164
+ document_ids=document_ids,
165
+ n=n,
166
+ next_token=next_token,
167
+ verbosity=verbosity,
168
+ filter=filter,
169
+ relevance=relevance,
214
170
  request_options=request_options,
215
- omit=OMIT,
216
171
  )
217
- try:
218
- if 200 <= _response.status_code < 300:
219
- return typing.cast(
220
- SearchResponse,
221
- parse_obj_as(
222
- type_=SearchResponse, # type: ignore
223
- object_=_response.json(),
224
- ),
225
- )
226
- if _response.status_code == 400:
227
- raise BadRequestError(
228
- typing.cast(
229
- typing.Optional[typing.Any],
230
- parse_obj_as(
231
- type_=typing.Optional[typing.Any], # type: ignore
232
- object_=_response.json(),
233
- ),
234
- )
235
- )
236
- if _response.status_code == 401:
237
- raise UnauthorizedError(
238
- typing.cast(
239
- typing.Optional[typing.Any],
240
- parse_obj_as(
241
- type_=typing.Optional[typing.Any], # type: ignore
242
- object_=_response.json(),
243
- ),
244
- )
245
- )
246
- _response_json = _response.json()
247
- except JSONDecodeError:
248
- raise ApiError(status_code=_response.status_code, body=_response.text)
249
- raise ApiError(status_code=_response.status_code, body=_response_json)
172
+ return _response.data
250
173
 
251
174
 
252
175
  class AsyncSearchClient:
253
176
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
254
- self._client_wrapper = client_wrapper
177
+ self._raw_client = AsyncRawSearchClient(client_wrapper=client_wrapper)
178
+
179
+ @property
180
+ def with_raw_response(self) -> AsyncRawSearchClient:
181
+ """
182
+ Retrieves a raw implementation of this client that returns raw responses.
183
+
184
+ Returns
185
+ -------
186
+ AsyncRawSearchClient
187
+ """
188
+ return self._raw_client
255
189
 
256
190
  async def content(
257
191
  self,
@@ -321,58 +255,17 @@ class AsyncSearchClient:
321
255
 
322
256
  asyncio.run(main())
323
257
  """
324
- _response = await self._client_wrapper.httpx_client.request(
325
- f"v1/search/{jsonable_encoder(id)}",
326
- method="POST",
327
- params={
328
- "n": n,
329
- "nextToken": next_token,
330
- "verbosity": verbosity,
331
- },
332
- json={
333
- "query": query,
334
- "filter": filter,
335
- "relevance": relevance,
336
- },
337
- headers={
338
- "content-type": "application/json",
339
- },
258
+ _response = await self._raw_client.content(
259
+ id,
260
+ query=query,
261
+ n=n,
262
+ next_token=next_token,
263
+ verbosity=verbosity,
264
+ filter=filter,
265
+ relevance=relevance,
340
266
  request_options=request_options,
341
- omit=OMIT,
342
267
  )
343
- try:
344
- if 200 <= _response.status_code < 300:
345
- return typing.cast(
346
- SearchResponse,
347
- parse_obj_as(
348
- type_=SearchResponse, # type: ignore
349
- object_=_response.json(),
350
- ),
351
- )
352
- if _response.status_code == 400:
353
- raise BadRequestError(
354
- typing.cast(
355
- typing.Optional[typing.Any],
356
- parse_obj_as(
357
- type_=typing.Optional[typing.Any], # type: ignore
358
- object_=_response.json(),
359
- ),
360
- )
361
- )
362
- if _response.status_code == 401:
363
- raise UnauthorizedError(
364
- typing.cast(
365
- typing.Optional[typing.Any],
366
- parse_obj_as(
367
- type_=typing.Optional[typing.Any], # type: ignore
368
- object_=_response.json(),
369
- ),
370
- )
371
- )
372
- _response_json = _response.json()
373
- except JSONDecodeError:
374
- raise ApiError(status_code=_response.status_code, body=_response.text)
375
- raise ApiError(status_code=_response.status_code, body=_response_json)
268
+ return _response.data
376
269
 
377
270
  async def documents(
378
271
  self,
@@ -442,56 +335,14 @@ class AsyncSearchClient:
442
335
 
443
336
  asyncio.run(main())
444
337
  """
445
- _response = await self._client_wrapper.httpx_client.request(
446
- "v1/search/documents",
447
- method="POST",
448
- params={
449
- "n": n,
450
- "nextToken": next_token,
451
- "verbosity": verbosity,
452
- },
453
- json={
454
- "query": query,
455
- "documentIds": document_ids,
456
- "filter": filter,
457
- "relevance": relevance,
458
- },
459
- headers={
460
- "content-type": "application/json",
461
- },
338
+ _response = await self._raw_client.documents(
339
+ query=query,
340
+ document_ids=document_ids,
341
+ n=n,
342
+ next_token=next_token,
343
+ verbosity=verbosity,
344
+ filter=filter,
345
+ relevance=relevance,
462
346
  request_options=request_options,
463
- omit=OMIT,
464
347
  )
465
- try:
466
- if 200 <= _response.status_code < 300:
467
- return typing.cast(
468
- SearchResponse,
469
- parse_obj_as(
470
- type_=SearchResponse, # type: ignore
471
- object_=_response.json(),
472
- ),
473
- )
474
- if _response.status_code == 400:
475
- raise BadRequestError(
476
- typing.cast(
477
- typing.Optional[typing.Any],
478
- parse_obj_as(
479
- type_=typing.Optional[typing.Any], # type: ignore
480
- object_=_response.json(),
481
- ),
482
- )
483
- )
484
- if _response.status_code == 401:
485
- raise UnauthorizedError(
486
- typing.cast(
487
- typing.Optional[typing.Any],
488
- parse_obj_as(
489
- type_=typing.Optional[typing.Any], # type: ignore
490
- object_=_response.json(),
491
- ),
492
- )
493
- )
494
- _response_json = _response.json()
495
- except JSONDecodeError:
496
- raise ApiError(status_code=_response.status_code, body=_response.text)
497
- raise ApiError(status_code=_response.status_code, body=_response_json)
348
+ return _response.data