Skip to content

Commit c30e2a0

Browse files
fix(types): remove model enum constraint in chat completions
1 parent 556c449 commit c30e2a0

File tree

10 files changed

+60
-140
lines changed

10 files changed

+60
-140
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 74
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-17535cff686ac0b5c2d265ae3702954e58f9d5dfb7cc9b25c641f15d81a37877.yml
3-
openapi_spec_hash: aa6403bd0f77df741d96b2cb9064443a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-59ee1b4dba9d98feae58f6f49eed513e8af43068176ab4dec7783cea9af44dee.yml
3+
openapi_spec_hash: 07cb012932e3337076a1e2a2ce4618b7
44
config_hash: b66198d27b4d5c152688ff6cccfdeab5

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ chat_completion = client.chat.completions.create(
193193
"role": "system",
194194
}
195195
],
196-
model="Qwen/Qwen3.5-9B",
196+
model="model",
197197
reasoning={},
198198
)
199199
print(chat_completion.reasoning)

src/together/resources/chat/completions.py

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union, Iterable
5+
from typing import Dict, Iterable
66
from typing_extensions import Literal, overload
77

88
import httpx
@@ -52,16 +52,7 @@ def create(
5252
self,
5353
*,
5454
messages: Iterable[completion_create_params.Message],
55-
model: Union[
56-
Literal[
57-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
58-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
59-
"Qwen/Qwen3.5-9B",
60-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
61-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
62-
],
63-
str,
64-
],
55+
model: str,
6556
chat_template_kwargs: object | Omit = omit,
6657
compliance: Literal["hipaa"] | Omit = omit,
6758
context_length_exceeded_behavior: Literal["truncate", "error"] | Omit = omit,
@@ -207,16 +198,7 @@ def create(
207198
self,
208199
*,
209200
messages: Iterable[completion_create_params.Message],
210-
model: Union[
211-
Literal[
212-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
213-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
214-
"Qwen/Qwen3.5-9B",
215-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
216-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
217-
],
218-
str,
219-
],
201+
model: str,
220202
stream: Literal[True],
221203
chat_template_kwargs: object | Omit = omit,
222204
compliance: Literal["hipaa"] | Omit = omit,
@@ -362,16 +344,7 @@ def create(
362344
self,
363345
*,
364346
messages: Iterable[completion_create_params.Message],
365-
model: Union[
366-
Literal[
367-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
368-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
369-
"Qwen/Qwen3.5-9B",
370-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
371-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
372-
],
373-
str,
374-
],
347+
model: str,
375348
stream: bool,
376349
chat_template_kwargs: object | Omit = omit,
377350
compliance: Literal["hipaa"] | Omit = omit,
@@ -517,16 +490,7 @@ def create(
517490
self,
518491
*,
519492
messages: Iterable[completion_create_params.Message],
520-
model: Union[
521-
Literal[
522-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
523-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
524-
"Qwen/Qwen3.5-9B",
525-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
526-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
527-
],
528-
str,
529-
],
493+
model: str,
530494
chat_template_kwargs: object | Omit = omit,
531495
compliance: Literal["hipaa"] | Omit = omit,
532496
context_length_exceeded_behavior: Literal["truncate", "error"] | Omit = omit,
@@ -629,16 +593,7 @@ async def create(
629593
self,
630594
*,
631595
messages: Iterable[completion_create_params.Message],
632-
model: Union[
633-
Literal[
634-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
635-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
636-
"Qwen/Qwen3.5-9B",
637-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
638-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
639-
],
640-
str,
641-
],
596+
model: str,
642597
chat_template_kwargs: object | Omit = omit,
643598
compliance: Literal["hipaa"] | Omit = omit,
644599
context_length_exceeded_behavior: Literal["truncate", "error"] | Omit = omit,
@@ -784,16 +739,7 @@ async def create(
784739
self,
785740
*,
786741
messages: Iterable[completion_create_params.Message],
787-
model: Union[
788-
Literal[
789-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
790-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
791-
"Qwen/Qwen3.5-9B",
792-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
793-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
794-
],
795-
str,
796-
],
742+
model: str,
797743
stream: Literal[True],
798744
chat_template_kwargs: object | Omit = omit,
799745
compliance: Literal["hipaa"] | Omit = omit,
@@ -939,16 +885,7 @@ async def create(
939885
self,
940886
*,
941887
messages: Iterable[completion_create_params.Message],
942-
model: Union[
943-
Literal[
944-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
945-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
946-
"Qwen/Qwen3.5-9B",
947-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
948-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
949-
],
950-
str,
951-
],
888+
model: str,
952889
stream: bool,
953890
chat_template_kwargs: object | Omit = omit,
954891
compliance: Literal["hipaa"] | Omit = omit,
@@ -1094,16 +1031,7 @@ async def create(
10941031
self,
10951032
*,
10961033
messages: Iterable[completion_create_params.Message],
1097-
model: Union[
1098-
Literal[
1099-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
1100-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
1101-
"Qwen/Qwen3.5-9B",
1102-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
1103-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
1104-
],
1105-
str,
1106-
],
1034+
model: str,
11071035
chat_template_kwargs: object | Omit = omit,
11081036
compliance: Literal["hipaa"] | Omit = omit,
11091037
context_length_exceeded_behavior: Literal["truncate", "error"] | Omit = omit,

src/together/resources/endpoints.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def list_hardware(
352352
Args:
353353
model: Filter hardware configurations by model compatibility. When provided, the
354354
response includes availability status for each compatible configuration.
355+
[See all of Together AI's dedicated models](https://docs.together.ai/docs/dedicated-models)
355356
356357
extra_headers: Send extra headers
357358
@@ -693,6 +694,7 @@ async def list_hardware(
693694
Args:
694695
model: Filter hardware configurations by model compatibility. When provided, the
695696
response includes availability status for each compatible configuration.
697+
[See all of Together AI's dedicated models](https://docs.together.ai/docs/dedicated-models)
696698
697699
extra_headers: Send extra headers
698700

src/together/types/chat/completion_create_params.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,7 @@ class CompletionCreateParamsBase(TypedDict, total=False):
4444
messages: Required[Iterable[Message]]
4545
"""A list of messages comprising the conversation so far."""
4646

47-
model: Required[
48-
Union[
49-
Literal[
50-
"Qwen/Qwen2.5-72B-Instruct-Turbo",
51-
"Qwen/Qwen2.5-7B-Instruct-Turbo",
52-
"Qwen/Qwen3.5-9B",
53-
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
54-
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
55-
],
56-
str,
57-
]
58-
]
47+
model: Required[str]
5948
"""The name of the model to query.
6049
6150
[See all of Together AI's chat models](https://docs.together.ai/docs/serverless-models#chat-models)

src/together/types/endpoint_list_hardware_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ class EndpointListHardwareParams(TypedDict, total=False):
1313
1414
When provided, the response includes availability status for each compatible
1515
configuration.
16+
[See all of Together AI's dedicated models](https://docs.together.ai/docs/dedicated-models)
1617
"""

tests/api_resources/chat/test_completions.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_method_create_overload_1(self, client: Together) -> None:
2626
"role": "system",
2727
}
2828
],
29-
model="Qwen/Qwen3.5-9B",
29+
model="model",
3030
)
3131
assert_matches_type(ChatCompletion, completion, path=["response"])
3232

@@ -40,7 +40,7 @@ def test_method_create_with_all_params_overload_1(self, client: Together) -> Non
4040
"name": "name",
4141
}
4242
],
43-
model="Qwen/Qwen3.5-9B",
43+
model="model",
4444
chat_template_kwargs={},
4545
compliance="hipaa",
4646
context_length_exceeded_behavior="truncate",
@@ -90,7 +90,7 @@ def test_raw_response_create_overload_1(self, client: Together) -> None:
9090
"role": "system",
9191
}
9292
],
93-
model="Qwen/Qwen3.5-9B",
93+
model="model",
9494
)
9595

9696
assert response.is_closed is True
@@ -107,7 +107,7 @@ def test_streaming_response_create_overload_1(self, client: Together) -> None:
107107
"role": "system",
108108
}
109109
],
110-
model="Qwen/Qwen3.5-9B",
110+
model="model",
111111
) as response:
112112
assert not response.is_closed
113113
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -126,7 +126,7 @@ def test_method_create_overload_2(self, client: Together) -> None:
126126
"role": "system",
127127
}
128128
],
129-
model="Qwen/Qwen3.5-9B",
129+
model="model",
130130
stream=True,
131131
)
132132
completion_stream.response.close()
@@ -141,7 +141,7 @@ def test_method_create_with_all_params_overload_2(self, client: Together) -> Non
141141
"name": "name",
142142
}
143143
],
144-
model="Qwen/Qwen3.5-9B",
144+
model="model",
145145
stream=True,
146146
chat_template_kwargs={},
147147
compliance="hipaa",
@@ -191,7 +191,7 @@ def test_raw_response_create_overload_2(self, client: Together) -> None:
191191
"role": "system",
192192
}
193193
],
194-
model="Qwen/Qwen3.5-9B",
194+
model="model",
195195
stream=True,
196196
)
197197

