lambdadb 0.3.5__py3-none-any.whl → 0.4.0__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.

Potentially problematic release.


This version of lambdadb might be problematic. Click here for more details.

Files changed (37) hide show
  1. lambdadb/_version.py +3 -3
  2. lambdadb/basesdk.py +4 -4
  3. lambdadb/collections.py +280 -452
  4. lambdadb/docs.py +261 -425
  5. lambdadb/errors/__init__.py +9 -0
  6. lambdadb/errors/apierror.py +30 -14
  7. lambdadb/errors/badrequest_error.py +12 -6
  8. lambdadb/errors/internalservererror.py +12 -6
  9. lambdadb/errors/lambdadberror.py +26 -0
  10. lambdadb/errors/no_response_error.py +13 -0
  11. lambdadb/errors/resourcealreadyexists_error.py +12 -6
  12. lambdadb/errors/resourcenotfound_error.py +12 -6
  13. lambdadb/errors/responsevalidationerror.py +25 -0
  14. lambdadb/errors/toomanyrequests_error.py +12 -6
  15. lambdadb/errors/unauthenticated_error.py +12 -6
  16. lambdadb/models/__init__.py +0 -54
  17. lambdadb/models/bulkupsertdocsop.py +0 -9
  18. lambdadb/models/createcollectionop.py +2 -23
  19. lambdadb/models/deletecollectionop.py +0 -9
  20. lambdadb/models/deletedocsop.py +3 -20
  21. lambdadb/models/fetchdocsop.py +3 -20
  22. lambdadb/models/getbulkupsertdocsop.py +0 -9
  23. lambdadb/models/getcollectionop.py +0 -9
  24. lambdadb/models/listcollectionsop.py +1 -17
  25. lambdadb/models/querycollectionop.py +7 -40
  26. lambdadb/models/updatecollectionop.py +0 -9
  27. lambdadb/models/updatedocsop.py +3 -20
  28. lambdadb/models/upsertdocsop.py +3 -20
  29. lambdadb/sdk.py +9 -1
  30. lambdadb/sdkconfiguration.py +4 -3
  31. lambdadb/utils/__init__.py +3 -0
  32. lambdadb/utils/serializers.py +21 -3
  33. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/METADATA +94 -55
  34. lambdadb-0.4.0.dist-info/RECORD +64 -0
  35. lambdadb-0.3.5.dist-info/RECORD +0 -61
  36. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/LICENSE +0 -0
  37. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/WHEEL +0 -0
lambdadb/collections.py CHANGED
@@ -21,10 +21,9 @@ class Collections(BaseSDK):
21
21
  def _init_sdks(self):
22
22
  self.docs = Docs(self.sdk_configuration)
23
23
 
