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
@@ -1,2 +1,4 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ # isort: skip_file
4
+
groundx/health/client.py CHANGED
@@ -1,20 +1,27 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ..core.client_wrapper import SyncClientWrapper
4
3
  import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
5
6
  from ..core.request_options import RequestOptions
6
7
  from ..types.health_response import HealthResponse
7
- from ..core.pydantic_utilities import parse_obj_as
8
- from json.decoder import JSONDecodeError
9
- from ..core.api_error import ApiError
10
- from ..core.jsonable_encoder import jsonable_encoder
11
- from ..errors.bad_request_error import BadRequestError
12
- from ..core.client_wrapper import AsyncClientWrapper
8
+ from .raw_client import AsyncRawHealthClient, RawHealthClient
13
9
 
14
10
 
15
11
  class HealthClient:
16
12
  def __init__(self, *, client_wrapper: SyncClientWrapper):
17
- self._client_wrapper = client_wrapper
13
+ self._raw_client = RawHealthClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawHealthClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawHealthClient
23
+ """
24
+ return self._raw_client
18
25
 
19
26
  def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthResponse:
20
27
  """
@@ -39,24 +46,8 @@ class HealthClient:
39
46
  )
40
47
  client.health.list()
41
48
  """
42
- _response = self._client_wrapper.httpx_client.request(
43
- "v1/health",
44
- method="GET",
45
- request_options=request_options,
46
- )
47
- try:
48
- if 200 <= _response.status_code < 300:
49
- return typing.cast(
50
- HealthResponse,
51
- parse_obj_as(
52
- type_=HealthResponse, # type: ignore
53
- object_=_response.json(),
54
- ),
55
- )
56
- _response_json = _response.json()
57
- except JSONDecodeError:
58
- raise ApiError(status_code=_response.status_code, body=_response.text)
59
- raise ApiError(status_code=_response.status_code, body=_response_json)
49
+ _response = self._raw_client.list(request_options=request_options)
50
+ return _response.data
60
51
 
61
52
  def get(self, service: str, *, request_options: typing.Optional[RequestOptions] = None) -> HealthResponse:
62
53
  """
@@ -86,39 +77,24 @@ class HealthClient:
86
77
  service="search",
87
78
  )
88
79
  """
89
- _response = self._client_wrapper.httpx_client.request(
90
- f"v1/health/{jsonable_encoder(service)}",
91
- method="GET",
92
- request_options=request_options,
93
- )
94
- try:
95
- if 200 <= _response.status_code < 300:
96
- return typing.cast(
97
- HealthResponse,
98
- parse_obj_as(
99
- type_=HealthResponse, # type: ignore
100
- object_=_response.json(),
101
- ),
102
- )
103
- if _response.status_code == 400:
104
- raise BadRequestError(
105
- typing.cast(
106
- typing.Optional[typing.Any],
107
- parse_obj_as(
108
- type_=typing.Optional[typing.Any], # type: ignore
109
- object_=_response.json(),
110
- ),
111
- )
112
- )
113
- _response_json = _response.json()
114
- except JSONDecodeError:
115
- raise ApiError(status_code=_response.status_code, body=_response.text)
116
- raise ApiError(status_code=_response.status_code, body=_response_json)
80
+ _response = self._raw_client.get(service, request_options=request_options)
81
+ return _response.data
117
82
 
118
83
 
119
84
  class AsyncHealthClient:
120
85
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
121
- self._client_wrapper = client_wrapper
86
+ self._raw_client = AsyncRawHealthClient(client_wrapper=client_wrapper)
87
+
88
+ @property
89
+ def with_raw_response(self) -> AsyncRawHealthClient:
90
+ """
91
+ Retrieves a raw implementation of this client that returns raw responses.
92
+
93
+ Returns
94
+ -------
95
+ AsyncRawHealthClient
96
+ """
97
+ return self._raw_client
122
98
 
123
99
  async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthResponse:
124
100
  """
@@ -151,24 +127,8 @@ class AsyncHealthClient:
151
127
 
152
128
  asyncio.run(main())
