airweave-sdk 0.8.64__py3-none-any.whl → 0.8.66__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 (46) hide show
  1. airweave/__init__.py +44 -38
  2. airweave/client.py +19 -16
  3. airweave/collections/__init__.py +3 -6
  4. airweave/collections/client.py +273 -113
  5. airweave/collections/raw_client.py +633 -94
  6. airweave/collections/types/__init__.py +2 -4
  7. airweave/core/client_wrapper.py +4 -30
  8. airweave/errors/__init__.py +10 -2
  9. airweave/errors/conflict_error.py +11 -0
  10. airweave/errors/not_found_error.py +11 -0
  11. airweave/errors/too_many_requests_error.py +11 -0
  12. airweave/errors/unprocessable_entity_error.py +1 -2
  13. airweave/{types/message_status.py → events/__init__.py} +2 -1
  14. airweave/events/client.py +919 -0
  15. airweave/events/raw_client.py +1435 -0
  16. airweave/source_connections/client.py +210 -162
  17. airweave/source_connections/raw_client.py +574 -137
  18. airweave/sources/client.py +42 -18
  19. airweave/sources/raw_client.py +118 -17
  20. airweave/types/__init__.py +33 -33
  21. airweave/types/{create_subscription_request.py → conflict_error_response.py} +9 -6
  22. airweave/types/delivery_attempt.py +61 -0
  23. airweave/types/event_message.py +55 -0
  24. airweave/types/event_message_with_attempts.py +59 -0
  25. airweave/types/{endpoint_secret_out.py → not_found_error_response.py} +9 -2
  26. airweave/types/{subscription_with_attempts_out.py → rate_limit_error_response.py} +9 -6
  27. airweave/types/recovery_task.py +35 -0
  28. airweave/types/search_request.py +13 -10
  29. airweave/types/search_response.py +6 -3
  30. airweave/types/source_connection.py +73 -18
  31. airweave/types/source_connection_job.py +65 -15
  32. airweave/types/source_connection_list_item.py +45 -10
  33. airweave/types/sync_event_payload.py +72 -0
  34. airweave/types/{patch_subscription_request.py → validation_error_detail.py} +16 -5
  35. airweave/types/validation_error_response.py +30 -0
  36. airweave/types/webhook_subscription.py +68 -0
  37. {airweave_sdk-0.8.64.dist-info → airweave_sdk-0.8.66.dist-info}/METADATA +1 -5
  38. {airweave_sdk-0.8.64.dist-info → airweave_sdk-0.8.66.dist-info}/RECORD +39 -34
  39. airweave/collections/types/search_collections_readable_id_search_post_response.py +0 -8
  40. airweave/types/collection_update.py +0 -35
  41. airweave/types/endpoint_out.py +0 -35
  42. airweave/types/message_attempt_out.py +0 -37
  43. airweave/types/message_attempt_trigger_type.py +0 -3
  44. airweave/types/message_out.py +0 -29
  45. airweave/types/message_status_text.py +0 -5
  46. {airweave_sdk-0.8.64.dist-info → airweave_sdk-0.8.66.dist-info}/WHEEL +0 -0
@@ -10,15 +10,18 @@ from ..core.jsonable_encoder import jsonable_encoder
10
10
  from ..core.pydantic_utilities import parse_obj_as
11
11
  from ..core.request_options import RequestOptions
12
12
  from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from ..errors.not_found_error import NotFoundError
14
+ from ..errors.too_many_requests_error import TooManyRequestsError
13
15
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
16
  from ..types.collection import Collection
15
- from ..types.http_validation_error import HttpValidationError
16
17
  from ..types.legacy_search_response import LegacySearchResponse
18
+ from ..types.not_found_error_response import NotFoundErrorResponse
19
+ from ..types.rate_limit_error_response import RateLimitErrorResponse
17
20
  from ..types.response_type import ResponseType
21
+ from ..types.search_response import SearchResponse
18
22
  from ..types.source_connection_job import SourceConnectionJob
19
23
  from ..types.sync_config import SyncConfig
20
24
  from .types.search_collections_readable_id_search_post_request import SearchCollectionsReadableIdSearchPostRequest
21
- from .types.search_collections_readable_id_search_post_response import SearchCollectionsReadableIdSearchPostResponse
22
25
 
23
26
  # this is used as the default value for optional parameters
24
27
  OMIT = typing.cast(typing.Any, ...)
@@ -37,9 +40,13 @@ class RawCollectionsClient:
37
40
  request_options: typing.Optional[RequestOptions] = None,
38
41
  ) -> HttpResponse[typing.List[Collection]]:
39
42
  """
40
- List all collections that belong to your organization with optional search filtering.
43
+ Retrieve all collections belonging to your organization.
41
44
 
42
- Collections are always sorted by creation date (newest first).
45
+ Collections are containers that group related data from one or more source
46
+ connections, enabling unified search across multiple data sources.
47
+
48
+ Results are sorted by creation date (newest first) and support pagination
49
+ and text search filtering.
43
50
 
44
51
  Parameters
45
52
  ----------
@@ -50,7 +57,7 @@ class RawCollectionsClient:
50
57
  Maximum number of collections to return (1-1000)
51
58
 
52
59
  search : typing.Optional[str]
53
- Search term to filter by name or readable_id
60
+ Search term to filter collections by name or readable_id
54
61
 
55
62
  request_options : typing.Optional[RequestOptions]
56
63
  Request-specific configuration.
@@ -84,9 +91,20 @@ class RawCollectionsClient:
84
91
  raise UnprocessableEntityError(
85
92
  headers=dict(_response.headers),
86
93
  body=typing.cast(
87
- HttpValidationError,
94
+ typing.Optional[typing.Any],
88
95
  parse_obj_as(
89
- type_=HttpValidationError, # type: ignore
96
+ type_=typing.Optional[typing.Any], # type: ignore
97
+ object_=_response.json(),
98
+ ),
99
+ ),
100
+ )
101
+ if _response.status_code == 429:
102
+ raise TooManyRequestsError(
103
+ headers=dict(_response.headers),
104
+ body=typing.cast(
105
+ RateLimitErrorResponse,
106
+ parse_obj_as(
107
+ type_=RateLimitErrorResponse, # type: ignore
90
108
  object_=_response.json(),
91
109
  ),
92
110
  ),
@@ -105,10 +123,16 @@ class RawCollectionsClient:
105
123
  request_options: typing.Optional[RequestOptions] = None,
106
124
  ) -> HttpResponse[Collection]:
107
125
  """