24
- def list(
24
+ def list_collections(
25
25
  self,
26
26
  *,
27
- project_name: str,
28
27
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
29
28
  server_url: Optional[str] = None,
30
29
  timeout_ms: Optional[int] = None,
@@ -32,7 +31,6 @@ class Collections(BaseSDK):
32
31
  ) -> models.ListCollectionsResponse:
33
32
  r"""List all collections in an existing project.
34
33
 
35
- :param project_name: Project name.
36
34
  :param retries: Override the default retry configuration for this method
37
35
  :param server_url: Override the default server URL for this method
38
36
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -47,19 +45,14 @@ class Collections(BaseSDK):
47
45
  base_url = server_url
48
46
  else:
49
47
  base_url = self._get_url(base_url, url_variables)
50
-
51
- request = models.ListCollectionsRequest(
52
- project_name=project_name,
53
- )
54
-
55
48
  req = self._build_request(
56
49
  method="GET",
57
- path="/projects/{projectName}/collections",
50
+ path="/collections",
58
51
  base_url=base_url,
59
52
  url_variables=url_variables,
60
- request=request,
53
+ request=None,
61
54
  request_body_required=False,
62
- request_has_path_params=True,
55
+ request_has_path_params=False,
63
56
  request_has_query_params=True,
64
57
  user_agent_header="user-agent",
65
58
  accept_header_value="application/json",
@@ -97,51 +90,41 @@ class Collections(BaseSDK):
97
90
 
98
91
  response_data: Any = None
99
92
  if utils.match_response(http_res, "200", "application/json"):
100
- return utils.unmarshal_json(http_res.text, models.ListCollectionsResponse)
93
+ return utils.unmarshal_json_response(
94
+ models.ListCollectionsResponse, http_res
95
+ )
101
96
  if utils.match_response(http_res, "401", "application/json"):
102
- response_data = utils.unmarshal_json(
103
- http_res.text, errors.UnauthenticatedErrorData
97
+ response_data = utils.unmarshal_json_response(
98
+ errors.UnauthenticatedErrorData, http_res
104
99
  )
105
- raise errors.UnauthenticatedError(data=response_data)
100
+ raise errors.UnauthenticatedError(response_data, http_res)
106
101
  if utils.match_response(http_res, "404", "application/json"):
107
- response_data = utils.unmarshal_json(
108
- http_res.text, errors.ResourceNotFoundErrorData
102
+ response_data = utils.unmarshal_json_response(
103
+ errors.ResourceNotFoundErrorData, http_res
109
104
  )
110
- raise errors.ResourceNotFoundError(data=response_data)
105
+ raise errors.ResourceNotFoundError(response_data, http_res)
111
106
  if utils.match_response(http_res, "429", "application/json"):
112
- response_data = utils.unmarshal_json(
113
- http_res.text, errors.TooManyRequestsErrorData
107
+ response_data = utils.unmarshal_json_response(
108
+ errors.TooManyRequestsErrorData, http_res
114
109
  )
115
- raise errors.TooManyRequestsError(data=response_data)
110
+ raise errors.TooManyRequestsError(response_data, http_res)
116
111
  if utils.match_response(http_res, "500", "application/json"):
117
- response_data = utils.unmarshal_json(
118
- http_res.text, errors.InternalServerErrorData
112
+ response_data = utils.unmarshal_json_response(
113
+ errors.InternalServerErrorData, http_res
119
114
  )
120
- raise errors.InternalServerError(data=response_data)
115
+ raise errors.InternalServerError(response_data, http_res)
121
116
  if utils.match_response(http_res, "4XX", "*"):
122
117
  http_res_text = utils.stream_to_text(http_res)
123
- raise errors.APIError(
124
- "API error occurred", http_res.status_code, http_res_text, http_res
125
- )
118
+ raise errors.APIError("API error occurred", http_res, http_res_text)
126
119
  if utils.match_response(http_res, "5XX", "*"):
127
120
  http_res_text = utils.stream_to_text(http_res)
128
- raise errors.APIError(
129
- "API error occurred", http_res.status_code, http_res_text, http_res
130
- )
121
+ raise errors.APIError("API error occurred", http_res, http_res_text)
131
122
 
132
- content_type = http_res.headers.get("Content-Type")
133
- http_res_text = utils.stream_to_text(http_res)
134
- raise errors.APIError(
135
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
136
- http_res.status_code,
137
- http_res_text,
138
- http_res,
139
- )
123
+ raise errors.APIError("Unexpected response received", http_res)
140
124
 
141
- async def list_async(
125
+ async def list_collections_async(
142
126
  self,
143
127
  *,
144
- project_name: str,
145
128
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
146
129
  server_url: Optional[str] = None,
147
130
  timeout_ms: Optional[int] = None,
@@ -149,7 +132,6 @@ class Collections(BaseSDK):
149
132
  ) -> models.ListCollectionsResponse:
150
133
  r"""List all collections in an existing project.
151
134
 
152
- :param project_name: Project name.
153
135
  :param retries: Override the default retry configuration for this method
154
136
  :param server_url: Override the default server URL for this method
155
137
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -164,19 +146,14 @@ class Collections(BaseSDK):
164
146
  base_url = server_url
165
147
  else:
166
148
  base_url = self._get_url(base_url, url_variables)
167
-
168
- request = models.ListCollectionsRequest(
169
- project_name=project_name,
170
- )
171
-
172
149
  req = self._build_request_async(
173
150
  method="GET",
174
- path="/projects/{projectName}/collections",
151
+ path="/collections",
175
152
  base_url=base_url,
176
153
  url_variables=url_variables,
177
- request=request,
154
+ request=None,
178
155
  request_body_required=False,
179
- request_has_path_params=True,
156
+ request_has_path_params=False,
180
157
  request_has_query_params=True,
181
158
  user_agent_header="user-agent",
182
159
  accept_header_value="application/json",
@@ -214,51 +191,41 @@ class Collections(BaseSDK):
214
191
 
215
192
  response_data: Any = None
216
193
  if utils.match_response(http_res, "200", "application/json"):
217
- return utils.unmarshal_json(http_res.text, models.ListCollectionsResponse)
194
+ return utils.unmarshal_json_response(
195
+ models.ListCollectionsResponse, http_res
196
+ )
218
197
  if utils.match_response(http_res, "401", "application/json"):
219
- response_data = utils.unmarshal_json(
220
- http_res.text, errors.UnauthenticatedErrorData
198
+ response_data = utils.unmarshal_json_response(
199
+ errors.UnauthenticatedErrorData, http_res
221
200
  )
222
- raise errors.UnauthenticatedError(data=response_data)
201
+ raise errors.UnauthenticatedError(response_data, http_res)
223
202
  if utils.match_response(http_res, "404", "application/json"):
224
- response_data = utils.unmarshal_json(
225
- http_res.text, errors.ResourceNotFoundErrorData
203
+ response_data = utils.unmarshal_json_response(
204
+ errors.ResourceNotFoundErrorData, http_res
226
205
  )
227
- raise errors.ResourceNotFoundError(data=response_data)
206
+ raise errors.ResourceNotFoundError(response_data, http_res)
228
207
  if utils.match_response(http_res, "429", "application/json"):
229
- response_data = utils.unmarshal_json(
230
- http_res.text, errors.TooManyRequestsErrorData
208
+ response_data = utils.unmarshal_json_response(
209
+ errors.TooManyRequestsErrorData, http_res
231
210
  )
232
- raise errors.TooManyRequestsError(data=response_data)
211
+ raise errors.TooManyRequestsError(response_data, http_res)
233
212
  if utils.match_response(http_res, "500", "application/json"):
234
- response_data = utils.unmarshal_json(
235
- http_res.text, errors.InternalServerErrorData
213
+ response_data = utils.unmarshal_json_response(
214
+ errors.InternalServerErrorData, http_res
236
215
  )
237
- raise errors.InternalServerError(data=response_data)
216
+ raise errors.InternalServerError(response_data, http_res)
238
217
  if utils.match_response(http_res, "4XX", "*"):
239
218
  http_res_text = await utils.stream_to_text_async(http_res)
240
- raise errors.APIError(
241
- "API error occurred", http_res.status_code, http_res_text, http_res
242
- )
219
+ raise errors.APIError("API error occurred", http_res, http_res_text)
243
220
  if utils.match_response(http_res, "5XX", "*"):
244
221
  http_res_text = await utils.stream_to_text_async(http_res)
245
- raise errors.APIError(
246
- "API error occurred", http_res.status_code, http_res_text, http_res
247
- )
222
+ raise errors.APIError("API error occurred", http_res, http_res_text)
248
223
 
249
- content_type = http_res.headers.get("Content-Type")
250
- http_res_text = await utils.stream_to_text_async(http_res)
251
- raise errors.APIError(
252
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
253
- http_res.status_code,
254
- http_res_text,
255
- http_res,
256
- )
224
+ raise errors.APIError("Unexpected response received", http_res)
257
225
 
258
- def create(
226
+ def create_collection(
259
227
  self,
260
228
  *,
261
- project_name: str,
262
229
  collection_name: str,
263
230
  index_configs: Optional[
264
231
  Union[
@@ -277,7 +244,6 @@ class Collections(BaseSDK):
277
244
  ) -> models.CreateCollectionResponse:
278
245
  r"""Create a collection.
279
246
 
280
- :param project_name: Project name.
281
247
  :param collection_name: Collection name must be unique within a project and the supported maximum length is 52.
282
248
  :param index_configs:
283
249
  :param source_project_name:
@@ -300,38 +266,31 @@ class Collections(BaseSDK):
300
266
  base_url = self._get_url(base_url, url_variables)
301
267
 
302
268
  request = models.CreateCollectionRequest(
303
- project_name=project_name,
304
- request_body=models.CreateCollectionRequestBody(
305
- collection_name=collection_name,
306
- index_configs=utils.get_pydantic_model(
307
- index_configs, Optional[Dict[str, models.IndexConfigsUnion]]
308
- ),
309
- source_project_name=source_project_name,
310
- source_collection_name=source_collection_name,
311
- source_datetime=source_datetime,
312
- source_project_api_key=source_project_api_key,
269
+ collection_name=collection_name,
270
+ index_configs=utils.get_pydantic_model(
271
+ index_configs, Optional[Dict[str, models.IndexConfigsUnion]]
313
272
  ),
273
+ source_project_name=source_project_name,
274
+ source_collection_name=source_collection_name,
275
+ source_datetime=source_datetime,
276
+ source_project_api_key=source_project_api_key,
314
277
  )
315
278
 
316
279
  req = self._build_request(
317
280
  method="POST",
318
- path="/projects/{projectName}/collections",
281
+ path="/collections",
319
282
  base_url=base_url,
320
283
  url_variables=url_variables,
321
284
  request=request,
322
285
  request_body_required=True,
323
- request_has_path_params=True,
286
+ request_has_path_params=False,
324
287
  request_has_query_params=True,
325
288
  user_agent_header="user-agent",
326
289
  accept_header_value="application/json",
327
290
  http_headers=http_headers,
328
291
  security=self.sdk_configuration.security,
329
292
  get_serialized_body=lambda: utils.serialize_request_body(
330
- request.request_body,
331
- False,
332
- False,
333
- "json",
334
- models.CreateCollectionRequestBody,
293
+ request, False, False, "json", models.CreateCollectionRequest
335
294
  ),
336
295
  timeout_ms=timeout_ms,
337
296
  )
@@ -365,56 +324,46 @@ class Collections(BaseSDK):
365
324
 
366
325
  response_data: Any = None
367
326
  if utils.match_response(http_res, "202", "application/json"):
368
- return utils.unmarshal_json(http_res.text, models.CreateCollectionResponse)
327
+ return utils.unmarshal_json_response(
328
+ models.CreateCollectionResponse, http_res
329
+ )
369
330
  if utils.match_response(http_res, "400", "application/json"):
370
- response_data = utils.unmarshal_json(
371
- http_res.text, errors.BadRequestErrorData
331
+ response_data = utils.unmarshal_json_response(
332
+ errors.BadRequestErrorData, http_res
372
333
  )
373
- raise errors.BadRequestError(data=response_data)
334
+ raise errors.BadRequestError(response_data, http_res)
374
335
  if utils.match_response(http_res, "401", "application/json"):
375
- response_data = utils.unmarshal_json(
376
- http_res.text, errors.UnauthenticatedErrorData
336
+ response_data = utils.unmarshal_json_response(
337
+ errors.UnauthenticatedErrorData, http_res
377
338
  )
378
- raise errors.UnauthenticatedError(data=response_data)
339
+ raise errors.UnauthenticatedError(response_data, http_res)
379
340
  if utils.match_response(http_res, "409", "application/json"):
380
- response_data = utils.unmarshal_json(
381
- http_res.text, errors.ResourceAlreadyExistsErrorData
341
+ response_data = utils.unmarshal_json_response(
342
+ errors.ResourceAlreadyExistsErrorData, http_res
382
343
  )
383
- raise errors.ResourceAlreadyExistsError(data=response_data)
344
+ raise errors.ResourceAlreadyExistsError(response_data, http_res)
384
345
  if utils.match_response(http_res, "429", "application/json"):
385
- response_data = utils.unmarshal_json(
386
- http_res.text, errors.TooManyRequestsErrorData
346
+ response_data = utils.unmarshal_json_response(
347
+ errors.TooManyRequestsErrorData, http_res
387
348
  )
388
- raise errors.TooManyRequestsError(data=response_data)
349
+ raise errors.TooManyRequestsError(response_data, http_res)
389
350
  if utils.match_response(http_res, "500", "application/json"):
390
- response_data = utils.unmarshal_json(
391
- http_res.text, errors.InternalServerErrorData
351
+ response_data = utils.unmarshal_json_response(
352
+ errors.InternalServerErrorData, http_res
392
353
  )
393
- raise errors.InternalServerError(data=response_data)
354
+ raise errors.InternalServerError(response_data, http_res)
394
355
  if utils.match_response(http_res, "4XX", "*"):
395
356
  http_res_text = utils.stream_to_text(http_res)
396
- raise errors.APIError(
397
- "API error occurred", http_res.status_code, http_res_text, http_res
398
- )
357
+ raise errors.APIError("API error occurred", http_res, http_res_text)
399
358
  if utils.match_response(http_res, "5XX", "*"):
400
359
  http_res_text = utils.stream_to_text(http_res)
401
- raise errors.APIError(
402
- "API error occurred", http_res.status_code, http_res_text, http_res
403
- )
360
+ raise errors.APIError("API error occurred", http_res, http_res_text)
404
361
 
405
- content_type = http_res.headers.get("Content-Type")
406
- http_res_text = utils.stream_to_text(http_res)
407
- raise errors.APIError(
408
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
409
- http_res.status_code,
410
- http_res_text,
411
- http_res,
412
- )
362
+ raise errors.APIError("Unexpected response received", http_res)
413
363
 
414
- async def create_async(
364
+ async def create_collection_async(
415
365
  self,
416
366
  *,
417
- project_name: str,
418
367
  collection_name: str,
419
368
  index_configs: Optional[
420
369
  Union[
@@ -433,7 +382,6 @@ class Collections(BaseSDK):
433
382
  ) -> models.CreateCollectionResponse:
434
383
  r"""Create a collection.
435
384
 
436
- :param project_name: Project name.
437
385
  :param collection_name: Collection name must be unique within a project and the supported maximum length is 52.
438
386
  :param index_configs:
439
387
  :param source_project_name:
@@ -456,38 +404,31 @@ class Collections(BaseSDK):
456
404
  base_url = self._get_url(base_url, url_variables)
457
405
 
458
406
  request = models.CreateCollectionRequest(
459
- project_name=project_name,
460
- request_body=models.CreateCollectionRequestBody(
461
- collection_name=collection_name,
462
- index_configs=utils.get_pydantic_model(
463
- index_configs, Optional[Dict[str, models.IndexConfigsUnion]]
464
- ),
465
- source_project_name=source_project_name,
466
- source_collection_name=source_collection_name,
467
- source_datetime=source_datetime,
468
- source_project_api_key=source_project_api_key,
407
+ collection_name=collection_name,
408
+ index_configs=utils.get_pydantic_model(
409
+ index_configs, Optional[Dict[str, models.IndexConfigsUnion]]
469
410
  ),
411
+ source_project_name=source_project_name,
412
+ source_collection_name=source_collection_name,
413
+ source_datetime=source_datetime,
414
+ source_project_api_key=source_project_api_key,
470
415
  )
471
416
 
472
417
  req = self._build_request_async(
473
418
  method="POST",
474
- path="/projects/{projectName}/collections",
419
+ path="/collections",
475
420
  base_url=base_url,
476
421
  url_variables=url_variables,
477
422
  request=request,
478
423
  request_body_required=True,
479
- request_has_path_params=True,
424
+ request_has_path_params=False,
480
425
  request_has_query_params=True,
481
426
  user_agent_header="user-agent",
482
427
  accept_header_value="application/json",
483
428
  http_headers=http_headers,
484
429
  security=self.sdk_configuration.security,
485
430
  get_serialized_body=lambda: utils.serialize_request_body(
486
- request.request_body,
487
- False,
488
- False,
489
- "json",
490
- models.CreateCollectionRequestBody,
431
+ request, False, False, "json", models.CreateCollectionRequest
491
432
  ),
492
433
  timeout_ms=timeout_ms,
493
434
  )
@@ -521,56 +462,46 @@ class Collections(BaseSDK):
521
462
 
522
463
  response_data: Any = None
523
464
  if utils.match_response(http_res, "202", "application/json"):
524
- return utils.unmarshal_json(http_res.text, models.CreateCollectionResponse)
465
+ return utils.unmarshal_json_response(
466
+ models.CreateCollectionResponse, http_res
467
+ )
525
468
  if utils.match_response(http_res, "400", "application/json"):
526
- response_data = utils.unmarshal_json(
527
- http_res.text, errors.BadRequestErrorData
469
+ response_data = utils.unmarshal_json_response(
470
+ errors.BadRequestErrorData, http_res
528
471
  )
529
- raise errors.BadRequestError(data=response_data)
472
+ raise errors.BadRequestError(response_data, http_res)
530
473
  if utils.match_response(http_res, "401", "application/json"):
531
- response_data = utils.unmarshal_json(
532
- http_res.text, errors.UnauthenticatedErrorData
474
+ response_data = utils.unmarshal_json_response(
475
+ errors.UnauthenticatedErrorData, http_res
533
476
  )
534
- raise errors.UnauthenticatedError(data=response_data)
477
+ raise errors.UnauthenticatedError(response_data, http_res)
535
478
  if utils.match_response(http_res, "409", "application/json"):
536
- response_data = utils.unmarshal_json(
537
- http_res.text, errors.ResourceAlreadyExistsErrorData
479
+ response_data = utils.unmarshal_json_response(
480
+ errors.ResourceAlreadyExistsErrorData, http_res
538
481
  )
539
- raise errors.ResourceAlreadyExistsError(data=response_data)
482
+ raise errors.ResourceAlreadyExistsError(response_data, http_res)
540
483
  if utils.match_response(http_res, "429", "application/json"):
541
- response_data = utils.unmarshal_json(
542
- http_res.text, errors.TooManyRequestsErrorData
484
+ response_data = utils.unmarshal_json_response(
485
+ errors.TooManyRequestsErrorData, http_res
543
486
  )
544
- raise errors.TooManyRequestsError(data=response_data)
487
+ raise errors.TooManyRequestsError(response_data, http_res)
545
488
  if utils.match_response(http_res, "500", "application/json"):
546
- response_data = utils.unmarshal_json(
547
- http_res.text, errors.InternalServerErrorData
489
+ response_data = utils.unmarshal_json_response(
490
+ errors.InternalServerErrorData, http_res
548
491
  )
549
- raise errors.InternalServerError(data=response_data)
492
+ raise errors.InternalServerError(response_data, http_res)
550
493
  if utils.match_response(http_res, "4XX", "*"):
551
494
  http_res_text = await utils.stream_to_text_async(http_res)
552
- raise errors.APIError(
553
- "API error occurred", http_res.status_code, http_res_text, http_res
554
- )
495
+ raise errors.APIError("API error occurred", http_res, http_res_text)
555
496
  if utils.match_response(http_res, "5XX", "*"):
556
497
  http_res_text = await utils.stream_to_text_async(http_res)
557
- raise errors.APIError(
558
- "API error occurred", http_res.status_code, http_res_text, http_res
559
- )
498
+ raise errors.APIError("API error occurred", http_res, http_res_text)
560
499
 
561
- content_type = http_res.headers.get("Content-Type")
562
- http_res_text = await utils.stream_to_text_async(http_res)
563
- raise errors.APIError(
564
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
565
- http_res.status_code,
566
- http_res_text,
567
- http_res,
568
- )
500
+ raise errors.APIError("Unexpected response received", http_res)
569
501
 
570
- def delete(
502
+ def delete_collection(
571
503
  self,
572
504
  *,
573
- project_name: str,
574
505
  collection_name: str,
575
506
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
576
507
  server_url: Optional[str] = None,
@@ -579,7 +510,6 @@ class Collections(BaseSDK):
579
510
  ) -> models.MessageResponse:
580
511
  r"""Delete an existing collection.
581
512
 
582
- :param project_name: Project name.
583
513
  :param collection_name: Collection name.
584
514
  :param retries: Override the default retry configuration for this method
585
515
  :param server_url: Override the default server URL for this method
@@ -597,13 +527,12 @@ class Collections(BaseSDK):
597
527
  base_url = self._get_url(base_url, url_variables)
598
528
 
599
529
  request = models.DeleteCollectionRequest(
600
- project_name=project_name,
601
530
  collection_name=collection_name,
602
531
  )
603
532
 
604
533
  req = self._build_request(
605
534
  method="DELETE",
606
- path="/projects/{projectName}/collections/{collectionName}",
535
+ path="/collections/{collectionName}",
607
536
  base_url=base_url,
608
537
  url_variables=url_variables,
609
538
  request=request,
@@ -646,51 +575,39 @@ class Collections(BaseSDK):
646
575
 
647
576
  response_data: Any = None
648
577
  if utils.match_response(http_res, "202", "application/json"):
649
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
578
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
650
579
  if utils.match_response(http_res, "401", "application/json"):
651
- response_data = utils.unmarshal_json(
652
- http_res.text, errors.UnauthenticatedErrorData
580
+ response_data = utils.unmarshal_json_response(
581
+ errors.UnauthenticatedErrorData, http_res
653
582
  )
654
- raise errors.UnauthenticatedError(data=response_data)
583
+ raise errors.UnauthenticatedError(response_data, http_res)
655
584
  if utils.match_response(http_res, "404", "application/json"):
656
- response_data = utils.unmarshal_json(
657
- http_res.text, errors.ResourceNotFoundErrorData
585
+ response_data = utils.unmarshal_json_response(
586
+ errors.ResourceNotFoundErrorData, http_res
658
587
  )
659
- raise errors.ResourceNotFoundError(data=response_data)
588
+ raise errors.ResourceNotFoundError(response_data, http_res)
660
589
  if utils.match_response(http_res, "429", "application/json"):
661
- response_data = utils.unmarshal_json(
662
- http_res.text, errors.TooManyRequestsErrorData
590
+ response_data = utils.unmarshal_json_response(
591
+ errors.TooManyRequestsErrorData, http_res
663
592
  )
664
- raise errors.TooManyRequestsError(data=response_data)
593
+ raise errors.TooManyRequestsError(response_data, http_res)
665
594
  if utils.match_response(http_res, "500", "application/json"):
666
- response_data = utils.unmarshal_json(
667
- http_res.text, errors.InternalServerErrorData
595
+ response_data = utils.unmarshal_json_response(
596
+ errors.InternalServerErrorData, http_res
668
597
  )
669
- raise errors.InternalServerError(data=response_data)
598
+ raise errors.InternalServerError(response_data, http_res)
670
599
  if utils.match_response(http_res, "4XX", "*"):
671
600
  http_res_text = utils.stream_to_text(http_res)
672
- raise errors.APIError(
673
- "API error occurred", http_res.status_code, http_res_text, http_res
674
- )
601
+ raise errors.APIError("API error occurred", http_res, http_res_text)
675
602
  if utils.match_response(http_res, "5XX", "*"):
676
603
  http_res_text = utils.stream_to_text(http_res)
677
- raise errors.APIError(
678
- "API error occurred", http_res.status_code, http_res_text, http_res
679
- )
604
+ raise errors.APIError("API error occurred", http_res, http_res_text)
680
605
 
681
- content_type = http_res.headers.get("Content-Type")
682
- http_res_text = utils.stream_to_text(http_res)
683
- raise errors.APIError(
684
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
685
- http_res.status_code,
686
- http_res_text,
687
- http_res,
688
- )
606
+ raise errors.APIError("Unexpected response received", http_res)
689
607
 
690
- async def delete_async(
608
+ async def delete_collection_async(
691
609
  self,
692
610
  *,
693
- project_name: str,
694
611
  collection_name: str,
695
612
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
696
613
  server_url: Optional[str] = None,
@@ -699,7 +616,6 @@ class Collections(BaseSDK):
699
616
  ) -> models.MessageResponse:
700
617
  r"""Delete an existing collection.
701
618
 
702
- :param project_name: Project name.
703
619
  :param collection_name: Collection name.
704
620
  :param retries: Override the default retry configuration for this method
705
621
  :param server_url: Override the default server URL for this method
@@ -717,13 +633,12 @@ class Collections(BaseSDK):
717
633
  base_url = self._get_url(base_url, url_variables)
718
634
 
719
635
  request = models.DeleteCollectionRequest(
720
- project_name=project_name,
721
636
  collection_name=collection_name,
722
637
  )
723
638
 
724
639
  req = self._build_request_async(
725
640
  method="DELETE",
726
- path="/projects/{projectName}/collections/{collectionName}",
641
+ path="/collections/{collectionName}",
727
642
  base_url=base_url,
728
643
  url_variables=url_variables,
729
644
  request=request,
@@ -766,51 +681,39 @@ class Collections(BaseSDK):
766
681
 
767
682
  response_data: Any = None
768
683
  if utils.match_response(http_res, "202", "application/json"):
769
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
684
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
770
685
  if utils.match_response(http_res, "401", "application/json"):
771
- response_data = utils.unmarshal_json(
772
- http_res.text, errors.UnauthenticatedErrorData
686
+ response_data = utils.unmarshal_json_response(
687
+ errors.UnauthenticatedErrorData, http_res
773
688
  )
774
- raise errors.UnauthenticatedError(data=response_data)
689
+ raise errors.UnauthenticatedError(response_data, http_res)
775
690
  if utils.match_response(http_res, "404", "application/json"):
776
- response_data = utils.unmarshal_json(
777
- http_res.text, errors.ResourceNotFoundErrorData
691
+ response_data = utils.unmarshal_json_response(
692
+ errors.ResourceNotFoundErrorData, http_res
778
693
  )
779
- raise errors.ResourceNotFoundError(data=response_data)
694
+ raise errors.ResourceNotFoundError(response_data, http_res)
780
695
  if utils.match_response(http_res, "429", "application/json"):
781
- response_data = utils.unmarshal_json(
782
- http_res.text, errors.TooManyRequestsErrorData
696
+ response_data = utils.unmarshal_json_response(
697
+ errors.TooManyRequestsErrorData, http_res
783
698
  )
784
- raise errors.TooManyRequestsError(data=response_data)
699
+ raise errors.TooManyRequestsError(response_data, http_res)
785
700
  if utils.match_response(http_res, "500", "application/json"):
786
- response_data = utils.unmarshal_json(
787
- http_res.text, errors.InternalServerErrorData
701
+ response_data = utils.unmarshal_json_response(
702
+ errors.InternalServerErrorData, http_res
788
703
  )
789
- raise errors.InternalServerError(data=response_data)
704
+ raise errors.InternalServerError(response_data, http_res)
790
705
  if utils.match_response(http_res, "4XX", "*"):
791
706
  http_res_text = await utils.stream_to_text_async(http_res)
792
- raise errors.APIError(
793
- "API error occurred", http_res.status_code, http_res_text, http_res
794
- )
707
+ raise errors.APIError("API error occurred", http_res, http_res_text)
795
708
  if utils.match_response(http_res, "5XX", "*"):
796
709
  http_res_text = await utils.stream_to_text_async(http_res)
797
- raise errors.APIError(
798
- "API error occurred", http_res.status_code, http_res_text, http_res
799
- )
710
+ raise errors.APIError("API error occurred", http_res, http_res_text)
800
711
 
801
- content_type = http_res.headers.get("Content-Type")
802
- http_res_text = await utils.stream_to_text_async(http_res)
803
- raise errors.APIError(
804
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
805
- http_res.status_code,
806
- http_res_text,
807
- http_res,
808
- )
712
+ raise errors.APIError("Unexpected response received", http_res)
809
713
 
810
- def get(
714
+ def get_collection(
811
715
  self,
812
716
  *,
813
- project_name: str,
814
717
  collection_name: str,
815
718
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
816
719
  server_url: Optional[str] = None,
@@ -819,7 +722,6 @@ class Collections(BaseSDK):
819
722
  ) -> models.GetCollectionResponse:
820
723
  r"""Get metadata of an existing collection.
821
724
 
822
- :param project_name: Project name.
823
725
  :param collection_name: Collection name.
824
726
  :param retries: Override the default retry configuration for this method
825
727
  :param server_url: Override the default server URL for this method
@@ -837,13 +739,12 @@ class Collections(BaseSDK):
837
739
  base_url = self._get_url(base_url, url_variables)
838
740
 
839
741
  request = models.GetCollectionRequest(
840
- project_name=project_name,
841
742
  collection_name=collection_name,
842
743
  )
843
744
 
844
745
  req = self._build_request(
845
746
  method="GET",
846
- path="/projects/{projectName}/collections/{collectionName}",
747
+ path="/collections/{collectionName}",
847
748
  base_url=base_url,
848
749
  url_variables=url_variables,
849
750
  request=request,
@@ -886,51 +787,39 @@ class Collections(BaseSDK):
886
787
 
887
788
  response_data: Any = None
888
789
  if utils.match_response(http_res, "200", "application/json"):
889
- return utils.unmarshal_json(http_res.text, models.GetCollectionResponse)
790
+ return utils.unmarshal_json_response(models.GetCollectionResponse, http_res)
890
791
  if utils.match_response(http_res, "401", "application/json"):
891
- response_data = utils.unmarshal_json(
892
- http_res.text, errors.UnauthenticatedErrorData
792
+ response_data = utils.unmarshal_json_response(
793
+ errors.UnauthenticatedErrorData, http_res
893
794
  )
894
- raise errors.UnauthenticatedError(data=response_data)
795
+ raise errors.UnauthenticatedError(response_data, http_res)
895
796
  if utils.match_response(http_res, "404", "application/json"):
896
- response_data = utils.unmarshal_json(
897
- http_res.text, errors.ResourceNotFoundErrorData
797
+ response_data = utils.unmarshal_json_response(
798
+ errors.ResourceNotFoundErrorData, http_res
898
799
  )
899
- raise errors.ResourceNotFoundError(data=response_data)
800
+ raise errors.ResourceNotFoundError(response_data, http_res)
900
801
  if utils.match_response(http_res, "429", "application/json"):
901
- response_data = utils.unmarshal_json(
902
- http_res.text, errors.TooManyRequestsErrorData
802
+ response_data = utils.unmarshal_json_response(
803
+ errors.TooManyRequestsErrorData, http_res
903
804
  )
904
- raise errors.TooManyRequestsError(data=response_data)
805
+ raise errors.TooManyRequestsError(response_data, http_res)
905
806
  if utils.match_response(http_res, "500", "application/json"):
906
- response_data = utils.unmarshal_json(
907
- http_res.text, errors.InternalServerErrorData
807
+ response_data = utils.unmarshal_json_response(
808
+ errors.InternalServerErrorData, http_res
908
809
  )
909
- raise errors.InternalServerError(data=response_data)
810
+ raise errors.InternalServerError(response_data, http_res)
910
811
  if utils.match_response(http_res, "4XX", "*"):
911
812
  http_res_text = utils.stream_to_text(http_res)
912
- raise errors.APIError(
913
- "API error occurred", http_res.status_code, http_res_text, http_res
914
- )
813
+ raise errors.APIError("API error occurred", http_res, http_res_text)
915
814
  if utils.match_response(http_res, "5XX", "*"):
916
815
  http_res_text = utils.stream_to_text(http_res)
917
- raise errors.APIError(
918
- "API error occurred", http_res.status_code, http_res_text, http_res
919
- )
816
+ raise errors.APIError("API error occurred", http_res, http_res_text)
920
817
 
921
- content_type = http_res.headers.get("Content-Type")
922
- http_res_text = utils.stream_to_text(http_res)
923
- raise errors.APIError(
924
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
925
- http_res.status_code,
926
- http_res_text,
927
- http_res,
928
- )
818
+ raise errors.APIError("Unexpected response received", http_res)
929
819
 
930
- async def get_async(
820
+ async def get_collection_async(
931
821
  self,
932
822
  *,
933
- project_name: str,
934
823
  collection_name: str,
935
824
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
936
825
  server_url: Optional[str] = None,
@@ -939,7 +828,6 @@ class Collections(BaseSDK):
939
828
  ) -> models.GetCollectionResponse:
940
829
  r"""Get metadata of an existing collection.
941
830
 
942
- :param project_name: Project name.
943
831
  :param collection_name: Collection name.
944
832
  :param retries: Override the default retry configuration for this method
945
833
  :param server_url: Override the default server URL for this method
@@ -957,13 +845,12 @@ class Collections(BaseSDK):
957
845
  base_url = self._get_url(base_url, url_variables)
958
846
 
959
847
  request = models.GetCollectionRequest(
960
- project_name=project_name,
961
848
  collection_name=collection_name,
962
849
  )
963
850
 
964
851
  req = self._build_request_async(
965
852
  method="GET",
966
- path="/projects/{projectName}/collections/{collectionName}",
853
+ path="/collections/{collectionName}",
967
854
  base_url=base_url,
968
855
  url_variables=url_variables,
969
856
  request=request,
@@ -1006,51 +893,39 @@ class Collections(BaseSDK):
1006
893
 
1007
894
  response_data: Any = None
1008
895
  if utils.match_response(http_res, "200", "application/json"):
1009
- return utils.unmarshal_json(http_res.text, models.GetCollectionResponse)
896
+ return utils.unmarshal_json_response(models.GetCollectionResponse, http_res)
1010
897
  if utils.match_response(http_res, "401", "application/json"):
1011
- response_data = utils.unmarshal_json(
1012
- http_res.text, errors.UnauthenticatedErrorData
898
+ response_data = utils.unmarshal_json_response(
899
+ errors.UnauthenticatedErrorData, http_res
1013
900
  )
1014
- raise errors.UnauthenticatedError(data=response_data)
901
+ raise errors.UnauthenticatedError(response_data, http_res)
1015
902
  if utils.match_response(http_res, "404", "application/json"):
1016
- response_data = utils.unmarshal_json(
1017
- http_res.text, errors.ResourceNotFoundErrorData
903
+ response_data = utils.unmarshal_json_response(
904
+ errors.ResourceNotFoundErrorData, http_res
1018
905
  )
1019
- raise errors.ResourceNotFoundError(data=response_data)
906
+ raise errors.ResourceNotFoundError(response_data, http_res)
1020
907
  if utils.match_response(http_res, "429", "application/json"):
1021
- response_data = utils.unmarshal_json(
1022
- http_res.text, errors.TooManyRequestsErrorData
908
+ response_data = utils.unmarshal_json_response(
909
+ errors.TooManyRequestsErrorData, http_res
1023
910
  )
1024
- raise errors.TooManyRequestsError(data=response_data)
911
+ raise errors.TooManyRequestsError(response_data, http_res)
1025
912
  if utils.match_response(http_res, "500", "application/json"):
1026
- response_data = utils.unmarshal_json(
1027
- http_res.text, errors.InternalServerErrorData
913
+ response_data = utils.unmarshal_json_response(
914
+ errors.InternalServerErrorData, http_res
1028
915
  )
1029
- raise errors.InternalServerError(data=response_data)
916
+ raise errors.InternalServerError(response_data, http_res)
1030
917
  if utils.match_response(http_res, "4XX", "*"):
1031
918
  http_res_text = await utils.stream_to_text_async(http_res)
1032
- raise errors.APIError(
1033
- "API error occurred", http_res.status_code, http_res_text, http_res
1034
- )
919
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1035
920
  if utils.match_response(http_res, "5XX", "*"):
1036
921
  http_res_text = await utils.stream_to_text_async(http_res)
1037
- raise errors.APIError(
1038
- "API error occurred", http_res.status_code, http_res_text, http_res
1039
- )
922
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1040
923
 
1041
- content_type = http_res.headers.get("Content-Type")
1042
- http_res_text = await utils.stream_to_text_async(http_res)
1043
- raise errors.APIError(
1044
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1045
- http_res.status_code,
1046
- http_res_text,
1047
- http_res,
1048
- )
924
+ raise errors.APIError("Unexpected response received", http_res)
1049
925
 
1050
- def update(
926
+ def update_collection(
1051
927
  self,
1052
928
  *,
1053
- project_name: str,
1054
929
  collection_name: str,
1055
930
  index_configs: Union[
1056
931
  Dict[str, models.IndexConfigsUnion],
@@ -1063,7 +938,6 @@ class Collections(BaseSDK):
1063
938
  ) -> models.UpdateCollectionResponse:
1064
939
  r"""Configure a collection.
1065
940
 
1066
- :param project_name: Project name.
1067
941
  :param collection_name: Collection name.
1068
942
  :param index_configs:
1069
943
  :param retries: Override the default retry configuration for this method
@@ -1082,7 +956,6 @@ class Collections(BaseSDK):
1082
956
  base_url = self._get_url(base_url, url_variables)
1083
957
 
1084
958
  request = models.UpdateCollectionRequest(
1085
- project_name=project_name,
1086
959
  collection_name=collection_name,
1087
960
  request_body=models.UpdateCollectionRequestBody(
1088
961
  index_configs=utils.get_pydantic_model(
@@ -1093,7 +966,7 @@ class Collections(BaseSDK):
1093
966
 
1094
967
  req = self._build_request(
1095
968
  method="PATCH",
1096
- path="/projects/{projectName}/collections/{collectionName}",
969
+ path="/collections/{collectionName}",
1097
970
  base_url=base_url,
1098
971
  url_variables=url_variables,
1099
972
  request=request,
@@ -1143,56 +1016,46 @@ class Collections(BaseSDK):
1143
1016
 
1144
1017
  response_data: Any = None
1145
1018
  if utils.match_response(http_res, "200", "application/json"):
1146
- return utils.unmarshal_json(http_res.text, models.UpdateCollectionResponse)
1019
+ return utils.unmarshal_json_response(
1020
+ models.UpdateCollectionResponse, http_res
1021
+ )
1147
1022
  if utils.match_response(http_res, "400", "application/json"):
1148
- response_data = utils.unmarshal_json(
1149
- http_res.text, errors.BadRequestErrorData
1023
+ response_data = utils.unmarshal_json_response(
1024
+ errors.BadRequestErrorData, http_res
1150
1025
  )
1151
- raise errors.BadRequestError(data=response_data)
1026
+ raise errors.BadRequestError(response_data, http_res)
1152
1027
  if utils.match_response(http_res, "401", "application/json"):
1153
- response_data = utils.unmarshal_json(
1154
- http_res.text, errors.UnauthenticatedErrorData
1028
+ response_data = utils.unmarshal_json_response(
1029
+ errors.UnauthenticatedErrorData, http_res
1155
1030
  )
1156
- raise errors.UnauthenticatedError(data=response_data)
1031
+ raise errors.UnauthenticatedError(response_data, http_res)
1157
1032
  if utils.match_response(http_res, "404", "application/json"):
1158
- response_data = utils.unmarshal_json(
1159
- http_res.text, errors.ResourceNotFoundErrorData
1033
+ response_data = utils.unmarshal_json_response(
1034
+ errors.ResourceNotFoundErrorData, http_res
1160
1035
  )
1161
- raise errors.ResourceNotFoundError(data=response_data)
1036
+ raise errors.ResourceNotFoundError(response_data, http_res)
1162
1037
  if utils.match_response(http_res, "429", "application/json"):
1163
- response_data = utils.unmarshal_json(
1164
- http_res.text, errors.TooManyRequestsErrorData
1038
+ response_data = utils.unmarshal_json_response(
1039
+ errors.TooManyRequestsErrorData, http_res
1165
1040
  )
1166
- raise errors.TooManyRequestsError(data=response_data)
1041
+ raise errors.TooManyRequestsError(response_data, http_res)
1167
1042
  if utils.match_response(http_res, "500", "application/json"):
1168
- response_data = utils.unmarshal_json(
1169
- http_res.text, errors.InternalServerErrorData
1043
+ response_data = utils.unmarshal_json_response(
1044
+ errors.InternalServerErrorData, http_res
1170
1045
  )
1171
- raise errors.InternalServerError(data=response_data)
1046
+ raise errors.InternalServerError(response_data, http_res)
1172
1047
  if utils.match_response(http_res, "4XX", "*"):
1173
1048
  http_res_text = utils.stream_to_text(http_res)
1174
- raise errors.APIError(
1175
- "API error occurred", http_res.status_code, http_res_text, http_res
1176
- )
1049
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1177
1050
  if utils.match_response(http_res, "5XX", "*"):
1178
1051
  http_res_text = utils.stream_to_text(http_res)
1179
- raise errors.APIError(
1180
- "API error occurred", http_res.status_code, http_res_text, http_res
1181
- )
1052
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1182
1053
 
1183
- content_type = http_res.headers.get("Content-Type")
1184
- http_res_text = utils.stream_to_text(http_res)
1185
- raise errors.APIError(
1186
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1187
- http_res.status_code,
1188
- http_res_text,
1189
- http_res,
1190
- )
1054
+ raise errors.APIError("Unexpected response received", http_res)
1191
1055
 
1192
- async def update_async(
1056
+ async def update_collection_async(
1193
1057
  self,
1194
1058
  *,
1195
- project_name: str,
1196
1059
  collection_name: str,
1197
1060
  index_configs: Union[
1198
1061
  Dict[str, models.IndexConfigsUnion],
@@ -1205,7 +1068,6 @@ class Collections(BaseSDK):
1205
1068
  ) -> models.UpdateCollectionResponse:
1206
1069
  r"""Configure a collection.
1207
1070
 
1208
- :param project_name: Project name.
1209
1071
  :param collection_name: Collection name.
1210
1072
  :param index_configs:
1211
1073
  :param retries: Override the default retry configuration for this method
@@ -1224,7 +1086,6 @@ class Collections(BaseSDK):
1224
1086
  base_url = self._get_url(base_url, url_variables)
1225
1087
 
1226
1088
  request = models.UpdateCollectionRequest(
1227
- project_name=project_name,
1228
1089
  collection_name=collection_name,
1229
1090
  request_body=models.UpdateCollectionRequestBody(
1230
1091
  index_configs=utils.get_pydantic_model(
@@ -1235,7 +1096,7 @@ class Collections(BaseSDK):
1235
1096
 
1236
1097
  req = self._build_request_async(
1237
1098
  method="PATCH",
1238
- path="/projects/{projectName}/collections/{collectionName}",
1099
+ path="/collections/{collectionName}",
1239
1100
  base_url=base_url,
1240
1101
  url_variables=url_variables,
1241
1102
  request=request,
@@ -1285,62 +1146,52 @@ class Collections(BaseSDK):
1285
1146
 
1286
1147
  response_data: Any = None
1287
1148
  if utils.match_response(http_res, "200", "application/json"):
1288
- return utils.unmarshal_json(http_res.text, models.UpdateCollectionResponse)
1149
+ return utils.unmarshal_json_response(
1150
+ models.UpdateCollectionResponse, http_res
1151
+ )
1289
1152
  if utils.match_response(http_res, "400", "application/json"):
1290
- response_data = utils.unmarshal_json(
1291
- http_res.text, errors.BadRequestErrorData
1153
+ response_data = utils.unmarshal_json_response(
1154
+ errors.BadRequestErrorData, http_res
1292
1155
  )
1293
- raise errors.BadRequestError(data=response_data)
1156
+ raise errors.BadRequestError(response_data, http_res)
1294
1157
  if utils.match_response(http_res, "401", "application/json"):
1295
- response_data = utils.unmarshal_json(
1296
- http_res.text, errors.UnauthenticatedErrorData
1158
+ response_data = utils.unmarshal_json_response(
1159
+ errors.UnauthenticatedErrorData, http_res
1297
1160
  )
1298
- raise errors.UnauthenticatedError(data=response_data)
1161
+ raise errors.UnauthenticatedError(response_data, http_res)
1299
1162
  if utils.match_response(http_res, "404", "application/json"):
1300
- response_data = utils.unmarshal_json(
1301
- http_res.text, errors.ResourceNotFoundErrorData
1163
+ response_data = utils.unmarshal_json_response(
1164
+ errors.ResourceNotFoundErrorData, http_res
1302
1165
  )
1303
- raise errors.ResourceNotFoundError(data=response_data)
1166
+ raise errors.ResourceNotFoundError(response_data, http_res)
1304
1167
  if utils.match_response(http_res, "429", "application/json"):
1305
- response_data = utils.unmarshal_json(
1306
- http_res.text, errors.TooManyRequestsErrorData
1168
+ response_data = utils.unmarshal_json_response(
1169
+ errors.TooManyRequestsErrorData, http_res
1307
1170
  )
1308
- raise errors.TooManyRequestsError(data=response_data)
1171
+ raise errors.TooManyRequestsError(response_data, http_res)
1309
1172
  if utils.match_response(http_res, "500", "application/json"):
1310
- response_data = utils.unmarshal_json(
1311
- http_res.text, errors.InternalServerErrorData
1173
+ response_data = utils.unmarshal_json_response(
1174
+ errors.InternalServerErrorData, http_res
1312
1175
  )
1313
- raise errors.InternalServerError(data=response_data)
1176
+ raise errors.InternalServerError(response_data, http_res)
1314
1177
  if utils.match_response(http_res, "4XX", "*"):
1315
1178
  http_res_text = await utils.stream_to_text_async(http_res)
1316
- raise errors.APIError(
1317
- "API error occurred", http_res.status_code, http_res_text, http_res
1318
- )
1179
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1319
1180
  if utils.match_response(http_res, "5XX", "*"):
1320
1181
  http_res_text = await utils.stream_to_text_async(http_res)
1321
- raise errors.APIError(
1322
- "API error occurred", http_res.status_code, http_res_text, http_res
1323
- )
1182
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1324
1183
 
1325
- content_type = http_res.headers.get("Content-Type")
1326
- http_res_text = await utils.stream_to_text_async(http_res)
1327
- raise errors.APIError(
1328
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1329
- http_res.status_code,
1330
- http_res_text,
1331
- http_res,
1332
- )
1184
+ raise errors.APIError("Unexpected response received", http_res)
1333
1185
 
1334
- def query(
1186
+ def query_collection(
1335
1187
  self,
1336
1188
  *,
1337
- project_name: str,
1338
1189
  collection_name: str,
1339
1190
  size: int,
1340
- query: Optional[Union[models.Query, models.QueryTypedDict]] = None,
1191
+ query: Optional[Dict[str, Any]] = None,
1341
1192
  consistent_read: Optional[bool] = False,
1342
1193
  include_vectors: Optional[bool] = False,
1343
- sort: Optional[Union[List[models.Sort], List[models.SortTypedDict]]] = None,
1194
+ sort: Optional[List[Dict[str, Any]]] = None,
1344
1195
  fields: Optional[List[str]] = None,
1345
1196
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1346
1197
  server_url: Optional[str] = None,
@@ -1349,7 +1200,6 @@ class Collections(BaseSDK):
1349
1200
  ) -> models.QueryCollectionResponse:
1350
1201
  r"""Search a collection with a query and return the most similar documents.
1351
1202
 
1352
- :param project_name: Project name.
1353
1203
  :param collection_name: Collection name.
1354
1204
  :param size: Number of documents to return. Note that the maximum number of documents is 100.
1355
1205
  :param query: Query object.
@@ -1373,21 +1223,20 @@ class Collections(BaseSDK):
1373
1223
  base_url = self._get_url(base_url, url_variables)
1374
1224
 
1375
1225
  request = models.QueryCollectionRequest(
1376
- project_name=project_name,
1377
1226
  collection_name=collection_name,
1378
1227
  request_body=models.QueryCollectionRequestBody(
1379
1228
  size=size,
1380
- query=utils.get_pydantic_model(query, Optional[models.Query]),
1229
+ query=query,
1381
1230
  consistent_read=consistent_read,
1382
1231
  include_vectors=include_vectors,
1383
- sort=utils.get_pydantic_model(sort, Optional[List[models.Sort]]),
1232
+ sort=sort,
1384
1233
  fields=fields,
1385
1234
  ),
1386
1235
  )
1387
1236
 
1388
1237
  req = self._build_request(
1389
1238
  method="POST",
1390
- path="/projects/{projectName}/collections/{collectionName}/query",
1239
+ path="/collections/{collectionName}/query",
1391
1240
  base_url=base_url,
1392
1241
  url_variables=url_variables,
1393
1242
  request=request,
@@ -1437,62 +1286,52 @@ class Collections(BaseSDK):
1437
1286
 
1438
1287
  response_data: Any = None
1439
1288
  if utils.match_response(http_res, "200", "application/json"):
1440
- return utils.unmarshal_json(http_res.text, models.QueryCollectionResponse)
1289
+ return utils.unmarshal_json_response(
1290
+ models.QueryCollectionResponse, http_res
1291
+ )
1441
1292
  if utils.match_response(http_res, "400", "application/json"):
1442
- response_data = utils.unmarshal_json(
1443
- http_res.text, errors.BadRequestErrorData
1293
+ response_data = utils.unmarshal_json_response(
1294
+ errors.BadRequestErrorData, http_res
1444
1295
  )
1445
- raise errors.BadRequestError(data=response_data)
1296
+ raise errors.BadRequestError(response_data, http_res)
1446
1297
  if utils.match_response(http_res, "401", "application/json"):
1447
- response_data = utils.unmarshal_json(
1448
- http_res.text, errors.UnauthenticatedErrorData
1298
+ response_data = utils.unmarshal_json_response(
1299
+ errors.UnauthenticatedErrorData, http_res
1449
1300
  )
1450
- raise errors.UnauthenticatedError(data=response_data)
1301
+ raise errors.UnauthenticatedError(response_data, http_res)
1451
1302
  if utils.match_response(http_res, "404", "application/json"):
1452
- response_data = utils.unmarshal_json(
1453
- http_res.text, errors.ResourceNotFoundErrorData
1303
+ response_data = utils.unmarshal_json_response(
1304
+ errors.ResourceNotFoundErrorData, http_res
1454
1305
  )
1455
- raise errors.ResourceNotFoundError(data=response_data)
1306
+ raise errors.ResourceNotFoundError(response_data, http_res)
1456
1307
  if utils.match_response(http_res, "429", "application/json"):
1457
- response_data = utils.unmarshal_json(
1458
- http_res.text, errors.TooManyRequestsErrorData
1308
+ response_data = utils.unmarshal_json_response(
1309
+ errors.TooManyRequestsErrorData, http_res
1459
1310
  )
1460
- raise errors.TooManyRequestsError(data=response_data)
1311
+ raise errors.TooManyRequestsError(response_data, http_res)
1461
1312
  if utils.match_response(http_res, "500", "application/json"):
1462
- response_data = utils.unmarshal_json(
1463
- http_res.text, errors.InternalServerErrorData
1313
+ response_data = utils.unmarshal_json_response(
1314
+ errors.InternalServerErrorData, http_res
1464
1315
  )
1465
- raise errors.InternalServerError(data=response_data)
1316
+ raise errors.InternalServerError(response_data, http_res)
1466
1317
  if utils.match_response(http_res, "4XX", "*"):
1467
1318
  http_res_text = utils.stream_to_text(http_res)
1468
- raise errors.APIError(
1469
- "API error occurred", http_res.status_code, http_res_text, http_res
1470
- )
1319
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1471
1320
  if utils.match_response(http_res, "5XX", "*"):
1472
1321
  http_res_text = utils.stream_to_text(http_res)
1473
- raise errors.APIError(
1474
- "API error occurred", http_res.status_code, http_res_text, http_res
1475
- )
1322
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1476
1323
 
1477
- content_type = http_res.headers.get("Content-Type")
1478
- http_res_text = utils.stream_to_text(http_res)
1479
- raise errors.APIError(
1480
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1481
- http_res.status_code,
1482
- http_res_text,
1483
- http_res,
1484
- )
1324
+ raise errors.APIError("Unexpected response received", http_res)
1485
1325
 
1486
- async def query_async(
1326
+ async def query_collection_async(
1487
1327
  self,
1488
1328
  *,
1489
- project_name: str,
1490
1329
  collection_name: str,
1491
1330
  size: int,
1492
- query: Optional[Union[models.Query, models.QueryTypedDict]] = None,
1331
+ query: Optional[Dict[str, Any]] = None,
1493
1332
  consistent_read: Optional[bool] = False,
1494
1333
  include_vectors: Optional[bool] = False,
1495
- sort: Optional[Union[List[models.Sort], List[models.SortTypedDict]]] = None,
1334
+ sort: Optional[List[Dict[str, Any]]] = None,
1496
1335
  fields: Optional[List[str]] = None,
1497
1336
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1498
1337
  server_url: Optional[str] = None,
@@ -1501,7 +1340,6 @@ class Collections(BaseSDK):
1501
1340
  ) -> models.QueryCollectionResponse:
1502
1341
  r"""Search a collection with a query and return the most similar documents.
1503
1342
 
1504
- :param project_name: Project name.
1505
1343
  :param collection_name: Collection name.
1506
1344
  :param size: Number of documents to return. Note that the maximum number of documents is 100.
1507
1345
  :param query: Query object.
@@ -1525,21 +1363,20 @@ class Collections(BaseSDK):
1525
1363
  base_url = self._get_url(base_url, url_variables)
1526
1364
 
1527
1365
  request = models.QueryCollectionRequest(
1528
- project_name=project_name,
1529
1366
  collection_name=collection_name,
1530
1367
  request_body=models.QueryCollectionRequestBody(
1531
1368
  size=size,
1532
- query=utils.get_pydantic_model(query, Optional[models.Query]),
1369
+ query=query,
1533
1370
  consistent_read=consistent_read,
1534
1371
  include_vectors=include_vectors,
1535
- sort=utils.get_pydantic_model(sort, Optional[List[models.Sort]]),
1372
+ sort=sort,
1536
1373
  fields=fields,
1537
1374
  ),
1538
1375
  )
1539
1376
 
1540
1377
  req = self._build_request_async(
1541
1378
  method="POST",
1542
- path="/projects/{projectName}/collections/{collectionName}/query",
1379
+ path="/collections/{collectionName}/query",
1543
1380
  base_url=base_url,
1544
1381
  url_variables=url_variables,
1545
1382
  request=request,
@@ -1589,48 +1426,39 @@ class Collections(BaseSDK):
1589
1426
 
1590
1427
  response_data: Any = None
1591
1428
  if utils.match_response(http_res, "200", "application/json"):
1592
- return utils.unmarshal_json(http_res.text, models.QueryCollectionResponse)
1429
+ return utils.unmarshal_json_response(
1430
+ models.QueryCollectionResponse, http_res
1431
+ )
1593
1432
  if utils.match_response(http_res, "400", "application/json"):
1594
- response_data = utils.unmarshal_json(
1595
- http_res.text, errors.BadRequestErrorData
1433
+ response_data = utils.unmarshal_json_response(
1434
+ errors.BadRequestErrorData, http_res
1596
1435
  )
1597
- raise errors.BadRequestError(data=response_data)
1436
+ raise errors.BadRequestError(response_data, http_res)
1598
1437
  if utils.match_response(http_res, "401", "application/json"):
1599
- response_data = utils.unmarshal_json(
1600
- http_res.text, errors.UnauthenticatedErrorData
1438
+ response_data = utils.unmarshal_json_response(
1439
+ errors.UnauthenticatedErrorData, http_res
1601
1440
  )
1602
- raise errors.UnauthenticatedError(data=response_data)
1441
+ raise errors.UnauthenticatedError(response_data, http_res)
1603
1442
  if utils.match_response(http_res, "404", "application/json"):
1604
- response_data = utils.unmarshal_json(
1605
- http_res.text, errors.ResourceNotFoundErrorData
1443
+ response_data = utils.unmarshal_json_response(
1444
+ errors.ResourceNotFoundErrorData, http_res
1606
1445
  )
1607
- raise errors.ResourceNotFoundError(data=response_data)
1446
+ raise errors.ResourceNotFoundError(response_data, http_res)
1608
1447
  if utils.match_response(http_res, "429", "application/json"):
1609
- response_data = utils.unmarshal_json(
1610
- http_res.text, errors.TooManyRequestsErrorData
1448
+ response_data = utils.unmarshal_json_response(
1449
+ errors.TooManyRequestsErrorData, http_res
1611
1450
  )
1612
- raise errors.TooManyRequestsError(data=response_data)
1451
+ raise errors.TooManyRequestsError(response_data, http_res)
1613
1452
  if utils.match_response(http_res, "500", "application/json"):
1614
- response_data = utils.unmarshal_json(
1615
- http_res.text, errors.InternalServerErrorData
1453
+ response_data = utils.unmarshal_json_response(
1454
+ errors.InternalServerErrorData, http_res
1616
1455
  )
1617
- raise errors.InternalServerError(data=response_data)
1456
+ raise errors.InternalServerError(response_data, http_res)
1618
1457
  if utils.match_response(http_res, "4XX", "*"):
1619
1458
  http_res_text = await utils.stream_to_text_async(http_res)
1620
- raise errors.APIError(
1621
- "API error occurred", http_res.status_code, http_res_text, http_res
1622
- )
1459
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1623
1460
  if utils.match_response(http_res, "5XX", "*"):
1624
1461
  http_res_text = await utils.stream_to_text_async(http_res)
1625
- raise errors.APIError(
1626
- "API error occurred", http_res.status_code, http_res_text, http_res
1627
- )
1462
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1628
1463
 
1629
- content_type = http_res.headers.get("Content-Type")
1630
- http_res_text = await utils.stream_to_text_async(http_res)
1631
- raise errors.APIError(
1632
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1633
- http_res.status_code,
1634
- http_res_text,
1635
- http_res,
1636
- )
1464
+ raise errors.APIError("Unexpected response received", http_res)