153
129
  """
154
- _response = await self._client_wrapper.httpx_client.request(
155
- "v1/health",
156
- method="GET",
157
- request_options=request_options,
158
- )
159
- try:
160
- if 200 <= _response.status_code < 300:
161
- return typing.cast(
162
- HealthResponse,
163
- parse_obj_as(
164
- type_=HealthResponse, # type: ignore
165
- object_=_response.json(),
166
- ),
167
- )
168
- _response_json = _response.json()
169
- except JSONDecodeError:
170
- raise ApiError(status_code=_response.status_code, body=_response.text)
171
- raise ApiError(status_code=_response.status_code, body=_response_json)
130
+ _response = await self._raw_client.list(request_options=request_options)
131
+ return _response.data
172
132
 
173
133
  async def get(self, service: str, *, request_options: typing.Optional[RequestOptions] = None) -> HealthResponse:
174
134
  """
@@ -206,31 +166,5 @@ class AsyncHealthClient:
206
166
 
207
167
  asyncio.run(main())
208
168
  """
209
- _response = await self._client_wrapper.httpx_client.request(
210
- f"v1/health/{jsonable_encoder(service)}",
211
- method="GET",
212
- request_options=request_options,
213
- )
214
- try:
215
- if 200 <= _response.status_code < 300:
216
- return typing.cast(
217
- HealthResponse,
218
- parse_obj_as(
219
- type_=HealthResponse, # type: ignore
220
- object_=_response.json(),
221
- ),
222
- )
223
- if _response.status_code == 400:
224
- raise BadRequestError(
225
- typing.cast(
226
- typing.Optional[typing.Any],
227
- parse_obj_as(
228
- type_=typing.Optional[typing.Any], # type: ignore
229
- object_=_response.json(),
230
- ),
231
- )
232
- )
233
- _response_json = _response.json()
234
- except JSONDecodeError:
235
- raise ApiError(status_code=_response.status_code, body=_response.text)
236
- raise ApiError(status_code=_response.status_code, body=_response_json)
169
+ _response = await self._raw_client.get(service, request_options=request_options)
170
+ return _response.data
@@ -0,0 +1,193 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.bad_request_error import BadRequestError
13
+ from ..types.health_response import HealthResponse
14
+
15
+
16
+ class RawHealthClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[HealthResponse]:
21
+ """
22
+ List the current health status of all services. Statuses update every 5 minutes.
23
+
24
+ Parameters
25
+ ----------
26
+ request_options : typing.Optional[RequestOptions]
27
+ Request-specific configuration.
28
+
29
+ Returns
30
+ -------
31
+ HttpResponse[HealthResponse]
32
+ Look up success
33
+ """
34
+ _response = self._client_wrapper.httpx_client.request(
35
+ "v1/health",
36
+ method="GET",
37
+ request_options=request_options,
38
+ )
39
+ try:
40
+ if 200 <= _response.status_code < 300:
41
+ _data = typing.cast(
42
+ HealthResponse,
43
+ parse_obj_as(
44
+ type_=HealthResponse, # type: ignore
45
+ object_=_response.json(),
46
+ ),
47
+ )
48
+ return HttpResponse(response=_response, data=_data)
49
+ _response_json = _response.json()
50
+ except JSONDecodeError:
51
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
52
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
53
+
54
+ def get(
55
+ self, service: str, *, request_options: typing.Optional[RequestOptions] = None
56
+ ) -> HttpResponse[HealthResponse]:
57
+ """
58
+ Look up the current health status of a specific service. Statuses update every 5 minutes.
59
+
60
+ Parameters
61
+ ----------
62
+ service : str
63
+ The name of the service to look up.
64
+
65
+ request_options : typing.Optional[RequestOptions]
66
+ Request-specific configuration.
67
+
68
+ Returns
69
+ -------
70
+ HttpResponse[HealthResponse]
71
+ Look up success
72
+ """
73
+ _response = self._client_wrapper.httpx_client.request(
74
+ f"v1/health/{jsonable_encoder(service)}",
75
+ method="GET",
76
+ request_options=request_options,
77
+ )
78
+ try:
79
+ if 200 <= _response.status_code < 300:
80
+ _data = typing.cast(
81
+ HealthResponse,
82
+ parse_obj_as(
83
+ type_=HealthResponse, # type: ignore
84
+ object_=_response.json(),
85
+ ),
86
+ )
87
+ return HttpResponse(response=_response, data=_data)
88
+ if _response.status_code == 400:
89
+ raise BadRequestError(
90
+ headers=dict(_response.headers),
91
+ body=typing.cast(
92
+ typing.Optional[typing.Any],
93
+ parse_obj_as(
94
+ type_=typing.Optional[typing.Any], # type: ignore
95
+ object_=_response.json(),
96
+ ),
97
+ ),
98
+ )
99
+ _response_json = _response.json()
100
+ except JSONDecodeError:
101
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
102
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
103
+
104
+
105
+ class AsyncRawHealthClient:
106
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
107
+ self._client_wrapper = client_wrapper
108
+
109
+ async def list(
110
+ self, *, request_options: typing.Optional[RequestOptions] = None
111
+ ) -> AsyncHttpResponse[HealthResponse]:
112
+ """
113
+ List the current health status of all services. Statuses update every 5 minutes.
114
+
115
+ Parameters
116
+ ----------
117
+ request_options : typing.Optional[RequestOptions]
118
+ Request-specific configuration.
119
+
120
+ Returns
121
+ -------
122
+ AsyncHttpResponse[HealthResponse]
123
+ Look up success
124
+ """
125
+ _response = await self._client_wrapper.httpx_client.request(
126
+ "v1/health",
127
+ method="GET",
128
+ request_options=request_options,
129
+ )
130
+ try:
131
+ if 200 <= _response.status_code < 300:
132
+ _data = typing.cast(
133
+ HealthResponse,
134
+ parse_obj_as(
135
+ type_=HealthResponse, # type: ignore
136
+ object_=_response.json(),
137
+ ),
138
+ )
139
+ return AsyncHttpResponse(response=_response, data=_data)
140
+ _response_json = _response.json()
141
+ except JSONDecodeError:
142
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
143
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
144
+
145
+ async def get(
146
+ self, service: str, *, request_options: typing.Optional[RequestOptions] = None
147
+ ) -> AsyncHttpResponse[HealthResponse]:
148
+ """
149
+ Look up the current health status of a specific service. Statuses update every 5 minutes.
150
+
151
+ Parameters
152
+ ----------
153
+ service : str
154
+ The name of the service to look up.
155
+
156
+ request_options : typing.Optional[RequestOptions]
157
+ Request-specific configuration.
158
+
159
+ Returns
160
+ -------
161
+ AsyncHttpResponse[HealthResponse]
162
+ Look up success
163
+ """
164
+ _response = await self._client_wrapper.httpx_client.request(
165
+ f"v1/health/{jsonable_encoder(service)}",
166
+ method="GET",
167
+ request_options=request_options,
168
+ )
169
+ try:
170
+ if 200 <= _response.status_code < 300:
171
+ _data = typing.cast(
172
+ HealthResponse,
173
+ parse_obj_as(
174
+ type_=HealthResponse, # type: ignore
175
+ object_=_response.json(),
176
+ ),
177
+ )
178
+ return AsyncHttpResponse(response=_response, data=_data)
179
+ if _response.status_code == 400:
180
+ raise BadRequestError(
181
+ headers=dict(_response.headers),
182
+ body=typing.cast(
183
+ typing.Optional[typing.Any],
184
+ parse_obj_as(
185
+ type_=typing.Optional[typing.Any], # type: ignore
186
+ object_=_response.json(),
187
+ ),
188
+ ),
189
+ )
190
+ _response_json = _response.json()
191
+ except JSONDecodeError:
192
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
193
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
groundx/ingest.py CHANGED
@@ -9,7 +9,7 @@ from .csv_splitter import CSVSplitter
9
9
  from .types.document import Document
10
10
  from .types.ingest_remote_document import IngestRemoteDocument
11
11
  from .types.ingest_response import IngestResponse
12
- from .types.ingest_response_ingest import IngestResponseIngest
12
+ from .types.ingest_status import IngestStatus
13
13
 
14
14
  # this is used as the default value for optional parameters
15
15
  OMIT = typing.cast(typing.Any, ...)
@@ -201,7 +201,7 @@ class GroundX(GroundXBase):
201
201
  n = max(MIN_BATCH_SIZE, min(batch_size or MIN_BATCH_SIZE, MAX_BATCH_SIZE))
202
202
 
203
203
  remote_batch: typing.List[IngestRemoteDocument] = []
204
- ingest = IngestResponse(ingest=IngestResponseIngest(process_id="",status="queued"))
204
+ ingest = IngestResponse(ingest=IngestStatus(process_id="",status="queued"))
205
205
 
206
206
  progress = float(len(remote_documents))
207
207
  for rd in remote_documents:
@@ -1,5 +1,7 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ # isort: skip_file
4
+
3
5
  from .types import SearchContentRequestId
4
6
 
5
7
  __all__ = ["SearchContentRequestId"]