66
77import httpx
88
9- from ..types import file_list_params , file_retry_params
9+ from ..types import file_list_params , file_retry_params , file_upload_params
1010from .._types import Body , Omit , Query , Headers , NotGiven , FileTypes , SequenceNotStr , omit , not_given
1111from .._utils import maybe_transform , async_maybe_transform
1212from .._compat import cached_property
@@ -274,6 +274,7 @@ def upload(
274274 content : FileTypes ,
275275 content_disposition : str ,
276276 content_type : str ,
277+ graph_id : str | Omit = omit ,
277278 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
278279 # The extra values given here take precedence over values defined on the client or passed to this method.
279280 extra_headers : Headers | None = None ,
@@ -287,6 +288,13 @@ def upload(
287288 DOC, DOCX, PPT, PPTX, JPG, PNG, EML, HTML, SRT, CSV, XLS, and XLSX.
288289
289290 Args:
291+ graph_id: The unique identifier of the Knowledge Graph to associate the uploaded file
292+ with.
293+
294+ Note: The response from the upload endpoint does not include the `graphId`
295+ field, but the association will be visible when you retrieve the file using the
296+ file retrieval endpoint.
297+
290298 extra_headers: Send extra headers
291299
292300 extra_query: Add additional query parameters to the request
@@ -303,7 +311,11 @@ def upload(
303311 return self ._post (
304312 "/v1/files" ,
305313 options = make_request_options (
306- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
314+ extra_headers = extra_headers ,
315+ extra_query = extra_query ,
316+ extra_body = extra_body ,
317+ timeout = timeout ,
318+ query = maybe_transform ({"graph_id" : graph_id }, file_upload_params .FileUploadParams ),
307319 ),
308320 binary_request = content ,
309321 cast_to = File ,
@@ -550,6 +562,7 @@ async def upload(
550562 content : FileTypes ,
551563 content_disposition : str ,
552564 content_type : str ,
565+ graph_id : str | Omit = omit ,
553566 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
554567 # The extra values given here take precedence over values defined on the client or passed to this method.
555568 extra_headers : Headers | None = None ,
@@ -563,6 +576,13 @@ async def upload(
563576 DOC, DOCX, PPT, PPTX, JPG, PNG, EML, HTML, SRT, CSV, XLS, and XLSX.
564577
565578 Args:
579+ graph_id: The unique identifier of the Knowledge Graph to associate the uploaded file
580+ with.
581+
582+ Note: The response from the upload endpoint does not include the `graphId`
583+ field, but the association will be visible when you retrieve the file using the
584+ file retrieval endpoint.
585+
566586 extra_headers: Send extra headers
567587
568588 extra_query: Add additional query parameters to the request
@@ -579,7 +599,11 @@ async def upload(
579599 return await self ._post (
580600 "/v1/files" ,
581601 options = make_request_options (
582- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
602+ extra_headers = extra_headers ,
603+ extra_query = extra_query ,
604+ extra_body = extra_body ,
605+ timeout = timeout ,
606+ query = await async_maybe_transform ({"graph_id" : graph_id }, file_upload_params .FileUploadParams ),
583607 ),
584608 binary_request = content ,
585609 cast_to = File ,
0 commit comments