@@ -50,42 +50,6 @@ def with_raw_response(self) -> AIResourceWithRawResponse:
5050 def with_streaming_response (self ) -> AIResourceWithStreamingResponse :
5151 return AIResourceWithStreamingResponse (self )
5252
53- @overload
54- def run (
55- self ,
56- model_name : str ,
57- * ,
58- account_id : str ,
59- body : object ,
60- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61- # The extra values given here take precedence over values defined on the client or passed to this method.
62- extra_headers : Headers | None = None ,
63- extra_query : Query | None = None ,
64- extra_body : Body | None = None ,
65- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
66- ) -> Optional [AIRunResponse ]:
67- """
68- This endpoint provides users with the capability to run specific AI models
69- on-demand.
70-
71- By submitting the required input data, users can receive real-time predictions
72- or results generated by the chosen AI model. The endpoint supports various AI
73- model types, ensuring flexibility and adaptability for diverse use cases.
74-
75- Model specific inputs available in
76- [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).
77-
78- Args:
79- extra_headers: Send extra headers
80-
81- extra_query: Add additional query parameters to the request
82-
83- extra_body: Add additional JSON properties to the request
84-
85- timeout: Override the client-level default timeout for this request, in seconds
86- """
87- ...
88-
8953 @overload
9054 def run (
9155 self ,
@@ -367,15 +331,15 @@ def run(
367331 model_name : str ,
368332 * ,
369333 account_id : str ,
370- messages : Iterable [ai_run_params .Variant8Message ],
334+ messages : Iterable [ai_run_params .Variant7Message ],
371335 frequency_penalty : float | NotGiven = NOT_GIVEN ,
372336 max_tokens : int | NotGiven = NOT_GIVEN ,
373337 presence_penalty : float | NotGiven = NOT_GIVEN ,
374338 repetition_penalty : float | NotGiven = NOT_GIVEN ,
375339 seed : int | NotGiven = NOT_GIVEN ,
376340 stream : bool | NotGiven = NOT_GIVEN ,
377341 temperature : float | NotGiven = NOT_GIVEN ,
378- tools : Iterable [ai_run_params .Variant8Tool ] | NotGiven = NOT_GIVEN ,
342+ tools : Iterable [ai_run_params .Variant7Tool ] | NotGiven = NOT_GIVEN ,
379343 top_k : int | NotGiven = NOT_GIVEN ,
380344 top_p : float | NotGiven = NOT_GIVEN ,
381345 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -524,7 +488,6 @@ def run(
524488 ...
525489
526490 @required_args (
527- ["account_id" , "body" ],
528491 ["account_id" , "text" ],
529492 ["account_id" , "prompt" ],
530493 ["account_id" , "audio" ],
@@ -539,7 +502,6 @@ def run(
539502 model_name : str ,
540503 * ,
541504 account_id : str ,
542- body : object | NotGiven = NOT_GIVEN ,
543505 text : str | Union [str , List [str ]] | NotGiven = NOT_GIVEN ,
544506 prompt : str | NotGiven = NOT_GIVEN ,
545507 guidance : float | NotGiven = NOT_GIVEN ,
@@ -565,8 +527,8 @@ def run(
565527 temperature : float | NotGiven = NOT_GIVEN ,
566528 top_k : int | NotGiven = NOT_GIVEN ,
567529 top_p : float | NotGiven = NOT_GIVEN ,
568- messages : Iterable [ai_run_params .Variant8Message ] | NotGiven = NOT_GIVEN ,
569- tools : Iterable [ai_run_params .Variant8Tool ] | NotGiven = NOT_GIVEN ,
530+ messages : Iterable [ai_run_params .Variant7Message ] | NotGiven = NOT_GIVEN ,
531+ tools : Iterable [ai_run_params .Variant7Tool ] | NotGiven = NOT_GIVEN ,
570532 target_lang : str | NotGiven = NOT_GIVEN ,
571533 source_lang : str | NotGiven = NOT_GIVEN ,
572534 input_text : str | NotGiven = NOT_GIVEN ,
@@ -586,7 +548,42 @@ def run(
586548 Optional [AIRunResponse ],
587549 self ._post (
588550 f"/accounts/{ account_id } /ai/run/{ model_name } " ,
589- body = maybe_transform (body , ai_run_params .AIRunParams ),
551+ body = maybe_transform (
552+ {
553+ "text" : text ,
554+ "prompt" : prompt ,
555+ "guidance" : guidance ,
556+ "height" : height ,
557+ "image" : image ,
558+ "image_b64" : image_b64 ,
559+ "lora_weights" : lora_weights ,
560+ "loras" : loras ,
561+ "mask" : mask ,
562+ "negative_prompt" : negative_prompt ,
563+ "num_steps" : num_steps ,
564+ "seed" : seed ,
565+ "strength" : strength ,
566+ "width" : width ,
567+ "audio" : audio ,
568+ "frequency_penalty" : frequency_penalty ,
569+ "lora" : lora ,
570+ "max_tokens" : max_tokens ,
571+ "presence_penalty" : presence_penalty ,
572+ "raw" : raw ,
573+ "repetition_penalty" : repetition_penalty ,
574+ "stream" : stream ,
575+ "temperature" : temperature ,
576+ "top_k" : top_k ,
577+ "top_p" : top_p ,
578+ "messages" : messages ,
579+ "tools" : tools ,
580+ "target_lang" : target_lang ,
581+ "source_lang" : source_lang ,
582+ "input_text" : input_text ,
583+ "max_length" : max_length ,
584+ },
585+ ai_run_params .AIRunParams ,
586+ ),
590587 options = make_request_options (
591588 extra_headers = extra_headers ,
592589 extra_query = extra_query ,
@@ -614,42 +611,6 @@ def with_raw_response(self) -> AsyncAIResourceWithRawResponse:
614611 def with_streaming_response (self ) -> AsyncAIResourceWithStreamingResponse :
615612 return AsyncAIResourceWithStreamingResponse (self )
616613
617- @overload
618- async def run (
619- self ,
620- model_name : str ,
621- * ,
622- account_id : str ,
623- body : object ,
624- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
625- # The extra values given here take precedence over values defined on the client or passed to this method.
626- extra_headers : Headers | None = None ,
627- extra_query : Query | None = None ,
628- extra_body : Body | None = None ,
629- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
630- ) -> Optional [AIRunResponse ]:
631- """
632- This endpoint provides users with the capability to run specific AI models
633- on-demand.
634-
635- By submitting the required input data, users can receive real-time predictions
636- or results generated by the chosen AI model. The endpoint supports various AI
637- model types, ensuring flexibility and adaptability for diverse use cases.
638-
639- Model specific inputs available in
640- [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).
641-
642- Args:
643- extra_headers: Send extra headers
644-
645- extra_query: Add additional query parameters to the request
646-
647- extra_body: Add additional JSON properties to the request
648-
649- timeout: Override the client-level default timeout for this request, in seconds
650- """
651- ...
652-
653614 @overload
654615 async def run (
655616 self ,
@@ -931,15 +892,15 @@ async def run(
931892 model_name : str ,
932893 * ,
933894 account_id : str ,
934- messages : Iterable [ai_run_params .Variant8Message ],
895+ messages : Iterable [ai_run_params .Variant7Message ],
935896 frequency_penalty : float | NotGiven = NOT_GIVEN ,
936897 max_tokens : int | NotGiven = NOT_GIVEN ,
937898 presence_penalty : float | NotGiven = NOT_GIVEN ,
938899 repetition_penalty : float | NotGiven = NOT_GIVEN ,
939900 seed : int | NotGiven = NOT_GIVEN ,
940901 stream : bool | NotGiven = NOT_GIVEN ,
941902 temperature : float | NotGiven = NOT_GIVEN ,
942- tools : Iterable [ai_run_params .Variant8Tool ] | NotGiven = NOT_GIVEN ,
903+ tools : Iterable [ai_run_params .Variant7Tool ] | NotGiven = NOT_GIVEN ,
943904 top_k : int | NotGiven = NOT_GIVEN ,
944905 top_p : float | NotGiven = NOT_GIVEN ,
945906 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1088,7 +1049,6 @@ async def run(
10881049 ...
10891050
10901051 @required_args (
1091- ["account_id" , "body" ],
10921052 ["account_id" , "text" ],
10931053 ["account_id" , "prompt" ],
10941054 ["account_id" , "audio" ],
@@ -1103,7 +1063,6 @@ async def run(
11031063 model_name : str ,
11041064 * ,
11051065 account_id : str ,
1106- body : object | NotGiven = NOT_GIVEN ,
11071066 text : str | Union [str , List [str ]] | NotGiven = NOT_GIVEN ,
11081067 prompt : str | NotGiven = NOT_GIVEN ,
11091068 guidance : float | NotGiven = NOT_GIVEN ,
@@ -1129,8 +1088,8 @@ async def run(
11291088 temperature : float | NotGiven = NOT_GIVEN ,
11301089 top_k : int | NotGiven = NOT_GIVEN ,
11311090 top_p : float | NotGiven = NOT_GIVEN ,
1132- messages : Iterable [ai_run_params .Variant8Message ] | NotGiven = NOT_GIVEN ,
1133- tools : Iterable [ai_run_params .Variant8Tool ] | NotGiven = NOT_GIVEN ,
1091+ messages : Iterable [ai_run_params .Variant7Message ] | NotGiven = NOT_GIVEN ,
1092+ tools : Iterable [ai_run_params .Variant7Tool ] | NotGiven = NOT_GIVEN ,
11341093 target_lang : str | NotGiven = NOT_GIVEN ,
11351094 source_lang : str | NotGiven = NOT_GIVEN ,
11361095 input_text : str | NotGiven = NOT_GIVEN ,
@@ -1150,7 +1109,42 @@ async def run(
11501109 Optional [AIRunResponse ],
11511110 await self ._post (
11521111 f"/accounts/{ account_id } /ai/run/{ model_name } " ,
1153- body = await async_maybe_transform (body , ai_run_params .AIRunParams ),
1112+ body = await async_maybe_transform (
1113+ {
1114+ "text" : text ,
1115+ "prompt" : prompt ,
1116+ "guidance" : guidance ,
1117+ "height" : height ,
1118+ "image" : image ,
1119+ "image_b64" : image_b64 ,
1120+ "lora_weights" : lora_weights ,
1121+ "loras" : loras ,
1122+ "mask" : mask ,
1123+ "negative_prompt" : negative_prompt ,
1124+ "num_steps" : num_steps ,
1125+ "seed" : seed ,
1126+ "strength" : strength ,
1127+ "width" : width ,
1128+ "audio" : audio ,
1129+ "frequency_penalty" : frequency_penalty ,
1130+ "lora" : lora ,
1131+ "max_tokens" : max_tokens ,
1132+ "presence_penalty" : presence_penalty ,
1133+ "raw" : raw ,
1134+ "repetition_penalty" : repetition_penalty ,
1135+ "stream" : stream ,
1136+ "temperature" : temperature ,
1137+ "top_k" : top_k ,
1138+ "top_p" : top_p ,
1139+ "messages" : messages ,
1140+ "tools" : tools ,
1141+ "target_lang" : target_lang ,
1142+ "source_lang" : source_lang ,
1143+ "input_text" : input_text ,
1144+ "max_length" : max_length ,
1145+ },
1146+ ai_run_params .AIRunParams ,
1147+ ),
11541148 options = make_request_options (
11551149 extra_headers = extra_headers ,
11561150 extra_query = extra_query ,
0 commit comments