From 1eca2284a2cb34c462d523a0a597338064cbb764 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:59:50 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#190) --- src/cloudflare/resources/logpush/jobs.py | 4 +- .../magic_network_monitoring/rules/rules.py | 4 +- src/cloudflare/resources/workers/ai.py | 398 +----- src/cloudflare/types/workers/ai_run_params.py | 84 +- tests/api_resources/workers/test_ai.py | 1088 +++-------------- 5 files changed, 213 insertions(+), 1365 deletions(-) diff --git a/src/cloudflare/resources/logpush/jobs.py b/src/cloudflare/resources/logpush/jobs.py index f16d111e08b..13b4b38af47 100644 --- a/src/cloudflare/resources/logpush/jobs.py +++ b/src/cloudflare/resources/logpush/jobs.py @@ -285,7 +285,7 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs", - page=SyncSinglePage[LogpushJob], + page=SyncSinglePage[Optional[LogpushJob]], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -667,7 +667,7 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs", - page=AsyncSinglePage[LogpushJob], + page=AsyncSinglePage[Optional[LogpushJob]], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py index fa4ae167353..4560798250e 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py @@ -150,7 +150,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/mnm/rules", - page=SyncSinglePage[MagicNetworkMonitoringRule], + page=SyncSinglePage[Optional[MagicNetworkMonitoringRule]], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +394,7 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/mnm/rules", - page=AsyncSinglePage[MagicNetworkMonitoringRule], + page=AsyncSinglePage[Optional[MagicNetworkMonitoringRule]], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/cloudflare/resources/workers/ai.py b/src/cloudflare/resources/workers/ai.py index fbdb4390602..bfa50dff4b9 100644 --- a/src/cloudflare/resources/workers/ai.py +++ b/src/cloudflare/resources/workers/ai.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( required_args, maybe_transform, @@ -188,42 +188,6 @@ def run( """ ... - @overload - def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload def run( self, @@ -260,42 +224,6 @@ def run( """ ... - @overload - def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload def run( self, @@ -332,42 +260,6 @@ def run( """ ... - @overload - def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload def run( self, @@ -410,9 +302,10 @@ def run( model_name: str, *, account_id: str, - prompt: str, lora: str | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.TextGenerationMessage] | NotGiven = NOT_GIVEN, + prompt: str | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -444,44 +337,6 @@ def run( """ ... - @overload - def run( - self, - model_name: str, - *, - account_id: str, - messages: Iterable[ai_run_params.Variant11Message], - max_tokens: int | NotGiven = NOT_GIVEN, - stream: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload def run( self, @@ -557,42 +412,6 @@ def run( """ ... - @overload - def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload def run( self, @@ -636,17 +455,12 @@ def run( ["account_id", "prompt"], ["account_id", "sentences", "source"], ["account_id", "text"], - ["account_id", "body"], ["account_id"], - ["account_id", "body"], ["account_id"], - ["account_id", "body"], ["account_id"], - ["account_id", "prompt"], - ["account_id", "messages"], + ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id", "body"], ["account_id"], ) def run( @@ -663,13 +477,12 @@ def run( strength: float | NotGiven = NOT_GIVEN, sentences: List[str] | NotGiven = NOT_GIVEN, source: str | NotGiven = NOT_GIVEN, - body: FileTypes | NotGiven = NOT_GIVEN, audio: Iterable[float] | NotGiven = NOT_GIVEN, lora: str | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.TextGenerationMessage] | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, - messages: Iterable[ai_run_params.Variant11Message] | NotGiven = NOT_GIVEN, target_lang: str | NotGiven = NOT_GIVEN, source_lang: str | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, @@ -700,13 +513,12 @@ def run( "strength": strength, "sentences": sentences, "source": source, - "body": body, "audio": audio, "lora": lora, "max_tokens": max_tokens, + "messages": messages, "raw": raw, "stream": stream, - "messages": messages, "target_lang": target_lang, "source_lang": source_lang, "input_text": input_text, @@ -887,42 +699,6 @@ async def run( """ ... - @overload - async def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload async def run( self, @@ -959,42 +735,6 @@ async def run( """ ... - @overload - async def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload async def run( self, @@ -1031,42 +771,6 @@ async def run( """ ... - @overload - async def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload async def run( self, @@ -1109,9 +813,10 @@ async def run( model_name: str, *, account_id: str, - prompt: str, lora: str | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.TextGenerationMessage] | NotGiven = NOT_GIVEN, + prompt: str | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1143,44 +848,6 @@ async def run( """ ... - @overload - async def run( - self, - model_name: str, - *, - account_id: str, - messages: Iterable[ai_run_params.Variant11Message], - max_tokens: int | NotGiven = NOT_GIVEN, - stream: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload async def run( self, @@ -1256,42 +923,6 @@ async def run( """ ... - @overload - async def run( - self, - model_name: str, - *, - account_id: str, - body: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AIRunResponse]: - """ - This endpoint provides users with the capability to run specific AI models - on-demand. - - By submitting the required input data, users can receive real-time predictions - or results generated by the chosen AI model. The endpoint supports various AI - model types, ensuring flexibility and adaptability for diverse use cases. - - Model specific inputs available in - [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - @overload async def run( self, @@ -1335,17 +966,12 @@ async def run( ["account_id", "prompt"], ["account_id", "sentences", "source"], ["account_id", "text"], - ["account_id", "body"], ["account_id"], - ["account_id", "body"], ["account_id"], - ["account_id", "body"], ["account_id"], - ["account_id", "prompt"], - ["account_id", "messages"], + ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id", "body"], ["account_id"], ) async def run( @@ -1362,13 +988,12 @@ async def run( strength: float | NotGiven = NOT_GIVEN, sentences: List[str] | NotGiven = NOT_GIVEN, source: str | NotGiven = NOT_GIVEN, - body: FileTypes | NotGiven = NOT_GIVEN, audio: Iterable[float] | NotGiven = NOT_GIVEN, lora: str | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + messages: Iterable[ai_run_params.TextGenerationMessage] | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, - messages: Iterable[ai_run_params.Variant11Message] | NotGiven = NOT_GIVEN, target_lang: str | NotGiven = NOT_GIVEN, source_lang: str | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, @@ -1399,13 +1024,12 @@ async def run( "strength": strength, "sentences": sentences, "source": source, - "body": body, "audio": audio, "lora": lora, "max_tokens": max_tokens, + "messages": messages, "raw": raw, "stream": stream, - "messages": messages, "target_lang": target_lang, "source_lang": source_lang, "input_text": input_text, diff --git a/src/cloudflare/types/workers/ai_run_params.py b/src/cloudflare/types/workers/ai_run_params.py index 7bb117df3a2..f29e3068b68 100644 --- a/src/cloudflare/types/workers/ai_run_params.py +++ b/src/cloudflare/types/workers/ai_run_params.py @@ -5,27 +5,20 @@ from typing import List, Union, Iterable from typing_extensions import Required, TypedDict -from ..._types import FileTypes - __all__ = [ "AIRunParams", "TextClassification", "TextToImage", "SentenceSimilarity", "TextEmbeddings", - "Variant4", - "Variant5", - "Variant6", - "Variant7", - "Variant8", - "Variant9", - "Variant10", - "Variant11", - "Variant11Message", + "SpeechRecognition", + "ImageClassification", + "ObjectDetection", + "TextGeneration", + "TextGenerationMessage", "Translation", "Summarization", - "Variant14", - "Variant15", + "ImageToText", ] @@ -65,67 +58,41 @@ class TextEmbeddings(TypedDict, total=False): text: Required[Union[str, List[str]]] -class Variant4(TypedDict, total=False): - account_id: Required[str] - - body: Required[FileTypes] - - -class Variant5(TypedDict, total=False): +class SpeechRecognition(TypedDict, total=False): account_id: Required[str] audio: Iterable[float] -class Variant6(TypedDict, total=False): - account_id: Required[str] - - body: Required[FileTypes] - - -class Variant7(TypedDict, total=False): +class ImageClassification(TypedDict, total=False): account_id: Required[str] image: Iterable[float] -class Variant8(TypedDict, total=False): - account_id: Required[str] - - body: Required[FileTypes] - - -class Variant9(TypedDict, total=False): +class ObjectDetection(TypedDict, total=False): account_id: Required[str] image: Iterable[float] -class Variant10(TypedDict, total=False): +class TextGeneration(TypedDict, total=False): account_id: Required[str] - prompt: Required[str] - lora: str max_tokens: int - raw: bool - - stream: bool - - -class Variant11(TypedDict, total=False): - account_id: Required[str] + messages: Iterable[TextGenerationMessage] - messages: Required[Iterable[Variant11Message]] + prompt: str - max_tokens: int + raw: bool stream: bool -class Variant11Message(TypedDict, total=False): +class TextGenerationMessage(TypedDict, total=False): content: Required[str] role: Required[str] @@ -149,13 +116,7 @@ class Summarization(TypedDict, total=False): max_length: int -class Variant14(TypedDict, total=False): - account_id: Required[str] - - body: Required[FileTypes] - - -class Variant15(TypedDict, total=False): +class ImageToText(TypedDict, total=False): account_id: Required[str] image: Iterable[float] @@ -170,16 +131,11 @@ class Variant15(TypedDict, total=False): TextToImage, SentenceSimilarity, TextEmbeddings, - Variant4, - Variant5, - Variant6, - Variant7, - Variant8, - Variant9, - Variant10, - Variant11, + SpeechRecognition, + ImageClassification, + ObjectDetection, + TextGeneration, Translation, Summarization, - Variant14, - Variant15, + ImageToText, ] diff --git a/tests/api_resources/workers/test_ai.py b/tests/api_resources/workers/test_ai.py index d4580b77ba0..3ad76d766d6 100644 --- a/tests/api_resources/workers/test_ai.py +++ b/tests/api_resources/workers/test_ai.py @@ -271,7 +271,16 @@ def test_method_run_overload_5(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + ) + assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_run_with_all_params_overload_5(self, client: Cloudflare) -> None: + ai = client.workers.ai.run( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + audio=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -281,7 +290,6 @@ def test_raw_response_run_overload_5(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) assert response.is_closed is True @@ -295,7 +303,6 @@ def test_streaming_response_run_overload_5(self, client: Cloudflare) -> None: with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -312,14 +319,12 @@ def test_path_params_run_overload_5(self, client: Cloudflare) -> None: client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) @pytest.mark.skip() @@ -337,7 +342,7 @@ def test_method_run_with_all_params_overload_6(self, client: Cloudflare) -> None ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - audio=[0, 0, 0], + image=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -390,7 +395,16 @@ def test_method_run_overload_7(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + ) + assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_run_with_all_params_overload_7(self, client: Cloudflare) -> None: + ai = client.workers.ai.run( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + image=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -400,7 +414,6 @@ def test_raw_response_run_overload_7(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) assert response.is_closed is True @@ -414,7 +427,6 @@ def test_streaming_response_run_overload_7(self, client: Cloudflare) -> None: with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -431,14 +443,12 @@ def test_path_params_run_overload_7(self, client: Cloudflare) -> None: client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) @pytest.mark.skip() @@ -456,7 +466,25 @@ def test_method_run_with_all_params_overload_8(self, client: Cloudflare) -> None ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - image=[0, 0, 0], + lora="string", + max_tokens=0, + messages=[ + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + { + "content": "string", + "role": "string", + }, + ], + prompt="x", + raw=True, + stream=True, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -509,7 +537,20 @@ def test_method_run_overload_9(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + target_lang="string", + text="x", + ) + assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_run_with_all_params_overload_9(self, client: Cloudflare) -> None: + ai = client.workers.ai.run( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + target_lang="string", + text="x", + source_lang="string", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -519,7 +560,8 @@ def test_raw_response_run_overload_9(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + target_lang="string", + text="x", ) assert response.is_closed is True @@ -533,7 +575,8 @@ def test_streaming_response_run_overload_9(self, client: Cloudflare) -> None: with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + target_lang="string", + text="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -550,14 +593,16 @@ def test_path_params_run_overload_9(self, client: Cloudflare) -> None: client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", + target_lang="string", + text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + target_lang="string", + text="x", ) @pytest.mark.skip() @@ -566,6 +611,7 @@ def test_method_run_overload_10(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + input_text="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -575,7 +621,8 @@ def test_method_run_with_all_params_overload_10(self, client: Cloudflare) -> Non ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - image=[0, 0, 0], + input_text="x", + max_length=0, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -585,6 +632,7 @@ def test_raw_response_run_overload_10(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + input_text="x", ) assert response.is_closed is True @@ -598,6 +646,7 @@ def test_streaming_response_run_overload_10(self, client: Cloudflare) -> None: with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + input_text="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -614,12 +663,14 @@ def test_path_params_run_overload_10(self, client: Cloudflare) -> None: client.workers.ai.with_raw_response.run( "string", account_id="", + input_text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + input_text="x", ) @pytest.mark.skip() @@ -628,7 +679,6 @@ def test_method_run_overload_11(self, client: Cloudflare) -> None: ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -638,11 +688,9 @@ def test_method_run_with_all_params_overload_11(self, client: Cloudflare) -> Non ai = client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - lora="string", + image=[0, 0, 0], max_tokens=0, - raw=True, - stream=True, + prompt="string", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @@ -652,115 +700,6 @@ def test_raw_response_run_overload_11(self, client: Cloudflare) -> None: response = client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_run_overload_11(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_11(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - prompt="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) - - @pytest.mark.skip() - @parametrize - def test_method_run_overload_12(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_run_with_all_params_overload_12(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], - max_tokens=0, - stream=True, - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_run_overload_12(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) assert response.is_closed is True @@ -770,608 +709,55 @@ def test_raw_response_run_overload_12(self, client: Cloudflare) -> None: @pytest.mark.skip() @parametrize - def test_streaming_response_run_overload_12(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_12(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], - ) - - @pytest.mark.skip() - @parametrize - def test_method_run_overload_13(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - target_lang="string", - text="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_run_with_all_params_overload_13(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - target_lang="string", - text="x", - source_lang="string", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_run_overload_13(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - target_lang="string", - text="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_run_overload_13(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - target_lang="string", - text="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_13(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - target_lang="string", - text="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - target_lang="string", - text="x", - ) - - @pytest.mark.skip() - @parametrize - def test_method_run_overload_14(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - input_text="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_run_with_all_params_overload_14(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - input_text="x", - max_length=0, - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_run_overload_14(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - input_text="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_run_overload_14(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - input_text="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_14(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - input_text="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - input_text="x", - ) - - @pytest.mark.skip() - @parametrize - def test_method_run_overload_15(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_run_overload_15(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_run_overload_15(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_15(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - body=b"raw file contents", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - - @pytest.mark.skip() - @parametrize - def test_method_run_overload_16(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_run_with_all_params_overload_16(self, client: Cloudflare) -> None: - ai = client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - image=[0, 0, 0], - max_tokens=0, - prompt="string", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_run_overload_16(self, client: Cloudflare) -> None: - response = client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_run_overload_16(self, client: Cloudflare) -> None: - with client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_run_overload_16(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.workers.ai.with_raw_response.run( - "string", - account_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncAI: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_run_overload_1(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_run_overload_1(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "string", - account_id="", - text="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_run_overload_2(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_run_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - guidance=0, - image=[0, 0, 0], - mask=[0, 0, 0], - num_steps=0, - strength=0, - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_run_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "string", - account_id="", - prompt="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_run_overload_3(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - sentences=["x", "x", "x"], - source="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - sentences=["x", "x", "x"], - source="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - sentences=["x", "x", "x"], - source="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_run_overload_3(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "string", - account_id="", - sentences=["x", "x", "x"], - source="x", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - sentences=["x", "x", "x"], - source="x", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_run_overload_4(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( + def test_streaming_response_run_overload_11(self, client: Cloudflare) -> None: + with client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() + ai = response.parse() assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_4(self, async_client: AsyncCloudflare) -> None: + def test_path_params_run_overload_11(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.ai.with_raw_response.run( + client.workers.ai.with_raw_response.run( "string", account_id="", - text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( + client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - text="x", ) + +class TestAsyncAI: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip() @parametrize - async def test_method_run_overload_5(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_1(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + text="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + text="x", ) assert response.is_closed is True @@ -1381,11 +767,11 @@ async def test_raw_response_run_overload_5(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_1(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + text="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1397,46 +783,53 @@ async def test_streaming_response_run_overload_5(self, async_client: AsyncCloudf @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_5(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_1(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", + text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + text="x", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_6(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_2(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + prompt="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - audio=[0, 0, 0], + prompt="x", + guidance=0, + image=[0, 0, 0], + mask=[0, 0, 0], + num_steps=0, + strength=0, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + prompt="x", ) assert response.is_closed is True @@ -1446,10 +839,11 @@ async def test_raw_response_run_overload_6(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_2(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + prompt="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1461,36 +855,40 @@ async def test_streaming_response_run_overload_6(self, async_client: AsyncCloudf @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_6(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", + prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + prompt="x", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_7(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_3(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + sentences=["x", "x", "x"], + source="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + sentences=["x", "x", "x"], + source="x", ) assert response.is_closed is True @@ -1500,11 +898,12 @@ async def test_raw_response_run_overload_7(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_3(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + sentences=["x", "x", "x"], + source="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1516,46 +915,40 @@ async def test_streaming_response_run_overload_7(self, async_client: AsyncCloudf @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_7(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_3(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", + sentences=["x", "x", "x"], + source="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", + sentences=["x", "x", "x"], + source="x", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_8(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_run_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_4(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - image=[0, 0, 0], + text="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + text="x", ) assert response.is_closed is True @@ -1565,10 +958,11 @@ async def test_raw_response_run_overload_8(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_4(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + text="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1580,36 +974,46 @@ async def test_streaming_response_run_overload_8(self, async_client: AsyncCloudf @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_8(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_4(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", + text="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", + text="x", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_9(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_5(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: + ai = await async_client.workers.ai.run( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + audio=[0, 0, 0], + ) + assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) assert response.is_closed is True @@ -1619,11 +1023,10 @@ async def test_raw_response_run_overload_9(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_5(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1635,24 +1038,22 @@ async def test_streaming_response_run_overload_9(self, async_client: AsyncCloudf @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_9(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_5(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", - body=b"raw file contents", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_10(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_6(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1661,7 +1062,7 @@ async def test_method_run_overload_10(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1671,7 +1072,7 @@ async def test_method_run_with_all_params_overload_10(self, async_client: AsyncC @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1684,7 +1085,7 @@ async def test_raw_response_run_overload_10(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_6(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1699,7 +1100,7 @@ async def test_streaming_response_run_overload_10(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_10(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_6(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", @@ -1714,35 +1115,29 @@ async def test_path_params_run_overload_10(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_run_overload_11(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_7(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_7(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", - lora="string", - max_tokens=0, - raw=True, - stream=True, + image=[0, 0, 0], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", ) assert response.is_closed is True @@ -1752,11 +1147,10 @@ async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_7(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1768,50 +1162,36 @@ async def test_streaming_response_run_overload_11(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_11(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_7(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", - prompt="x", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - prompt="x", ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_12(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_8(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_12(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_8(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", + lora="string", + max_tokens=0, messages=[ { "content": "string", @@ -1826,31 +1206,18 @@ async def test_method_run_with_all_params_overload_12(self, async_client: AsyncC "role": "string", }, ], - max_tokens=0, + prompt="x", + raw=True, stream=True, ) assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_12(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) assert response.is_closed is True @@ -1860,24 +1227,10 @@ async def test_raw_response_run_overload_12(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_12(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_8(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1889,50 +1242,22 @@ async def test_streaming_response_run_overload_12(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_12(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_8(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", account_id="", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): await async_client.workers.ai.with_raw_response.run( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - messages=[ - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - { - "content": "string", - "role": "string", - }, - ], ) @pytest.mark.skip() @parametrize - async def test_method_run_overload_13(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_9(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1943,7 +1268,7 @@ async def test_method_run_overload_13(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_13(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_9(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1955,7 +1280,7 @@ async def test_method_run_with_all_params_overload_13(self, async_client: AsyncC @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_13(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1970,7 +1295,7 @@ async def test_raw_response_run_overload_13(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_13(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_9(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -1987,7 +1312,7 @@ async def test_streaming_response_run_overload_13(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_13(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_9(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", @@ -2006,7 +1331,7 @@ async def test_path_params_run_overload_13(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_run_overload_14(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_10(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2016,7 +1341,7 @@ async def test_method_run_overload_14(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_14(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_10(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2027,7 +1352,7 @@ async def test_method_run_with_all_params_overload_14(self, async_client: AsyncC @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_14(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2041,7 +1366,7 @@ async def test_raw_response_run_overload_14(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_14(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_10(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2057,7 +1382,7 @@ async def test_streaming_response_run_overload_14(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_14(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_10(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string", @@ -2074,64 +1399,7 @@ async def test_path_params_run_overload_14(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_method_run_overload_15(self, async_client: AsyncCloudflare) -> None: - ai = await async_client.workers.ai.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_run_overload_15(self, async_client: AsyncCloudflare) -> None: - response = await async_client.workers.ai.with_raw_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_run_overload_15(self, async_client: AsyncCloudflare) -> None: - async with async_client.workers.ai.with_streaming_response.run( - "string", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ai = await response.parse() - assert_matches_type(Optional[AIRunResponse], ai, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_run_overload_15(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "string", - account_id="", - body=b"raw file contents", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_name` but received ''"): - await async_client.workers.ai.with_raw_response.run( - "", - account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=b"raw file contents", - ) - - @pytest.mark.skip() - @parametrize - async def test_method_run_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_overload_11(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2140,7 +1408,7 @@ async def test_method_run_overload_16(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip() @parametrize - async def test_method_run_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_method_run_with_all_params_overload_11(self, async_client: AsyncCloudflare) -> None: ai = await async_client.workers.ai.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2152,7 +1420,7 @@ async def test_method_run_with_all_params_overload_16(self, async_client: AsyncC @pytest.mark.skip() @parametrize - async def test_raw_response_run_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: response = await async_client.workers.ai.with_raw_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2165,7 +1433,7 @@ async def test_raw_response_run_overload_16(self, async_client: AsyncCloudflare) @pytest.mark.skip() @parametrize - async def test_streaming_response_run_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_run_overload_11(self, async_client: AsyncCloudflare) -> None: async with async_client.workers.ai.with_streaming_response.run( "string", account_id="023e105f4ecef8ad9ca31a8372d0c353", @@ -2180,7 +1448,7 @@ async def test_streaming_response_run_overload_16(self, async_client: AsyncCloud @pytest.mark.skip() @parametrize - async def test_path_params_run_overload_16(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_run_overload_11(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.workers.ai.with_raw_response.run( "string",