groundx 2.3.0__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 (82) hide show
  1. groundx/__init__.py +16 -16
  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 +122 -789
  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/ingest.py +2 -2
  31. groundx/search/__init__.py +2 -0
  32. groundx/search/client.py +82 -211
  33. groundx/search/raw_client.py +442 -0
  34. groundx/search/types/__init__.py +2 -0
  35. groundx/types/__init__.py +16 -16
  36. groundx/types/bounding_box_detail.py +4 -4
  37. groundx/types/bucket_detail.py +5 -5
  38. groundx/types/bucket_list_response.py +17 -3
  39. groundx/types/bucket_response.py +3 -3
  40. groundx/types/bucket_update_detail.py +4 -4
  41. groundx/types/bucket_update_response.py +3 -3
  42. groundx/types/customer_detail.py +2 -2
  43. groundx/types/customer_response.py +3 -3
  44. groundx/types/document.py +4 -4
  45. groundx/types/document_detail.py +9 -4
  46. groundx/types/document_list_response.py +4 -4
  47. groundx/types/document_local_ingest_request.py +1 -0
  48. groundx/types/document_lookup_response.py +8 -3
  49. groundx/types/document_response.py +3 -3
  50. groundx/types/group_detail.py +4 -4
  51. groundx/types/group_list_response.py +17 -3
  52. groundx/types/group_response.py +3 -3
  53. groundx/types/health_response.py +3 -3
  54. groundx/types/health_response_health.py +3 -3
  55. groundx/types/health_service.py +5 -5
  56. groundx/types/ingest_local_document.py +3 -3
  57. groundx/types/ingest_local_document_metadata.py +9 -4
  58. groundx/types/ingest_remote_document.py +10 -5
  59. groundx/types/ingest_response.py +4 -4
  60. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  61. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  62. groundx/types/ingest_status_progress.py +26 -0
  63. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  64. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  65. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  66. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  67. groundx/types/message_response.py +2 -2
  68. groundx/types/meter_detail.py +2 -2
  69. groundx/types/processes_status_response.py +19 -2
  70. groundx/types/search_response.py +3 -3
  71. groundx/types/search_response_search.py +3 -3
  72. groundx/types/search_result_item.py +5 -5
  73. groundx/types/subscription_detail.py +3 -3
  74. groundx/types/subscription_detail_meters.py +5 -5
  75. groundx/types/website_source.py +4 -4
  76. {groundx-2.3.0.dist-info → groundx-2.3.5.dist-info}/METADATA +1 -1
  77. groundx-2.3.5.dist-info/RECORD +95 -0
  78. groundx/types/process_status_response.py +0 -20
  79. groundx/types/process_status_response_ingest_progress.py +0 -26
  80. groundx-2.3.0.dist-info/RECORD +0 -88
  81. {groundx-2.3.0.dist-info → groundx-2.3.5.dist-info}/LICENSE +0 -0
  82. {groundx-2.3.0.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,
@@ -29,6 +35,7 @@ class SearchClient:
29
35
  n: typing.Optional[int] = None,
30
36
  next_token: typing.Optional[str] = None,
31
37
  verbosity: typing.Optional[int] = None,
38
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
32
39
  relevance: typing.Optional[float] = OMIT,
33
40
  request_options: typing.Optional[RequestOptions] = None,
34
41
  ) -> SearchResponse:
@@ -39,7 +46,7 @@ class SearchClient:
39
46
  Parameters
40
47
  ----------
41
48
  id : SearchContentRequestId
42
- 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.
49
+ The bucketId, groupId, 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.
43
50
 
44
51
  query : str
45
52
  The search query to be used to find relevant documentation.
@@ -53,6 +60,9 @@ class SearchClient:
53
60
  verbosity : typing.Optional[int]
54
61
  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.
55
62
 
63
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
64
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
65
+
56
66
  relevance : typing.Optional[float]
57
67
  The minimum search relevance score required to include the result. By default, this is 10.0.
58
68
 
@@ -77,57 +87,17 @@ class SearchClient:
77
87
  query="my search query",
78
88
  )
