groundx 2.0.15__py3-none-any.whl → 2.7.7__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 (147) hide show
  1. groundx/__init__.py +73 -21
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +55 -388
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +22 -21
  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 +76 -32
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +71 -112
  14. groundx/core/serialization.py +7 -3
  15. groundx/csv_splitter.py +64 -0
  16. groundx/customer/__init__.py +2 -0
  17. groundx/customer/client.py +31 -43
  18. groundx/customer/raw_client.py +91 -0
  19. groundx/documents/__init__.py +1 -2
  20. groundx/documents/client.py +455 -953
  21. groundx/documents/raw_client.py +1450 -0
  22. groundx/errors/__init__.py +2 -0
  23. groundx/errors/bad_request_error.py +4 -3
  24. groundx/errors/unauthorized_error.py +4 -3
  25. groundx/extract/__init__.py +48 -0
  26. groundx/extract/agents/__init__.py +7 -0
  27. groundx/extract/agents/agent.py +202 -0
  28. groundx/extract/classes/__init__.py +24 -0
  29. groundx/extract/classes/agent.py +23 -0
  30. groundx/extract/classes/api.py +15 -0
  31. groundx/extract/classes/document.py +338 -0
  32. groundx/extract/classes/field.py +88 -0
  33. groundx/extract/classes/groundx.py +147 -0
  34. groundx/extract/classes/prompt.py +36 -0
  35. groundx/extract/classes/test_document.py +109 -0
  36. groundx/extract/classes/test_field.py +43 -0
  37. groundx/extract/classes/test_groundx.py +223 -0
  38. groundx/extract/classes/test_prompt.py +68 -0
  39. groundx/extract/post_process/__init__.py +7 -0
  40. groundx/extract/post_process/post_process.py +33 -0
  41. groundx/extract/services/.DS_Store +0 -0
  42. groundx/extract/services/__init__.py +14 -0
  43. groundx/extract/services/csv.py +76 -0
  44. groundx/extract/services/logger.py +126 -0
  45. groundx/extract/services/logging_cfg.py +53 -0
  46. groundx/extract/services/ratelimit.py +104 -0
  47. groundx/extract/services/sheets_client.py +160 -0
  48. groundx/extract/services/status.py +197 -0
  49. groundx/extract/services/upload.py +68 -0
  50. groundx/extract/services/upload_minio.py +122 -0
  51. groundx/extract/services/upload_s3.py +91 -0
  52. groundx/extract/services/utility.py +52 -0
  53. groundx/extract/settings/__init__.py +15 -0
  54. groundx/extract/settings/settings.py +212 -0
  55. groundx/extract/settings/test_settings.py +512 -0
  56. groundx/extract/tasks/__init__.py +6 -0
  57. groundx/extract/tasks/utility.py +27 -0
  58. groundx/extract/utility/__init__.py +15 -0
  59. groundx/extract/utility/classes.py +193 -0
  60. groundx/extract/utility/test_utility.py +81 -0
  61. groundx/groups/__init__.py +2 -0
  62. groundx/groups/client.py +63 -550
  63. groundx/groups/raw_client.py +901 -0
  64. groundx/health/__init__.py +2 -0
  65. groundx/health/client.py +35 -101
  66. groundx/health/raw_client.py +193 -0
  67. groundx/ingest.py +771 -0
  68. groundx/search/__init__.py +2 -0
  69. groundx/search/client.py +94 -227
  70. groundx/search/raw_client.py +442 -0
  71. groundx/search/types/__init__.py +2 -0
  72. groundx/types/__init__.py +68 -16
  73. groundx/types/bounding_box_detail.py +4 -4
  74. groundx/types/bucket_detail.py +5 -5
  75. groundx/types/bucket_list_response.py +17 -3
  76. groundx/types/bucket_response.py +3 -3
  77. groundx/types/bucket_update_detail.py +4 -4
  78. groundx/types/bucket_update_response.py +3 -3
  79. groundx/types/customer_detail.py +2 -2
  80. groundx/types/customer_response.py +3 -3
  81. groundx/types/document.py +54 -0
  82. groundx/types/document_detail.py +16 -4
  83. groundx/types/document_list_response.py +4 -4
  84. groundx/types/document_local_ingest_request.py +7 -0
  85. groundx/types/document_lookup_response.py +8 -3
  86. groundx/types/document_response.py +3 -3
  87. groundx/types/document_type.py +21 -1
  88. groundx/types/group_detail.py +4 -4
  89. groundx/types/group_list_response.py +17 -3
  90. groundx/types/group_response.py +3 -3
  91. groundx/types/health_response.py +3 -3
  92. groundx/types/health_response_health.py +3 -3
  93. groundx/types/health_service.py +5 -5
  94. groundx/types/ingest_local_document.py +25 -0
  95. groundx/types/ingest_local_document_metadata.py +51 -0
  96. groundx/types/ingest_remote_document.py +15 -6
  97. groundx/types/ingest_response.py +4 -4
  98. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  99. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  100. groundx/types/ingest_status_progress.py +26 -0
  101. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  102. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  103. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  104. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  105. groundx/types/message_response.py +2 -2
  106. groundx/types/meter_detail.py +2 -2
  107. groundx/types/process_level.py +5 -0
  108. groundx/types/{process_status_response.py → processes_status_response.py} +8 -5
  109. groundx/types/processing_status.py +3 -1
  110. groundx/types/search_response.py +3 -3
  111. groundx/types/search_response_search.py +3 -3
  112. groundx/types/search_result_item.py +7 -5
  113. groundx/types/search_result_item_pages_item.py +41 -0
  114. groundx/types/subscription_detail.py +3 -3
  115. groundx/types/subscription_detail_meters.py +5 -5
  116. groundx/{documents/types/website_crawl_request_websites_item.py → types/website_source.py} +7 -7
  117. groundx/types/workflow_apply_request.py +24 -0
  118. groundx/types/workflow_detail.py +59 -0
  119. groundx/types/workflow_detail_chunk_strategy.py +5 -0
  120. groundx/types/workflow_detail_relationships.py +36 -0
  121. groundx/types/workflow_engine.py +58 -0
  122. groundx/types/workflow_engine_reasoning_effort.py +5 -0
  123. groundx/types/workflow_engine_service.py +7 -0
  124. groundx/types/workflow_prompt.py +37 -0
  125. groundx/types/workflow_prompt_group.py +25 -0
  126. groundx/types/workflow_prompt_role.py +5 -0
  127. groundx/types/workflow_request.py +31 -0
  128. groundx/types/workflow_request_chunk_strategy.py +5 -0
  129. groundx/types/workflow_response.py +20 -0
  130. groundx/types/workflow_step.py +33 -0
  131. groundx/types/workflow_step_config.py +33 -0
  132. groundx/types/workflow_step_config_field.py +8 -0
  133. groundx/types/workflow_steps.py +38 -0
  134. groundx/types/workflows_response.py +20 -0
  135. groundx/workflows/__init__.py +7 -0
  136. groundx/workflows/client.py +736 -0
  137. groundx/workflows/raw_client.py +841 -0
  138. groundx/workflows/types/__init__.py +7 -0
  139. groundx/workflows/types/workflows_get_request_id.py +5 -0
  140. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/LICENSE +1 -1
  141. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/METADATA +39 -22
  142. groundx-2.7.7.dist-info/RECORD +155 -0
  143. groundx/documents/types/__init__.py +0 -6
  144. groundx/documents/types/documents_ingest_local_request_files_item.py +0 -43
  145. groundx/types/process_status_response_ingest_progress.py +0 -26
  146. groundx-2.0.15.dist-info/RECORD +0 -82
  147. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/WHEEL +0 -0