108
- Create a new collection.
126
+ Create a new collection in your organization.
127
+
128
+ Collections are containers for organizing and searching across data from multiple
129
+ sources. After creation, add source connections to begin syncing data.
109
130
 
110
- The newly created collection is initially empty and does not contain any data
111
- until you explicitly add source connections to it.
131
+ The collection will be assigned a unique `readable_id` based on the name you provide,
132
+ which is used in URLs and API calls. You can optionally configure:
133
+
134
+ - **Sync schedule**: How frequently to automatically sync data from all sources
135
+ - **Custom readable_id**: Provide your own identifier (must be unique and URL-safe)
112
136
 
113
137
  Parameters
114
138
  ----------
@@ -127,7 +151,7 @@ class RawCollectionsClient:
127
151
  Returns
128
152
  -------
129
153
  HttpResponse[Collection]
130
- Successful Response
154
+ Created collection
131
155
  """
132
156
  _response = self._client_wrapper.httpx_client.request(
133
157
  "collections",
@@ -159,9 +183,20 @@ class RawCollectionsClient:
159
183
  raise UnprocessableEntityError(
160
184
  headers=dict(_response.headers),
161
185
  body=typing.cast(
162
- HttpValidationError,
186
+ typing.Optional[typing.Any],
163
187
  parse_obj_as(
164
- type_=HttpValidationError, # type: ignore
188
+ type_=typing.Optional[typing.Any], # type: ignore
189
+ object_=_response.json(),
190
+ ),
191
+ ),
192
+ )
193
+ if _response.status_code == 429:
194
+ raise TooManyRequestsError(
195
+ headers=dict(_response.headers),
196
+ body=typing.cast(
197
+ RateLimitErrorResponse,
198
+ parse_obj_as(
199
+ type_=RateLimitErrorResponse, # type: ignore
165
200
  object_=_response.json(),
166
201
  ),
167
202
  ),
@@ -175,7 +210,11 @@ class RawCollectionsClient:
175
210
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
176
211
  ) -> HttpResponse[Collection]:
177
212
  """
178
- Retrieve a specific collection by its readable ID.
213
+ Retrieve details of a specific collection by its readable ID.
214
+
215
+ Returns the complete collection configuration including sync settings, status,
216
+ and metadata. Use this to check the current state of a collection or to get
217
+ configuration details before making updates.
179
218
 
180
219
  Parameters
181
220
  ----------
@@ -188,7 +227,7 @@ class RawCollectionsClient:
188
227
  Returns
189
228
  -------
190
229
  HttpResponse[Collection]
191
- Successful Response
230
+ Collection details
192
231
  """
193
232
  _response = self._client_wrapper.httpx_client.request(
194
233
  f"collections/{jsonable_encoder(readable_id)}",
@@ -205,13 +244,35 @@ class RawCollectionsClient:
205
244
  ),
206
245
  )
207
246
  return HttpResponse(response=_response, data=_data)
247
+ if _response.status_code == 404:
248
+ raise NotFoundError(
249
+ headers=dict(_response.headers),
250
+ body=typing.cast(
251
+ NotFoundErrorResponse,
252
+ parse_obj_as(
253
+ type_=NotFoundErrorResponse, # type: ignore
254
+ object_=_response.json(),
255
+ ),
256
+ ),
257
+ )
208
258
  if _response.status_code == 422:
209
259
  raise UnprocessableEntityError(
210
260
  headers=dict(_response.headers),
211
261
  body=typing.cast(
212
- HttpValidationError,
262
+ typing.Optional[typing.Any],
263
+ parse_obj_as(
264
+ type_=typing.Optional[typing.Any], # type: ignore
265
+ object_=_response.json(),
266
+ ),
267
+ ),
268
+ )
269
+ if _response.status_code == 429:
270
+ raise TooManyRequestsError(
271
+ headers=dict(_response.headers),
272
+ body=typing.cast(
273
+ RateLimitErrorResponse,
213
274
  parse_obj_as(
214
- type_=HttpValidationError, # type: ignore
275
+ type_=RateLimitErrorResponse, # type: ignore
215
276
  object_=_response.json(),
216
277
  ),
217
278
  ),
@@ -225,11 +286,15 @@ class RawCollectionsClient:
225
286
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
226
287
  ) -> HttpResponse[Collection]:
227
288
  """
228
- Delete a collection and all associated data.
289
+ Permanently delete a collection and all associated data.
290
+
291
+ This operation:
292
+ - Removes all synced data from the vector database
293
+ - Deletes all source connections within the collection
294
+ - Cancels any scheduled sync jobs
295
+ - Cleans up all related resources
229
296
 
230
- Permanently removes a collection from your organization including all synced data
231
- from the destination systems. All source connections within this collection
232
- will also be deleted as part of the cleanup process. This action cannot be undone.
297
+ **Warning**: This action cannot be undone. All data will be permanently deleted.
233
298
 
234
299
  Parameters
235
300
  ----------
@@ -242,7 +307,7 @@ class RawCollectionsClient:
242
307
  Returns
243
308
  -------
244
309
  HttpResponse[Collection]