79
89
  """
80
- _response = self._client_wrapper.httpx_client.request(
81
- f"v1/search/{jsonable_encoder(id)}",
82
- method="POST",
83
- params={
84
- "n": n,
85
- "nextToken": next_token,
86
- "verbosity": verbosity,
87
- },
88
- json={
89
- "query": query,
90
- "relevance": relevance,
91
- },
92
- headers={
93
- "content-type": "application/json",
94
- },
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,
95
98
  request_options=request_options,
96
- omit=OMIT,
97
99
  )
98
- try:
99
- if 200 <= _response.status_code < 300:
100
- return typing.cast(
101
- SearchResponse,
102
- parse_obj_as(
103
- type_=SearchResponse, # type: ignore
104
- object_=_response.json(),
105
- ),
106
- )
107
- if _response.status_code == 400:
108
- raise BadRequestError(
109
- typing.cast(
110
- typing.Optional[typing.Any],
111
- parse_obj_as(
112
- type_=typing.Optional[typing.Any], # type: ignore
113
- object_=_response.json(),
114
- ),
115
- )
116
- )
117
- if _response.status_code == 401:
118
- raise UnauthorizedError(
119
- typing.cast(
120
- typing.Optional[typing.Any],
121
- parse_obj_as(
122
- type_=typing.Optional[typing.Any], # type: ignore
123
- object_=_response.json(),
124
- ),
125
- )
126
- )
127
- _response_json = _response.json()
128
- except JSONDecodeError:
129
- raise ApiError(status_code=_response.status_code, body=_response.text)
130
- raise ApiError(status_code=_response.status_code, body=_response_json)
100
+ return _response.data
131
101
 
132
102
  def documents(
133
103
  self,
@@ -137,6 +107,7 @@ class SearchClient:
137
107
  n: typing.Optional[int] = None,
138
108
  next_token: typing.Optional[str] = None,
139
109
  verbosity: typing.Optional[int] = None,
110
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
140
111
  relevance: typing.Optional[float] = OMIT,
141
112
  request_options: typing.Optional[RequestOptions] = None,
142
113
  ) -> SearchResponse:
@@ -161,6 +132,9 @@ class SearchClient:
161
132
  verbosity : typing.Optional[int]
162
133
  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.
163
134
 
135
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
136
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
137
+
164
138
  relevance : typing.Optional[float]
165
139
  The minimum search relevance score required to include the result. By default, this is 10.0.
166
140
 
@@ -185,63 +159,33 @@ class SearchClient:
185
159
  document_ids=["docUUID1", "docUUID2"],
186
160
  )
187
161
  """
188
- _response = self._client_wrapper.httpx_client.request(
189
- "v1/search/documents",
190
- method="POST",
191
- params={
192
- "n": n,
193
- "nextToken": next_token,
194
- "verbosity": verbosity,
195
- },
196
- json={
197
- "query": query,
198
- "documentIds": document_ids,
199
- "relevance": relevance,
200
- },
201
- headers={
202
- "content-type": "application/json",
203
- },
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,
204
170
  request_options=request_options,
205
- omit=OMIT,
206
171
  )