@@ -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"]
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,20 +35,18 @@ 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:
35
42
  """
36
43
  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.
44
+ 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.
41
45
 
42
46
  Parameters
43
47
  ----------
44
48
  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.
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.
46
50
 
47
51
  query : str
48
52
  The search query to be used to find relevant documentation.
@@ -56,6 +60,9 @@ class SearchClient:
56
60
  verbosity : typing.Optional[int]
57
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.
58
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
+
59
66
  relevance : typing.Optional[float]
60
67
  The minimum search relevance score required to include the result. By default, this is 10.0.
61
68
 
@@ -76,61 +83,23 @@ class SearchClient:
76
83
  )
77
84
  client.search.content(
78
85
  id=1,
86
+ n=1,
79
87
  next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
88
+ verbosity=1,
80
89
  query="my search query",
81
90
  )
82
91
  """
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
- },
92
+ _response = self._raw_client.content(
93
+ id,
94
+ query=query,
95
+ n=n,
96
+ next_token=next_token,
97
+ verbosity=verbosity,
98
+ filter=filter,
99
+ relevance=relevance,
98
100
  request_options=request_options,
99
- omit=OMIT,
100
101
  )
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)
102
+ return _response.data
134
103
 
135
104
  def documents(
136
105
  self,
@@ -140,15 +109,13 @@ class SearchClient:
140
109
  n: typing.Optional[int] = None,
141
110
  next_token: typing.Optional[str] = None,
142
111
  verbosity: typing.Optional[int] = None,
112
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
143
113
  relevance: typing.Optional[float] = OMIT,
144
114
  request_options: typing.Optional[RequestOptions] = None,
145
115
  ) -> SearchResponse:
146
116
  """
147
117
  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.
118
+ 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.
152
119
 
153
120
  Parameters
154
121
  ----------
@@ -167,6 +134,9 @@ class SearchClient:
167
134
  verbosity : typing.Optional[int]
168
135
  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
136
 
137
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
138
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
139
+
170
140
  relevance : typing.Optional[float]
171
141
  The minimum search relevance score required to include the result. By default, this is 10.0.
172
142
 
@@ -186,68 +156,40 @@ class SearchClient:
186
156
  api_key="YOUR_API_KEY",
187
157
  )
188
158
  client.search.documents(
159
+ n=1,
189
160
  next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
161
+ verbosity=1,
190
162
  query="my search query",
191
163
  document_ids=["docUUID1", "docUUID2"],
192
164
  )
193
165
  """
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
- },
166
+ _response = self._raw_client.documents(
167
+ query=query,
168
+ document_ids=document_ids,
169
+ n=n,
170
+ next_token=next_token,
171
+ verbosity=verbosity,
172
+ filter=filter,
173
+ relevance=relevance,
210
174
  request_options=request_options,
211
- omit=OMIT,
212
175
  )
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)
176
+ return _response.data
246
177
 
247
178
 
248
179
  class AsyncSearchClient:
249
180
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
250
- self._client_wrapper = client_wrapper
181
+ self._raw_client = AsyncRawSearchClient(client_wrapper=client_wrapper)
182
+
183
+ @property
184
+ def with_raw_response(self) -> AsyncRawSearchClient:
185
+ """
186
+ Retrieves a raw implementation of this client that returns raw responses.
187
+
188
+ Returns
189
+ -------
190
+ AsyncRawSearchClient
191
+ """
192
+ return self._raw_client
251
193
 
252
194
  async def content(
253
195
  self,
@@ -257,20 +199,18 @@ class AsyncSearchClient:
257
199
  n: typing.Optional[int] = None,
258
200
  next_token: typing.Optional[str] = None,
259
201
  verbosity: typing.Optional[int] = None,
202
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
260
203
  relevance: typing.Optional[float] = OMIT,
261
204
  request_options: typing.Optional[RequestOptions] = None,
262
205
  ) -> SearchResponse:
263
206
  """
264
207
  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.
208
+ 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.
269
209
 
270
210
  Parameters
271
211
  ----------
272
212
  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.
213
+ 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.
274
214
 
275
215
  query : str
276
216
  The search query to be used to find relevant documentation.
@@ -284,6 +224,9 @@ class AsyncSearchClient:
284
224
  verbosity : typing.Optional[int]
285
225
  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
226
 
227
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
228
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
229
+
287
230
  relevance : typing.Optional[float]
288
231
  The minimum search relevance score required to include the result. By default, this is 10.0.
289
232
 
@@ -309,64 +252,26 @@ class AsyncSearchClient:
309
252
  async def main() -> None:
310
253
  await client.search.content(
311
254
  id=1,
255
+ n=1,
312
256
  next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
257
+ verbosity=1,
313
258
  query="my search query",
314
259
  )
315
260
 
316
261
 
317
262
  asyncio.run(main())
318
263
  """
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
- },
264
+ _response = await self._raw_client.content(
265
+ id,
266
+ query=query,
267
+ n=n,
268
+ next_token=next_token,
269
+ verbosity=verbosity,
270
+ filter=filter,
271
+ relevance=relevance,
334
272
  request_options=request_options,
335
- omit=OMIT,
336
273
  )
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)
274
+ return _response.data
370
275
 
371
276
  async def documents(
372
277
  self,
@@ -376,15 +281,13 @@ class AsyncSearchClient:
376
281
  n: typing.Optional[int] = None,
377
282
  next_token: typing.Optional[str] = None,
378
283
  verbosity: typing.Optional[int] = None,
284
+ filter: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
379
285
  relevance: typing.Optional[float] = OMIT,
380
286
  request_options: typing.Optional[RequestOptions] = None,
381
287
  ) -> SearchResponse:
382
288
  """
383
289
  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.
290
+ 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.
388
291
 
389
292
  Parameters
390
293
  ----------
@@ -403,6 +306,9 @@ class AsyncSearchClient:
403
306
  verbosity : typing.Optional[int]
404
307
  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
308
 
309
+ filter : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
310
+ A dictionary of key-value pairs that can be used to pre-filter documents prior to a search.
311
+
406
312
  relevance : typing.Optional[float]
407
313
  The minimum search relevance score required to include the result. By default, this is 10.0.
408
314
 
@@ -427,7 +333,9 @@ class AsyncSearchClient:
427
333
 
428
334
  async def main() -> None:
429
335
  await client.search.documents(
336
+ n=1,
430
337
  next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
338
+ verbosity=1,
431
339
  query="my search query",
432
340
  document_ids=["docUUID1", "docUUID2"],
433
341
  )
@@ -435,55 +343,14 @@ class AsyncSearchClient:
435
343
 
436
344
  asyncio.run(main())
437
345
  """
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
- },
346
+ _response = await self._raw_client.documents(
347
+ query=query,
348
+ document_ids=document_ids,
349
+ n=n,
350
+ next_token=next_token,
351
+ verbosity=verbosity,
352
+ filter=filter,
353
+ relevance=relevance,
454
354
  request_options=request_options,
455
- omit=OMIT,
456
355
  )
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)
356
+ return _response.data