245
- Successful Response
310
+ Deleted collection
246
311
  """
247
312
  _response = self._client_wrapper.httpx_client.request(
248
313
  f"collections/{jsonable_encoder(readable_id)}",
@@ -259,13 +324,135 @@ class RawCollectionsClient:
259
324
  ),
260
325
  )
261
326
  return HttpResponse(response=_response, data=_data)
327
+ if _response.status_code == 404:
328
+ raise NotFoundError(
329
+ headers=dict(_response.headers),
330
+ body=typing.cast(
331
+ NotFoundErrorResponse,
332
+ parse_obj_as(
333
+ type_=NotFoundErrorResponse, # type: ignore
334
+ object_=_response.json(),
335
+ ),
336
+ ),
337
+ )
338
+ if _response.status_code == 422:
339
+ raise UnprocessableEntityError(
340
+ headers=dict(_response.headers),
341
+ body=typing.cast(
342
+ typing.Optional[typing.Any],
343
+ parse_obj_as(
344
+ type_=typing.Optional[typing.Any], # type: ignore
345
+ object_=_response.json(),
346
+ ),
347
+ ),
348
+ )
349
+ if _response.status_code == 429:
350
+ raise TooManyRequestsError(
351
+ headers=dict(_response.headers),
352
+ body=typing.cast(
353
+ RateLimitErrorResponse,
354
+ parse_obj_as(
355
+ type_=RateLimitErrorResponse, # type: ignore
356
+ object_=_response.json(),
357
+ ),
358
+ ),
359
+ )
360
+ _response_json = _response.json()
361
+ except JSONDecodeError:
362
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
363
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
364
+
365
+ def update(
366
+ self,
367
+ readable_id: str,
368
+ *,
369
+ name: typing.Optional[str] = OMIT,
370
+ sync_config: typing.Optional[SyncConfig] = OMIT,
371
+ request_options: typing.Optional[RequestOptions] = None,
372
+ ) -> HttpResponse[Collection]:
373
+ """
374
+ Update an existing collection's properties.
375
+
376
+ You can modify:
377
+ - **Name**: The display name shown in the UI
378
+ - **Sync configuration**: Schedule settings for automatic data synchronization
379
+
380
+ Note that the `readable_id` cannot be changed after creation to maintain stable
381
+ API endpoints and preserve existing integrations.
382
+
383
+ Parameters
384
+ ----------
385
+ readable_id : str
386
+ The unique readable identifier of the collection to update
387
+
388
+ name : typing.Optional[str]
389
+ Updated display name for the collection. Must be between 4 and 64 characters.
390
+
391
+ sync_config : typing.Optional[SyncConfig]
392
+ Default sync configuration for all syncs in this collection. This provides collection-level defaults that can be overridden at sync or job level.
393
+
394
+ request_options : typing.Optional[RequestOptions]
395
+ Request-specific configuration.
396
+
397
+ Returns
398
+ -------
399
+ HttpResponse[Collection]
400
+ Updated collection
401
+ """
402
+ _response = self._client_wrapper.httpx_client.request(
403
+ f"collections/{jsonable_encoder(readable_id)}",
404
+ method="PATCH",
405
+ json={
406
+ "name": name,
407
+ "sync_config": convert_and_respect_annotation_metadata(
408
+ object_=sync_config, annotation=SyncConfig, direction="write"
409
+ ),
410
+ },
411
+ headers={
412
+ "content-type": "application/json",
413
+ },
414
+ request_options=request_options,
415
+ omit=OMIT,
416
+ )
417
+ try:
418
+ if 200 <= _response.status_code < 300:
419
+ _data = typing.cast(
420
+ Collection,
421
+ parse_obj_as(
422
+ type_=Collection, # type: ignore
423
+ object_=_response.json(),
424
+ ),
425
+ )
426
+ return HttpResponse(response=_response, data=_data)
427
+ if _response.status_code == 404:
428
+ raise NotFoundError(
429
+ headers=dict(_response.headers),
430
+ body=typing.cast(
431
+ NotFoundErrorResponse,
432
+ parse_obj_as(
433
+ type_=NotFoundErrorResponse, # type: ignore
434
+ object_=_response.json(),
435
+ ),
436
+ ),
437
+ )
262
438
  if _response.status_code == 422:
263
439
  raise UnprocessableEntityError(
264
440
  headers=dict(_response.headers),
265
441
  body=typing.cast(
266
- HttpValidationError,
442
+ typing.Optional[typing.Any],
443
+ parse_obj_as(
444
+ type_=typing.Optional[typing.Any], # type: ignore
445
+ object_=_response.json(),
446
+ ),
447
+ ),
448
+ )
449
+ if _response.status_code == 429:
450
+ raise TooManyRequestsError(
451
+ headers=dict(_response.headers),
452
+ body=typing.cast(
453
+ RateLimitErrorResponse,
267
454
  parse_obj_as(
268
- type_=HttpValidationError, # type: ignore
455
+ type_=RateLimitErrorResponse, # type: ignore
269
456
  object_=_response.json(),
270
457
  ),
271
458
  ),
@@ -279,12 +466,13 @@ class RawCollectionsClient:
279
466
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
280
467
  ) -> HttpResponse[typing.List[SourceConnectionJob]]:
281
468
  """
282
- Trigger data synchronization for all source connections in the collection.
469
+ Trigger data synchronization for all source connections in a collection.
283
470
 
284
- The sync jobs run asynchronously in the background, so this endpoint
285
- returns immediately with job details that you can use to track progress. You can
286
- monitor the status of individual data synchronization using the source connection
287
- endpoints.
471
+ Starts sync jobs for every source connection in the collection, pulling the latest
472
+ data from each connected source. Jobs run asynchronously in the background.
473
+
474
+ Returns a list of sync jobs that were created. Use the source connection endpoints
475
+ to monitor the progress and status of individual sync jobs.
288
476
 
289
477
  Parameters
290
478
  ----------
@@ -314,13 +502,35 @@ class RawCollectionsClient:
314
502
  ),
315
503
  )
316
504
  return HttpResponse(response=_response, data=_data)
505
+ if _response.status_code == 404:
506
+ raise NotFoundError(
507
+ headers=dict(_response.headers),
508
+ body=typing.cast(
509
+ NotFoundErrorResponse,
510
+ parse_obj_as(
511
+ type_=NotFoundErrorResponse, # type: ignore
512
+ object_=_response.json(),
513
+ ),
514
+ ),
515
+ )
317
516
  if _response.status_code == 422:
