diff --git a/src/openai/resources/embeddings.py b/src/openai/resources/embeddings.py index 4ab2278e89..65a57a3834 100644 --- a/src/openai/resources/embeddings.py +++ b/src/openai/resources/embeddings.py @@ -3,7 +3,7 @@ from __future__ import annotations import base64 -from typing import List, Union, Iterable, cast +from typing import List, Tuple, Union, Iterable, cast from typing_extensions import Literal import httpx @@ -46,7 +46,7 @@ def with_streaming_response(self) -> EmbeddingsWithStreamingResponse: def create( self, *, - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], + input: Union[str, List[str], Tuple[str, ...], Iterable[int], Iterable[Iterable[int]]], model: Union[str, EmbeddingModel], dimensions: int | NotGiven = NOT_GIVEN, encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, @@ -94,6 +94,10 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ + + if isinstance(input, tuple) and all(isinstance(item, str) for item in input): + input = list(input) + params = { "input": input, "model": model, @@ -158,7 +162,7 @@ def with_streaming_response(self) -> AsyncEmbeddingsWithStreamingResponse: async def create( self, *, - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], + input: Union[str, List[str], Tuple[str, ...], Iterable[int], Iterable[Iterable[int]]], model: Union[str, EmbeddingModel], dimensions: int | NotGiven = NOT_GIVEN, encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, @@ -206,6 +210,10 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ + + if isinstance(input, tuple) and all(isinstance(item, str) for item in input): + input = list(input) + params = { "input": input, "model": model,