207
- try:
208
- if 200 <= _response.status_code < 300:
209
- return typing.cast(
210
- SearchResponse,
211
- parse_obj_as(
212
- type_=SearchResponse, # type: ignore
213
- object_=_response.json(),
214
- ),
215
- )
216
- if _response.status_code == 400:
217
- raise BadRequestError(
218
- typing.cast(
219
- typing.Optional[typing.Any],
220
- parse_obj_as(
221
- type_=typing.Optional[typing.Any], # type: ignore
222
- object_=_response.json(),
223
- ),
224
- )
225
- )
226
- if _response.status_code == 401:
227
- raise UnauthorizedError(
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
- _response_json = _response.json()
237
- except JSONDecodeError:
238
- raise ApiError(status_code=_response.status_code, body=_response.text)
239
- raise ApiError(status_code=_response.status_code, body=_response_json)
172
+ return _response.data
240
173
 
241
174
 
242
175
  class AsyncSearchClient:
243
176
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
244
- 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
245
189
 
246
190
  async def content(
247
191
  self,
@@ -251,6 +195,7 @@ class AsyncSearchClient:
251
195
  n: typing.Optional[int] = None,
252
196
  next_token: typing.Optional[str] = None,
253
197
  verbosity: typing.Optional[int] = None,
198
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
254
199
  relevance: typing.Optional[float] = OMIT,
255
200
  request_options: typing.Optional[RequestOptions] = None,
256
201
  ) -> SearchResponse:
@@ -261,7 +206,7 @@ class AsyncSearchClient:
261
206
  Parameters
262
207
  ----------
263
208
  id : SearchContentRequestId
264
- 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.
209
+ The bucketId, groupId, 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.
265
210
 
266
211
  query : str
267
212
  The search query to be used to find relevant documentation.
@@ -275,6 +220,9 @@ class AsyncSearchClient:
275
220
  verbosity : typing.Optional[int]
276
221
  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.
277
222
 
223
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
224
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
225
+
278
226
  relevance : typing.Optional[float]
279
227
  The minimum search relevance score required to include the result. By default, this is 10.0.
280
228
 
@@ -307,57 +255,17 @@ class AsyncSearchClient:
307
255
 
308
256
  asyncio.run(main())
309
257
  """
310
- _response = await self._client_wrapper.httpx_client.request(
311
- f"v1/search/{jsonable_encoder(id)}",
312
- method="POST",
313
- params={
314
- "n": n,
315
- "nextToken": next_token,
316
- "verbosity": verbosity,
317
- },
318
- json={
319
- "query": query,
320
- "relevance": relevance,
321
- },
322
- headers={
323
- "content-type": "application/json",
324
- },
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,
325
266
  request_options=request_options,
326
- omit=OMIT,
327
267
  )
328
- try:
329
- if 200 <= _response.status_code < 300:
330
- return typing.cast(
331
- SearchResponse,
332
- parse_obj_as(
333
- type_=SearchResponse, # type: ignore
334
- object_=_response.json(),
335
- ),
336
- )
337
- if _response.status_code == 400:
338
- raise BadRequestError(
339
- typing.cast(
340
- typing.Optional[typing.Any],
341
- parse_obj_as(
342
- type_=typing.Optional[typing.Any], # type: ignore
343
- object_=_response.json(),
344
- ),
345
- )
346
- )
347
- if _response.status_code == 401:
348
- raise UnauthorizedError(
349
- typing.cast(
350
- typing.Optional[typing.Any],
351
- parse_obj_as(
352
- type_=typing.Optional[typing.Any], # type: ignore
353
- object_=_response.json(),
354
- ),
355
- )
356
- )
357
- _response_json = _response.json()
358
- except JSONDecodeError:
359
- raise ApiError(status_code=_response.status_code, body=_response.text)
360
- raise ApiError(status_code=_response.status_code, body=_response_json)
268
+ return _response.data
361
269
 
362
270
  async def documents(
363
271
  self,
@@ -367,6 +275,7 @@ class AsyncSearchClient:
367
275
  n: typing.Optional[int] = None,
368
276
  next_token: typing.Optional[str] = None,
369
277
  verbosity: typing.Optional[int] = None,
278
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
370
279
  relevance: typing.Optional[float] = OMIT,
371
280
  request_options: typing.Optional[RequestOptions] = None,
372
281
  ) -> SearchResponse:
@@ -391,6 +300,9 @@ class AsyncSearchClient:
391
300
  verbosity : typing.Optional[int]
392
301
  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.
393
302
 
303
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
304
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
305
+
394
306
  relevance : typing.Optional[float]
395
307
  The minimum search relevance score required to include the result. By default, this is 10.0.
396
308
 
@@ -423,55 +335,14 @@ class AsyncSearchClient:
423
335
 
424
336
  asyncio.run(main())
425
337
  """
426
- _response = await self._client_wrapper.httpx_client.request(
427
- "v1/search/documents",
428
- method="POST",
429
- params={
430
- "n": n,
431
- "nextToken": next_token,
432
- "verbosity": verbosity,
433
- },
434
- json={
435
- "query": query,
436
- "documentIds": document_ids,
437
- "relevance": relevance,
438
- },
439
- headers={
440
- "content-type": "application/json",
441
- },
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,
442
346
  request_options=request_options,
443
- omit=OMIT,
444
347
  )
445
- try:
446
- if 200 <= _response.status_code < 300:
447
- return typing.cast(
448
- SearchResponse,
449
- parse_obj_as(
450
- type_=SearchResponse, # type: ignore
451
- object_=_response.json(),
452
- ),
453
- )
454
- if _response.status_code == 400:
455
- raise BadRequestError(
456
- typing.cast(
457
- typing.Optional[typing.Any],
458
- parse_obj_as(
459
- type_=typing.Optional[typing.Any], # type: ignore
460
- object_=_response.json(),
461
- ),
462
- )
463
- )
464
- if _response.status_code == 401:
465
- raise UnauthorizedError(
466
- typing.cast(
467
- typing.Optional[typing.Any],
468
- parse_obj_as(
469
- type_=typing.Optional[typing.Any], # type: ignore
470
- object_=_response.json(),
471
- ),
472
- )
473
- )
474
- _response_json = _response.json()
475
- except JSONDecodeError:
476
- raise ApiError(status_code=_response.status_code, body=_response.text)
477
- raise ApiError(status_code=_response.status_code, body=_response_json)
348
+ return _response.data