318
517
  raise UnprocessableEntityError(
319
518
  headers=dict(_response.headers),
320
519
  body=typing.cast(
321
- HttpValidationError,
520
+ typing.Optional[typing.Any],
322
521
  parse_obj_as(
323
- type_=HttpValidationError, # type: ignore
522
+ type_=typing.Optional[typing.Any], # type: ignore
523
+ object_=_response.json(),
524
+ ),
525
+ ),
526
+ )
527
+ if _response.status_code == 429:
528
+ raise TooManyRequestsError(
529
+ headers=dict(_response.headers),
530
+ body=typing.cast(
531
+ RateLimitErrorResponse,
532
+ parse_obj_as(
533
+ type_=RateLimitErrorResponse, # type: ignore
324
534
  object_=_response.json(),
325
535
  ),
326
536
  ),
@@ -342,10 +552,14 @@ class RawCollectionsClient:
342
552
  request_options: typing.Optional[RequestOptions] = None,
343
553
  ) -> HttpResponse[LegacySearchResponse]:
344
554
  """
345
- Legacy GET search endpoint for backwards compatibility.
555
+ **DEPRECATED**: Use POST /collections/{readable_id}/search instead.
346
556
 
347
- DEPRECATED: This endpoint uses the old schema. Please migrate to POST with the new
348
- SearchRequest format for access to all features.
557
+ This legacy GET endpoint provides basic search functionality via query parameters.
558
+ Migrate to the POST endpoint for access to advanced features like:
559
+ - Structured filters
560
+ - Query expansion
561
+ - Reranking
562
+ - Streaming responses
349
563
 
350
564
  Parameters
351
565
  ----------
@@ -365,7 +579,7 @@ class RawCollectionsClient:
365
579
  Number of results to skip for pagination
366
580
 
367
581
  recency_bias : typing.Optional[float]
368
- How much to weigh recency vs similarity (0..1)
582
+ How much to weigh recency vs similarity (0=similarity only, 1=recency only)
369
583
 
370
584
  request_options : typing.Optional[RequestOptions]
371
585
  Request-specific configuration.
@@ -373,7 +587,7 @@ class RawCollectionsClient:
373
587
  Returns
374
588
  -------
375
589
  HttpResponse[LegacySearchResponse]
376
- Successful Response
590
+ Search results
377
591
  """
378
592
  _response = self._client_wrapper.httpx_client.request(
379
593
  f"collections/{jsonable_encoder(readable_id)}/search",
@@ -397,13 +611,35 @@ class RawCollectionsClient:
397
611
  ),
398
612
  )
399
613
  return HttpResponse(response=_response, data=_data)
