|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | import base64 |
6 | | -from typing import List, Union, Iterable, cast |
| 6 | +from typing import List, Tuple, Union, Iterable, cast |
7 | 7 | from typing_extensions import Literal |
8 | 8 |
|
9 | 9 | import httpx |
@@ -46,7 +46,7 @@ def with_streaming_response(self) -> EmbeddingsWithStreamingResponse: |
46 | 46 | def create( |
47 | 47 | self, |
48 | 48 | *, |
49 | | - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], |
| 49 | + input: Union[str, List[str], Tuple[str], Iterable[int], Iterable[Iterable[int]]], |
50 | 50 | model: Union[str, EmbeddingModel], |
51 | 51 | dimensions: int | NotGiven = NOT_GIVEN, |
52 | 52 | encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, |
@@ -94,6 +94,10 @@ def create( |
94 | 94 |
|
95 | 95 | timeout: Override the client-level default timeout for this request, in seconds |
96 | 96 | """ |
| 97 | + |
| 98 | + if isinstance(input, tuple) and all(isinstance(item, str) for item in input): |
| 99 | + input = list(input) |
| 100 | + |
97 | 101 | params = { |
98 | 102 | "input": input, |
99 | 103 | "model": model, |
@@ -158,7 +162,7 @@ def with_streaming_response(self) -> AsyncEmbeddingsWithStreamingResponse: |
158 | 162 | async def create( |
159 | 163 | self, |
160 | 164 | *, |
161 | | - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], |
| 165 | + input: Union[str, List[str], Tuple[str], Iterable[int], Iterable[Iterable[int]]], |
162 | 166 | model: Union[str, EmbeddingModel], |
163 | 167 | dimensions: int | NotGiven = NOT_GIVEN, |
164 | 168 | encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, |
@@ -206,6 +210,10 @@ async def create( |
206 | 210 |
|
207 | 211 | timeout: Override the client-level default timeout for this request, in seconds |
208 | 212 | """ |
| 213 | + |
| 214 | + if isinstance(input, tuple) and all(isinstance(item, str) for item in input): |
| 215 | + input = list(input) |
| 216 | + |
209 | 217 | params = { |
210 | 218 | "input": input, |
211 | 219 | "model": model, |
|
0 commit comments