@@ -208,7 +208,7 @@ def test_streaming_response_create_overload_2(self, client: Together) -> None:
208208
"role": "system",
209209
}
210210
],
211-
model="Qwen/Qwen3.5-9B",
211+
model="model",
212212
stream=True,
213213
) as response:
214214
assert not response.is_closed
@@ -234,7 +234,7 @@ async def test_method_create_overload_1(self, async_client: AsyncTogether) -> No
234234
"role": "system",
235235
}
236236
],
237-
model="Qwen/Qwen3.5-9B",
237+
model="model",
238238
)
239239
assert_matches_type(ChatCompletion, completion, path=["response"])
240240

@@ -248,7 +248,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
248248
"name": "name",
249249
}
250250
],
251-
model="Qwen/Qwen3.5-9B",
251+
model="model",
252252
chat_template_kwargs={},
253253
compliance="hipaa",
254254
context_length_exceeded_behavior="truncate",
@@ -298,7 +298,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncTogether)
298298
"role": "system",
299299
}
300300
],
301-
model="Qwen/Qwen3.5-9B",
301+
model="model",
302302
)
303303

304304
assert response.is_closed is True
@@ -315,7 +315,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncTog
315315
"role": "system",
316316
}
317317
],
318-
model="Qwen/Qwen3.5-9B",
318+
model="model",
319319
) as response:
320320
assert not response.is_closed
321321
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -334,7 +334,7 @@ async def test_method_create_overload_2(self, async_client: AsyncTogether) -> No
334334
"role": "system",
335335
}
336336
],
337-
model="Qwen/Qwen3.5-9B",
337+
model="model",
338338
stream=True,
339339
)
340340
await completion_stream.response.aclose()
@@ -349,7 +349,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
349349
"name": "name",
350350
}
351351
],
352-
model="Qwen/Qwen3.5-9B",
352+
model="model",
353353
stream=True,
354354
chat_template_kwargs={},
355355
compliance="hipaa",
@@ -399,7 +399,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncTogether)
399399
"role": "system",
400400
}
401401
],
402-
model="Qwen/Qwen3.5-9B",
402+
model="model",
403403
stream=True,
404404
)
405405

@@ -416,7 +416,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncTog
416416
"role": "system",
417417
}
418418
],
419-
model="Qwen/Qwen3.5-9B",
419+
model="model",
420420
stream=True,
421421
) as response:
422422
assert not response.is_closed

0 commit comments

Comments
 (0)