22
33from __future__ import annotations
44
5- from typing import Dict , Union , Mapping , cast
5+ from typing import Dict , Union , Mapping , Iterable , cast
66from typing_extensions import Literal
77
88import httpx
99
1010from ..types import (
11+ Query ,
1112 document_add_params ,
1213 document_list_params ,
1314 document_update_params ,
1415 document_delete_bulk_params ,
1516 document_upload_file_params ,
17+ document_batch_create_params ,
1618)
1719from .._types import Body , Omit , Query , Headers , NoneType , NotGiven , FileTypes , SequenceNotStr , omit , not_given
1820from .._utils import extract_files , maybe_transform , deepcopy_minimal , async_maybe_transform
2527 async_to_streamed_response_wrapper ,
2628)
2729from .._base_client import make_request_options
30+ from ..types .query_param import QueryParam
2831from ..types .document_add_response import DocumentAddResponse
2932from ..types .document_get_response import DocumentGetResponse
3033from ..types .document_list_response import DocumentListResponse
3134from ..types .document_update_response import DocumentUpdateResponse
3235from ..types .document_delete_bulk_response import DocumentDeleteBulkResponse
3336from ..types .document_upload_file_response import DocumentUploadFileResponse
37+ from ..types .document_batch_create_response import DocumentBatchCreateResponse
38+ from ..types .document_list_processing_response import DocumentListProcessingResponse
3439
3540__all__ = ["DocumentsResource" , "AsyncDocumentsResource" ]
3641
@@ -133,7 +138,7 @@ def list(
133138 self ,
134139 * ,
135140 container_tags : SequenceNotStr [str ] | Omit = omit ,
136- filters : document_list_params . Filters | Omit = omit ,
141+ filters : QueryParam | Omit = omit ,
137142 include_content : bool | Omit = omit ,
138143 limit : Union [str , float ] | Omit = omit ,
139144 order : Literal ["asc" , "desc" ] | Omit = omit ,
@@ -285,6 +290,67 @@ def add(
285290 cast_to = DocumentAddResponse ,
286291 )
287292
293+ def batch_create (
294+ self ,
295+ * ,
296+ documents : Union [Iterable [document_batch_create_params .DocumentsUnionMember0 ], SequenceNotStr [str ]],
297+ container_tag : str | Omit = omit ,
298+ container_tags : SequenceNotStr [str ] | Omit = omit ,
299+ content : None | Omit = omit ,
300+ metadata : Dict [str , Union [str , float , bool , SequenceNotStr [str ]]] | Omit = omit ,
301+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
302+ # The extra values given here take precedence over values defined on the client or passed to this method.
303+ extra_headers : Headers | None = None ,
304+ extra_query : Query | None = None ,
305+ extra_body : Body | None = None ,
306+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
307+ ) -> DocumentBatchCreateResponse :
308+ """Add multiple documents in a single request.
309+
310+ Each document can have any content
311+ type (text, url, file, etc.) and metadata
312+
313+ Args:
314+ container_tag: Optional tag this document should be containerized by. This can be an ID for
315+ your user, a project ID, or any other identifier you wish to use to group
316+ documents.
317+
318+ container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
319+ containerized by. This can be an ID for your user, a project ID, or any other
320+ identifier you wish to use to group documents.
321+
322+ metadata: Optional metadata for the document. This is used to store additional information
323+ about the document. You can use this to store any additional information you
324+ need about the document. Metadata can be filtered through. Keys must be strings
325+ and are case sensitive. Values can be strings, numbers, or booleans. You cannot
326+ nest objects.
327+
328+ extra_headers: Send extra headers
329+
330+ extra_query: Add additional query parameters to the request
331+
332+ extra_body: Add additional JSON properties to the request
333+
334+ timeout: Override the client-level default timeout for this request, in seconds
335+ """
336+ return self ._post (
337+ "/v3/documents/batch" ,
338+ body = maybe_transform (
339+ {
340+ "documents" : documents ,
341+ "container_tag" : container_tag ,
342+ "container_tags" : container_tags ,
343+ "content" : content ,
344+ "metadata" : metadata ,
345+ },
346+ document_batch_create_params .DocumentBatchCreateParams ,
347+ ),
348+ options = make_request_options (
349+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
350+ ),
351+ cast_to = DocumentBatchCreateResponse ,
352+ )
353+
288354 def delete_bulk (
289355 self ,
290356 * ,
@@ -361,6 +427,25 @@ def get(
361427 cast_to = DocumentGetResponse ,
362428 )
363429
430+ def list_processing (
431+ self ,
432+ * ,
433+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
434+ # The extra values given here take precedence over values defined on the client or passed to this method.
435+ extra_headers : Headers | None = None ,
436+ extra_query : Query | None = None ,
437+ extra_body : Body | None = None ,
438+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
439+ ) -> DocumentListProcessingResponse :
440+ """Get documents that are currently being processed"""
441+ return self ._get (
442+ "/v3/documents/processing" ,
443+ options = make_request_options (
444+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
445+ ),
446+ cast_to = DocumentListProcessingResponse ,
447+ )
448+
364449 def upload_file (
365450 self ,
366451 * ,
@@ -529,7 +614,7 @@ async def list(
529614 self ,
530615 * ,
531616 container_tags : SequenceNotStr [str ] | Omit = omit ,
532- filters : document_list_params . Filters | Omit = omit ,
617+ filters : QueryParam | Omit = omit ,
533618 include_content : bool | Omit = omit ,
534619 limit : Union [str , float ] | Omit = omit ,
535620 order : Literal ["asc" , "desc" ] | Omit = omit ,
@@ -681,6 +766,67 @@ async def add(
681766 cast_to = DocumentAddResponse ,
682767 )
683768
769+ async def batch_create (
770+ self ,
771+ * ,
772+ documents : Union [Iterable [document_batch_create_params .DocumentsUnionMember0 ], SequenceNotStr [str ]],
773+ container_tag : str | Omit = omit ,
774+ container_tags : SequenceNotStr [str ] | Omit = omit ,
775+ content : None | Omit = omit ,
776+ metadata : Dict [str , Union [str , float , bool , SequenceNotStr [str ]]] | Omit = omit ,
777+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
778+ # The extra values given here take precedence over values defined on the client or passed to this method.
779+ extra_headers : Headers | None = None ,
780+ extra_query : Query | None = None ,
781+ extra_body : Body | None = None ,
782+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
783+ ) -> DocumentBatchCreateResponse :
784+ """Add multiple documents in a single request.
785+
786+ Each document can have any content
787+ type (text, url, file, etc.) and metadata
788+
789+ Args:
790+ container_tag: Optional tag this document should be containerized by. This can be an ID for
791+ your user, a project ID, or any other identifier you wish to use to group
792+ documents.
793+
794+ container_tags: (DEPRECATED: Use containerTag instead) Optional tags this document should be
795+ containerized by. This can be an ID for your user, a project ID, or any other
796+ identifier you wish to use to group documents.
797+
798+ metadata: Optional metadata for the document. This is used to store additional information
799+ about the document. You can use this to store any additional information you
800+ need about the document. Metadata can be filtered through. Keys must be strings
801+ and are case sensitive. Values can be strings, numbers, or booleans. You cannot
802+ nest objects.
803+
804+ extra_headers: Send extra headers
805+
806+ extra_query: Add additional query parameters to the request
807+
808+ extra_body: Add additional JSON properties to the request
809+
810+ timeout: Override the client-level default timeout for this request, in seconds
811+ """
812+ return await self ._post (
813+ "/v3/documents/batch" ,
814+ body = await async_maybe_transform (
815+ {
816+ "documents" : documents ,
817+ "container_tag" : container_tag ,
818+ "container_tags" : container_tags ,
819+ "content" : content ,
820+ "metadata" : metadata ,
821+ },
822+ document_batch_create_params .DocumentBatchCreateParams ,
823+ ),
824+ options = make_request_options (
825+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
826+ ),
827+ cast_to = DocumentBatchCreateResponse ,
828+ )
829+
684830 async def delete_bulk (
685831 self ,
686832 * ,
@@ -757,6 +903,25 @@ async def get(
757903 cast_to = DocumentGetResponse ,
758904 )
759905
906+ async def list_processing (
907+ self ,
908+ * ,
909+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
910+ # The extra values given here take precedence over values defined on the client or passed to this method.
911+ extra_headers : Headers | None = None ,
912+ extra_query : Query | None = None ,
913+ extra_body : Body | None = None ,
914+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
915+ ) -> DocumentListProcessingResponse :
916+ """Get documents that are currently being processed"""
917+ return await self ._get (
918+ "/v3/documents/processing" ,
919+ options = make_request_options (
920+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
921+ ),
922+ cast_to = DocumentListProcessingResponse ,
923+ )
924+
760925 async def upload_file (
761926 self ,
762927 * ,
@@ -843,12 +1008,18 @@ def __init__(self, documents: DocumentsResource) -> None:
8431008 self .add = to_raw_response_wrapper (
8441009 documents .add ,
8451010 )
1011+ self .batch_create = to_raw_response_wrapper (
1012+ documents .batch_create ,
1013+ )
8461014 self .delete_bulk = to_raw_response_wrapper (
8471015 documents .delete_bulk ,
8481016 )
8491017 self .get = to_raw_response_wrapper (
8501018 documents .get ,
8511019 )
1020+ self .list_processing = to_raw_response_wrapper (
1021+ documents .list_processing ,
1022+ )
8521023 self .upload_file = to_raw_response_wrapper (
8531024 documents .upload_file ,
8541025 )
@@ -870,12 +1041,18 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
8701041 self .add = async_to_raw_response_wrapper (
8711042 documents .add ,
8721043 )
1044+ self .batch_create = async_to_raw_response_wrapper (
1045+ documents .batch_create ,
1046+ )
8731047 self .delete_bulk = async_to_raw_response_wrapper (
8741048 documents .delete_bulk ,
8751049 )
8761050 self .get = async_to_raw_response_wrapper (
8771051 documents .get ,
8781052 )
1053+ self .list_processing = async_to_raw_response_wrapper (
1054+ documents .list_processing ,
1055+ )
8791056 self .upload_file = async_to_raw_response_wrapper (
8801057 documents .upload_file ,
8811058 )
@@ -897,12 +1074,18 @@ def __init__(self, documents: DocumentsResource) -> None:
8971074 self .add = to_streamed_response_wrapper (
8981075 documents .add ,
8991076 )
1077+ self .batch_create = to_streamed_response_wrapper (
1078+ documents .batch_create ,
1079+ )
9001080 self .delete_bulk = to_streamed_response_wrapper (
9011081 documents .delete_bulk ,
9021082 )
9031083 self .get = to_streamed_response_wrapper (
9041084 documents .get ,
9051085 )
1086+ self .list_processing = to_streamed_response_wrapper (
1087+ documents .list_processing ,
1088+ )
9061089 self .upload_file = to_streamed_response_wrapper (
9071090 documents .upload_file ,
9081091 )
@@ -924,12 +1107,18 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
9241107 self .add = async_to_streamed_response_wrapper (
9251108 documents .add ,
9261109 )
1110+ self .batch_create = async_to_streamed_response_wrapper (
1111+ documents .batch_create ,
1112+ )
9271113 self .delete_bulk = async_to_streamed_response_wrapper (
9281114 documents .delete_bulk ,
9291115 )
9301116 self .get = async_to_streamed_response_wrapper (
9311117 documents .get ,
9321118 )
1119+ self .list_processing = async_to_streamed_response_wrapper (
1120+ documents .list_processing ,
1121+ )
9331122 self .upload_file = async_to_streamed_response_wrapper (
9341123 documents .upload_file ,
9351124 )
0 commit comments