614
+ if _response.status_code == 404:
615
+ raise NotFoundError(
616
+ headers=dict(_response.headers),
617
+ body=typing.cast(
618
+ NotFoundErrorResponse,
619
+ parse_obj_as(
620
+ type_=NotFoundErrorResponse, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ ),
624
+ )
400
625
  if _response.status_code == 422:
401
626
  raise UnprocessableEntityError(
402
627
  headers=dict(_response.headers),
403
628
  body=typing.cast(
404
- HttpValidationError,
629
+ typing.Optional[typing.Any],
630
+ parse_obj_as(
631
+ type_=typing.Optional[typing.Any], # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
636
+ if _response.status_code == 429:
637
+ raise TooManyRequestsError(
638
+ headers=dict(_response.headers),
639
+ body=typing.cast(
640
+ RateLimitErrorResponse,
405
641
  parse_obj_as(
406
- type_=HttpValidationError, # type: ignore
642
+ type_=RateLimitErrorResponse, # type: ignore
407
643
  object_=_response.json(),
408
644
  ),
409
645
  ),
@@ -419,17 +655,30 @@ class RawCollectionsClient:
419
655
  *,
420
656
  request: SearchCollectionsReadableIdSearchPostRequest,
421
657
  request_options: typing.Optional[RequestOptions] = None,
422
- ) -> HttpResponse[SearchCollectionsReadableIdSearchPostResponse]:
658
+ ) -> HttpResponse[SearchResponse]:
423
659
  """
424
- Search your collection.
660
+ Search your collection using semantic and hybrid search.
661
+
662
+ This is the primary search endpoint providing powerful AI-powered search capabilities:
663
+
664
+ **Search Strategies:**
665
+ - **hybrid** (default): Combines neural (semantic) and keyword (BM25) matching
666
+ - **neural**: Pure semantic search using embeddings
667
+ - **keyword**: Traditional keyword-based BM25 search
668
+
669
+ **Features:**
670
+ - **Query expansion**: Generate query variations to improve recall
671
+ - **Filter interpretation**: Extract structured filters from natural language
672
+ - **Reranking**: LLM-based reranking for improved relevance
673
+ - **Answer generation**: AI-generated answers based on search results
425
674
 
426
- Accepts both new SearchRequest and legacy LegacySearchRequest formats
675
+ **Note**: Accepts both new SearchRequest and legacy LegacySearchRequest formats
427
676
  for backwards compatibility.
428
677
 
429
678
  Parameters
430
679
  ----------
431
680
  readable_id : str
432
- The unique readable identifier of the collection
681
+ The unique readable identifier of the collection to search
433
682
 
434
683
  request : SearchCollectionsReadableIdSearchPostRequest
435
684
 
@@ -438,8 +687,8 @@ class RawCollectionsClient:
438
687
 
439
688
  Returns
440
689
  -------
441
- HttpResponse[SearchCollectionsReadableIdSearchPostResponse]
442
- Successful Response
690
+ HttpResponse[SearchResponse]
691
+ Search results with optional AI completion
443
692
  """
444
693
  _response = self._client_wrapper.httpx_client.request(
445
694
  f"collections/{jsonable_encoder(readable_id)}/search",
@@ -456,20 +705,42 @@ class RawCollectionsClient:
456
705
  try:
457
706
  if 200 <= _response.status_code < 300:
458
707
  _data = typing.cast(
459
- SearchCollectionsReadableIdSearchPostResponse,
708
+ SearchResponse,
460
709
  parse_obj_as(
461
- type_=SearchCollectionsReadableIdSearchPostResponse, # type: ignore
710
+ type_=SearchResponse, # type: ignore
462
711
  object_=_response.json(),
463
712
  ),
464
713
  )
465
714
  return HttpResponse(response=_response, data=_data)
715
+ if _response.status_code == 404:
716
+ raise NotFoundError(
717
+ headers=dict(_response.headers),
718
+ body=typing.cast(
719
+ NotFoundErrorResponse,
720
+ parse_obj_as(
721
+ type_=NotFoundErrorResponse, # type: ignore
722
+ object_=_response.json(),
723
+ ),
724
+ ),
725
+ )
466
726
  if _response.status_code == 422:
467
727
  raise UnprocessableEntityError(
468
728
  headers=dict(_response.headers),
469
729
  body=typing.cast(
470
- HttpValidationError,
730
+ typing.Optional[typing.Any],
731
+ parse_obj_as(
732
+ type_=typing.Optional[typing.Any], # type: ignore
733
+ object_=_response.json(),
734
+ ),
735
+ ),
736
+ )
737
+ if _response.status_code == 429:
738
+ raise TooManyRequestsError(
739
+ headers=dict(_response.headers),
740
+ body=typing.cast(
741
+ RateLimitErrorResponse,
471
742
  parse_obj_as(
472
- type_=HttpValidationError, # type: ignore
743
+ type_=RateLimitErrorResponse, # type: ignore
473
744
  object_=_response.json(),
474
745
  ),
475
746
  ),
@@ -493,9 +764,13 @@ class AsyncRawCollectionsClient:
493
764
  request_options: typing.Optional[RequestOptions] = None,
494
765
  ) -> AsyncHttpResponse[typing.List[Collection]]:
495
766
  """
496
- List all collections that belong to your organization with optional search filtering.
767
+ Retrieve all collections belonging to your organization.
497
768
 
498
- Collections are always sorted by creation date (newest first).
769
+ Collections are containers that group related data from one or more source
770
+ connections, enabling unified search across multiple data sources.
771
+
772
+ Results are sorted by creation date (newest first) and support pagination
773
+ and text search filtering.
499
774
 
500
775
  Parameters
501
776
  ----------
@@ -506,7 +781,7 @@ class AsyncRawCollectionsClient:
506
781
  Maximum number of collections to return (1-1000)
507
782
 
508
783
  search : typing.Optional[str]
509
- Search term to filter by name or readable_id
784
+ Search term to filter collections by name or readable_id
510
785
 
511
786
  request_options : typing.Optional[RequestOptions]
512
787
  Request-specific configuration.
@@ -540,9 +815,20 @@ class AsyncRawCollectionsClient:
540
815
  raise UnprocessableEntityError(
541
816
  headers=dict(_response.headers),
542
817
  body=typing.cast(
543
- HttpValidationError,
818
+ typing.Optional[typing.Any],
544
819
  parse_obj_as(
545
- type_=HttpValidationError, # type: ignore
820
+ type_=typing.Optional[typing.Any], # type: ignore
821
+ object_=_response.json(),
822
+ ),
823
+ ),
824
+ )
825
+ if _response.status_code == 429:
826
+ raise TooManyRequestsError(
827
+ headers=dict(_response.headers),
828
+ body=typing.cast(
829
+ RateLimitErrorResponse,
830
+ parse_obj_as(
831
+ type_=RateLimitErrorResponse, # type: ignore
546
832
  object_=_response.json(),
547
833
  ),
548
834
  ),
@@ -561,10 +847,16 @@ class AsyncRawCollectionsClient:
561
847
  request_options: typing.Optional[RequestOptions] = None,
562
848
  ) -> AsyncHttpResponse[Collection]:
563
849
  """
564
- Create a new collection.
850
+ Create a new collection in your organization.
851
+
852
+ Collections are containers for organizing and searching across data from multiple
853
+ sources. After creation, add source connections to begin syncing data.
565
854
 
566
- The newly created collection is initially empty and does not contain any data
567
- until you explicitly add source connections to it.
855
+ The collection will be assigned a unique `readable_id` based on the name you provide,
856
+ which is used in URLs and API calls. You can optionally configure:
857
+
858
+ - **Sync schedule**: How frequently to automatically sync data from all sources
859
+ - **Custom readable_id**: Provide your own identifier (must be unique and URL-safe)
568
860
 
569
861
  Parameters
570
862
  ----------
@@ -583,7 +875,7 @@ class AsyncRawCollectionsClient:
583
875
  Returns
584
876
  -------
585
877
  AsyncHttpResponse[Collection]
586
- Successful Response
878
+ Created collection
587
879
  """
588
880
  _response = await self._client_wrapper.httpx_client.request(
589
881
  "collections",
@@ -615,9 +907,20 @@ class AsyncRawCollectionsClient:
615
907
  raise UnprocessableEntityError(
616
908
  headers=dict(_response.headers),
617
909
  body=typing.cast(
618
- HttpValidationError,
910
+ typing.Optional[typing.Any],
619
911
  parse_obj_as(
620
- type_=HttpValidationError, # type: ignore
912
+ type_=typing.Optional[typing.Any], # type: ignore
913
+ object_=_response.json(),
914
+ ),
915
+ ),
916
+ )
917
+ if _response.status_code == 429:
918
+ raise TooManyRequestsError(
919
+ headers=dict(_response.headers),
920
+ body=typing.cast(
921
+ RateLimitErrorResponse,
922
+ parse_obj_as(
923
+ type_=RateLimitErrorResponse, # type: ignore
621
924
  object_=_response.json(),
622
925
  ),
623
926
  ),
@@ -631,7 +934,11 @@ class AsyncRawCollectionsClient:
631
934
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
632
935
  ) -> AsyncHttpResponse[Collection]:
633
936
  """
634
- Retrieve a specific collection by its readable ID.
937
+ Retrieve details of a specific collection by its readable ID.
938
+
939
+ Returns the complete collection configuration including sync settings, status,
940
+ and metadata. Use this to check the current state of a collection or to get
941
+ configuration details before making updates.
635
942
 
636
943
  Parameters
637
944
  ----------
@@ -644,7 +951,7 @@ class AsyncRawCollectionsClient:
644
951
  Returns
645
952
  -------
646
953
  AsyncHttpResponse[Collection]
647
- Successful Response
954
+ Collection details
648
955
  """
649
956
  _response = await self._client_wrapper.httpx_client.request(
650
957
  f"collections/{jsonable_encoder(readable_id)}",
@@ -661,13 +968,35 @@ class AsyncRawCollectionsClient:
661
968
  ),
662
969
  )
663
970
  return AsyncHttpResponse(response=_response, data=_data)
971
+ if _response.status_code == 404:
972
+ raise NotFoundError(
973
+ headers=dict(_response.headers),
974
+ body=typing.cast(
975
+ NotFoundErrorResponse,
976
+ parse_obj_as(
977
+ type_=NotFoundErrorResponse, # type: ignore
978
+ object_=_response.json(),
979
+ ),
980
+ ),
981
+ )
664
982
  if _response.status_code == 422:
665
983
  raise UnprocessableEntityError(
666
984
  headers=dict(_response.headers),
667
985
  body=typing.cast(
668
- HttpValidationError,
986
+ typing.Optional[typing.Any],
987
+ parse_obj_as(
988
+ type_=typing.Optional[typing.Any], # type: ignore
989
+ object_=_response.json(),
990
+ ),
991
+ ),
992
+ )
993
+ if _response.status_code == 429:
994
+ raise TooManyRequestsError(
995
+ headers=dict(_response.headers),
996
+ body=typing.cast(
997
+ RateLimitErrorResponse,
669
998
  parse_obj_as(
670
- type_=HttpValidationError, # type: ignore
999
+ type_=RateLimitErrorResponse, # type: ignore
671
1000
  object_=_response.json(),
672
1001
  ),
673
1002
  ),
@@ -681,11 +1010,15 @@ class AsyncRawCollectionsClient:
681
1010
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
682
1011
  ) -> AsyncHttpResponse[Collection]:
683
1012
  """
684
- Delete a collection and all associated data.
1013
+ Permanently delete a collection and all associated data.
1014
+
1015
+ This operation:
1016
+ - Removes all synced data from the vector database
1017
+ - Deletes all source connections within the collection
1018
+ - Cancels any scheduled sync jobs
1019
+ - Cleans up all related resources
685
1020
 
686
- Permanently removes a collection from your organization including all synced data
687
- from the destination systems. All source connections within this collection
688
- will also be deleted as part of the cleanup process. This action cannot be undone.
1021
+ **Warning**: This action cannot be undone. All data will be permanently deleted.
689
1022
 
690
1023
  Parameters
691
1024
  ----------
@@ -698,7 +1031,7 @@ class AsyncRawCollectionsClient:
698
1031
  Returns
699
1032
  -------
700
1033
  AsyncHttpResponse[Collection]
701
- Successful Response
1034
+ Deleted collection
702
1035
  """
703
1036
  _response = await self._client_wrapper.httpx_client.request(
704
1037
  f"collections/{jsonable_encoder(readable_id)}",
@@ -715,13 +1048,135 @@ class AsyncRawCollectionsClient:
715
1048
  ),
716
1049
  )
717
1050
  return AsyncHttpResponse(response=_response, data=_data)
1051
+ if _response.status_code == 404:
1052
+ raise NotFoundError(
1053
+ headers=dict(_response.headers),
1054
+ body=typing.cast(
1055
+ NotFoundErrorResponse,
1056
+ parse_obj_as(
1057
+ type_=NotFoundErrorResponse, # type: ignore
1058
+ object_=_response.json(),
1059
+ ),
1060
+ ),
1061
+ )
1062
+ if _response.status_code == 422:
1063
+ raise UnprocessableEntityError(
1064
+ headers=dict(_response.headers),
1065
+ body=typing.cast(
1066
+ typing.Optional[typing.Any],
1067
+ parse_obj_as(
1068
+ type_=typing.Optional[typing.Any], # type: ignore
1069
+ object_=_response.json(),
1070
+ ),
1071
+ ),
1072
+ )
1073
+ if _response.status_code == 429:
1074
+ raise TooManyRequestsError(
1075
+ headers=dict(_response.headers),
1076
+ body=typing.cast(
1077
+ RateLimitErrorResponse,
1078
+ parse_obj_as(
1079
+ type_=RateLimitErrorResponse, # type: ignore
1080
+ object_=_response.json(),
1081
+ ),
1082
+ ),
1083
+ )
1084
+ _response_json = _response.json()
1085
+ except JSONDecodeError:
1086
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1087
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1088
+
1089
+ async def update(
1090
+ self,
1091
+ readable_id: str,
1092
+ *,
1093
+ name: typing.Optional[str] = OMIT,
1094
+ sync_config: typing.Optional[SyncConfig] = OMIT,
1095
+ request_options: typing.Optional[RequestOptions] = None,
1096
+ ) -> AsyncHttpResponse[Collection]:
1097
+ """
1098
+ Update an existing collection's properties.
1099
+
1100
+ You can modify:
1101
+ - **Name**: The display name shown in the UI
1102
+ - **Sync configuration**: Schedule settings for automatic data synchronization
1103
+
1104
+ Note that the `readable_id` cannot be changed after creation to maintain stable
1105
+ API endpoints and preserve existing integrations.
1106
+
1107
+ Parameters
1108
+ ----------
1109
+ readable_id : str
1110
+ The unique readable identifier of the collection to update
1111
+
1112
+ name : typing.Optional[str]
1113
+ Updated display name for the collection. Must be between 4 and 64 characters.
1114
+
1115
+ sync_config : typing.Optional[SyncConfig]
1116
+ Default sync configuration for all syncs in this collection. This provides collection-level defaults that can be overridden at sync or job level.
1117
+
1118
+ request_options : typing.Optional[RequestOptions]
1119
+ Request-specific configuration.
1120
+
1121
+ Returns
1122
+ -------
1123
+ AsyncHttpResponse[Collection]
1124
+ Updated collection
1125
+ """
1126
+ _response = await self._client_wrapper.httpx_client.request(
1127
+ f"collections/{jsonable_encoder(readable_id)}",
1128
+ method="PATCH",
1129
+ json={
1130
+ "name": name,
1131
+ "sync_config": convert_and_respect_annotation_metadata(
1132
+ object_=sync_config, annotation=SyncConfig, direction="write"
1133
+ ),
1134
+ },
1135
+ headers={
1136
+ "content-type": "application/json",
1137
+ },
1138
+ request_options=request_options,
1139
+ omit=OMIT,
1140
+ )
1141
+ try:
1142
+ if 200 <= _response.status_code < 300:
1143
+ _data = typing.cast(
1144
+ Collection,
1145
+ parse_obj_as(
1146
+ type_=Collection, # type: ignore
1147
+ object_=_response.json(),
1148
+ ),
1149
+ )
1150
+ return AsyncHttpResponse(response=_response, data=_data)
1151
+ if _response.status_code == 404:
1152
+ raise NotFoundError(
1153
+ headers=dict(_response.headers),
1154
+ body=typing.cast(
1155
+ NotFoundErrorResponse,
1156
+ parse_obj_as(
1157
+ type_=NotFoundErrorResponse, # type: ignore
1158
+ object_=_response.json(),
1159
+ ),
1160
+ ),
1161
+ )
718
1162
  if _response.status_code == 422:
719
1163
  raise UnprocessableEntityError(
720
1164
  headers=dict(_response.headers),
721
1165
  body=typing.cast(
722
- HttpValidationError,
1166
+ typing.Optional[typing.Any],
1167
+ parse_obj_as(
1168
+ type_=typing.Optional[typing.Any], # type: ignore
1169
+ object_=_response.json(),
1170
+ ),
1171
+ ),
1172
+ )
1173
+ if _response.status_code == 429:
1174
+ raise TooManyRequestsError(
1175
+ headers=dict(_response.headers),
1176
+ body=typing.cast(
1177
+ RateLimitErrorResponse,
723
1178
  parse_obj_as(
724
- type_=HttpValidationError, # type: ignore
1179
+ type_=RateLimitErrorResponse, # type: ignore
725
1180
  object_=_response.json(),
726
1181
  ),
727
1182
  ),
@@ -735,12 +1190,13 @@ class AsyncRawCollectionsClient:
735
1190
  self, readable_id: str, *, request_options: typing.Optional[RequestOptions] = None
736
1191
  ) -> AsyncHttpResponse[typing.List[SourceConnectionJob]]:
737
1192
  """
738
- Trigger data synchronization for all source connections in the collection.
1193
+ Trigger data synchronization for all source connections in a collection.
739
1194
 
740
- The sync jobs run asynchronously in the background, so this endpoint
741
- returns immediately with job details that you can use to track progress. You can
742
- monitor the status of individual data synchronization using the source connection
743
- endpoints.
1195
+ Starts sync jobs for every source connection in the collection, pulling the latest
1196
+ data from each connected source. Jobs run asynchronously in the background.
1197
+
1198
+ Returns a list of sync jobs that were created. Use the source connection endpoints
1199
+ to monitor the progress and status of individual sync jobs.
744
1200
 
745
1201
  Parameters
746
1202
  ----------
@@ -770,13 +1226,35 @@ class AsyncRawCollectionsClient:
770
1226
  ),
771
1227
  )
772
1228
  return AsyncHttpResponse(response=_response, data=_data)
1229
+ if _response.status_code == 404:
1230
+ raise NotFoundError(
1231
+ headers=dict(_response.headers),
1232
+ body=typing.cast(
1233
+ NotFoundErrorResponse,
1234
+ parse_obj_as(
1235
+ type_=NotFoundErrorResponse, # type: ignore
1236
+ object_=_response.json(),
1237
+ ),
1238
+ ),
1239
+ )
773
1240
  if _response.status_code == 422:
774
1241
  raise UnprocessableEntityError(
775
1242
  headers=dict(_response.headers),
776
1243
  body=typing.cast(
777
- HttpValidationError,
1244
+ typing.Optional[typing.Any],
778
1245
  parse_obj_as(
779
- type_=HttpValidationError, # type: ignore
1246
+ type_=typing.Optional[typing.Any], # type: ignore
1247
+ object_=_response.json(),
1248
+ ),
1249
+ ),
1250
+ )
1251
+ if _response.status_code == 429:
1252
+ raise TooManyRequestsError(
1253
+ headers=dict(_response.headers),
1254
+ body=typing.cast(
1255
+ RateLimitErrorResponse,
1256
+ parse_obj_as(
1257
+ type_=RateLimitErrorResponse, # type: ignore
780
1258
  object_=_response.json(),
781
1259
  ),
782
1260
  ),
@@ -798,10 +1276,14 @@ class AsyncRawCollectionsClient:
798
1276
  request_options: typing.Optional[RequestOptions] = None,
799
1277
  ) -> AsyncHttpResponse[LegacySearchResponse]:
800
1278
  """
801
- Legacy GET search endpoint for backwards compatibility.
1279
+ **DEPRECATED**: Use POST /collections/{readable_id}/search instead.
802
1280
 
803
- DEPRECATED: This endpoint uses the old schema. Please migrate to POST with the new
804
- SearchRequest format for access to all features.
1281
+ This legacy GET endpoint provides basic search functionality via query parameters.
1282
+ Migrate to the POST endpoint for access to advanced features like:
1283
+ - Structured filters
1284
+ - Query expansion
1285
+ - Reranking
1286
+ - Streaming responses
805
1287
 
806
1288
  Parameters
807
1289
  ----------
@@ -821,7 +1303,7 @@ class AsyncRawCollectionsClient:
821
1303
  Number of results to skip for pagination
822
1304
 
823
1305
  recency_bias : typing.Optional[float]
824
- How much to weigh recency vs similarity (0..1)
1306
+ How much to weigh recency vs similarity (0=similarity only, 1=recency only)
825
1307
 
826
1308
  request_options : typing.Optional[RequestOptions]
827
1309
  Request-specific configuration.
@@ -829,7 +1311,7 @@ class AsyncRawCollectionsClient:
829
1311
  Returns
830
1312
  -------
831
1313
  AsyncHttpResponse[LegacySearchResponse]
832
- Successful Response
1314
+ Search results
833
1315
  """
834
1316
  _response = await self._client_wrapper.httpx_client.request(
835
1317
  f"collections/{jsonable_encoder(readable_id)}/search",
@@ -853,13 +1335,35 @@ class AsyncRawCollectionsClient:
853
1335
  ),
854
1336
  )
855
1337
  return AsyncHttpResponse(response=_response, data=_data)
1338
+ if _response.status_code == 404:
1339
+ raise NotFoundError(
1340
+ headers=dict(_response.headers),
1341
+ body=typing.cast(
1342
+ NotFoundErrorResponse,
1343
+ parse_obj_as(
1344
+ type_=NotFoundErrorResponse, # type: ignore
1345
+ object_=_response.json(),
1346
+ ),
1347
+ ),
1348
+ )
856
1349
  if _response.status_code == 422:
857
1350
  raise UnprocessableEntityError(
858
1351
  headers=dict(_response.headers),
859
1352
  body=typing.cast(
860
- HttpValidationError,
1353
+ typing.Optional[typing.Any],
1354
+ parse_obj_as(
1355
+ type_=typing.Optional[typing.Any], # type: ignore
1356
+ object_=_response.json(),
1357
+ ),
1358
+ ),
1359
+ )
1360
+ if _response.status_code == 429:
1361
+ raise TooManyRequestsError(
1362
+ headers=dict(_response.headers),
1363
+ body=typing.cast(
1364
+ RateLimitErrorResponse,
861
1365
  parse_obj_as(
862
- type_=HttpValidationError, # type: ignore
1366
+ type_=RateLimitErrorResponse, # type: ignore
863
1367
  object_=_response.json(),
864
1368
  ),
865
1369
  ),
@@ -875,17 +1379,30 @@ class AsyncRawCollectionsClient:
875
1379
  *,
876
1380
  request: SearchCollectionsReadableIdSearchPostRequest,
877
1381
  request_options: typing.Optional[RequestOptions] = None,
878
- ) -> AsyncHttpResponse[SearchCollectionsReadableIdSearchPostResponse]:
1382
+ ) -> AsyncHttpResponse[SearchResponse]:
879
1383
  """
880
- Search your collection.
1384
+ Search your collection using semantic and hybrid search.
1385
+
1386
+ This is the primary search endpoint providing powerful AI-powered search capabilities:
1387
+
1388
+ **Search Strategies:**
1389
+ - **hybrid** (default): Combines neural (semantic) and keyword (BM25) matching
1390
+ - **neural**: Pure semantic search using embeddings
1391
+ - **keyword**: Traditional keyword-based BM25 search
1392
+
1393
+ **Features:**
1394
+ - **Query expansion**: Generate query variations to improve recall
1395
+ - **Filter interpretation**: Extract structured filters from natural language
1396
+ - **Reranking**: LLM-based reranking for improved relevance
1397
+ - **Answer generation**: AI-generated answers based on search results
881
1398
 
882
- Accepts both new SearchRequest and legacy LegacySearchRequest formats
1399
+ **Note**: Accepts both new SearchRequest and legacy LegacySearchRequest formats
883
1400
  for backwards compatibility.
884
1401
 
885
1402
  Parameters
886
1403
  ----------
887
1404
  readable_id : str
888
- The unique readable identifier of the collection
1405
+ The unique readable identifier of the collection to search
889
1406
 
890
1407
  request : SearchCollectionsReadableIdSearchPostRequest
891
1408
 
@@ -894,8 +1411,8 @@ class AsyncRawCollectionsClient:
894
1411
 
895
1412
  Returns
896
1413
  -------
897
- AsyncHttpResponse[SearchCollectionsReadableIdSearchPostResponse]
898
- Successful Response
1414
+ AsyncHttpResponse[SearchResponse]
1415
+ Search results with optional AI completion
899
1416
  """
900
1417
  _response = await self._client_wrapper.httpx_client.request(
901
1418
  f"collections/{jsonable_encoder(readable_id)}/search",
@@ -912,20 +1429,42 @@ class AsyncRawCollectionsClient:
912
1429
  try:
913
1430
  if 200 <= _response.status_code < 300:
914
1431
  _data = typing.cast(
915
- SearchCollectionsReadableIdSearchPostResponse,
1432
+ SearchResponse,
916
1433
  parse_obj_as(
917
- type_=SearchCollectionsReadableIdSearchPostResponse, # type: ignore
1434
+ type_=SearchResponse, # type: ignore
918
1435
  object_=_response.json(),
919
1436
  ),
920
1437
  )
921
1438
  return AsyncHttpResponse(response=_response, data=_data)
1439
+ if _response.status_code == 404:
1440
+ raise NotFoundError(
1441
+ headers=dict(_response.headers),
1442
+ body=typing.cast(
1443
+ NotFoundErrorResponse,
1444
+ parse_obj_as(
1445
+ type_=NotFoundErrorResponse, # type: ignore
1446
+ object_=_response.json(),
1447
+ ),
1448
+ ),
1449
+ )
922
1450
  if _response.status_code == 422:
923
1451
  raise UnprocessableEntityError(
924
1452
  headers=dict(_response.headers),
925
1453
  body=typing.cast(
926
- HttpValidationError,
1454
+ typing.Optional[typing.Any],
1455
+ parse_obj_as(
1456
+ type_=typing.Optional[typing.Any], # type: ignore
1457
+ object_=_response.json(),
1458
+ ),
1459
+ ),
1460
+ )
1461
+ if _response.status_code == 429:
1462
+ raise TooManyRequestsError(
1463
+ headers=dict(_response.headers),
1464
+ body=typing.cast(
1465
+ RateLimitErrorResponse,
927
1466
  parse_obj_as(
928
- type_=HttpValidationError, # type: ignore
1467
+ type_=RateLimitErrorResponse, # type: ignore
929
1468
  object_=_response.json(),
930
1469
  ),
931
1470
  ),