Skip to content

Commit 83db6c2

Browse files
author
hexiaochun
committed
feat(ark): add name & parallel_tool_calls
1 parent 240d768 commit 83db6c2

File tree

9 files changed

+94
-1
lines changed

9 files changed

+94
-1
lines changed

volcenginesdkarkruntime/resources/batch_chat/completions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import timedelta, datetime
66
from random import random
77
from typing import Dict, List, Union, Iterable, Optional, Callable
8+
from typing_extensions import Literal
89

910
import httpx
1011

@@ -130,6 +131,8 @@ def create(
130131
top_p: Optional[float] | None = None,
131132
repetition_penalty: Optional[float] | None = None,
132133
n: Optional[int] | None = None,
134+
parallel_tool_calls: Optional[bool] | None = None,
135+
service_tier: Optional[Literal["auto", "default"]] | None = None,
133136
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
134137
response_format: completion_create_params.ResponseFormat | None = None,
135138
user: str | None = None,
@@ -172,6 +175,8 @@ def create(
172175
"user": user,
173176
"repetition_penalty": repetition_penalty,
174177
"n": n,
178+
"parallel_tool_calls": parallel_tool_calls,
179+
"service_tier": service_tier,
175180
"tool_choice": tool_choice,
176181
"response_format": response_format,
177182
},
@@ -272,6 +277,8 @@ async def create(
272277
user: str | None = None,
273278
repetition_penalty: Optional[float] | None = None,
274279
n: Optional[int] | None = None,
280+
parallel_tool_calls: Optional[bool] | None = None,
281+
service_tier: Optional[Literal["auto", "default"]] | None = None,
275282
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
276283
response_format: completion_create_params.ResponseFormat | None = None,
277284
extra_headers: Headers | None = None,
@@ -314,6 +321,8 @@ async def create(
314321
"user": user,
315322
"repetition_penalty": repetition_penalty,
316323
"n": n,
324+
"parallel_tool_calls": parallel_tool_calls,
325+
"service_tier": service_tier,
317326
"tool_choice": tool_choice,
318327
"response_format": response_format,
319328
},

volcenginesdkarkruntime/resources/bot/completions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def create(
6363
top_p: Optional[float] | None = None,
6464
repetition_penalty: Optional[float] | None = None,
6565
n: Optional[int] | None = None,
66+
parallel_tool_calls: Optional[bool] | None = None,
67+
service_tier: Optional[Literal["auto", "default"]] | None = None,
6668
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
6769
response_format: completion_create_params.ResponseFormat | None = None,
6870
user: str | None = None,
@@ -93,6 +95,8 @@ def create(
9395
"user": user,
9496
"repetition_penalty": repetition_penalty,
9597
"n": n,
98+
"parallel_tool_calls": parallel_tool_calls,
99+
"service_tier": service_tier,
96100
"tool_choice": tool_choice,
97101
"response_format": response_format,
98102
"metadata": metadata,
@@ -139,6 +143,8 @@ async def create(
139143
top_p: Optional[float] | None = None,
140144
repetition_penalty: Optional[float] | None = None,
141145
n: Optional[int] | None = None,
146+
parallel_tool_calls: Optional[bool] | None = None,
147+
service_tier: Optional[Literal["auto", "default"]] | None = None,
142148
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
143149
response_format: completion_create_params.ResponseFormat | None = None,
144150
user: str | None = None,
@@ -169,6 +175,8 @@ async def create(
169175
"user": user,
170176
"repetition_penalty": repetition_penalty,
171177
"n": n,
178+
"parallel_tool_calls": parallel_tool_calls,
179+
"service_tier": service_tier,
172180
"tool_choice": tool_choice,
173181
"response_format": response_format,
174182
"metadata": metadata,

volcenginesdkarkruntime/resources/chat/completions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ def create(
158158
top_p: Optional[float] | None = None,
159159
repetition_penalty: Optional[float] | None = None,
160160
n: Optional[int] | None = None,
161+
parallel_tool_calls: Optional[bool] | None = None,
162+
service_tier: Optional[Literal["auto", "default"]] | None = None,
161163
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
162164
response_format: completion_create_params.ResponseFormat | None = None,
163165
user: str | None = None,
@@ -195,6 +197,8 @@ def create(
195197
"user": user,
196198
"repetition_penalty": repetition_penalty,
197199
"n": n,
200+
"parallel_tool_calls": parallel_tool_calls,
201+
"service_tier": service_tier,
198202
"tool_choice": tool_choice,
199203
"response_format": response_format,
200204
},
@@ -296,6 +300,8 @@ async def create(
296300
user: str | None = None,
297301
repetition_penalty: Optional[float] | None = None,
298302
n: Optional[int] | None = None,
303+
parallel_tool_calls: Optional[bool] | None = None,
304+
service_tier: Optional[Literal["auto", "default"]] | None = None,
299305
tool_choice: ChatCompletionToolChoiceOptionParam | None = None,
300306
response_format: completion_create_params.ResponseFormat | None = None,
301307
extra_headers: Headers | None = None,
@@ -332,6 +338,8 @@ async def create(
332338
"user": user,
333339
"repetition_penalty": repetition_penalty,
334340
"n": n,
341+
"parallel_tool_calls": parallel_tool_calls,
342+
"service_tier": service_tier,
335343
"tool_choice": tool_choice,
336344
"response_format": response_format,
337345
},

volcenginesdkarkruntime/types/chat/chat_completion.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ class ChatCompletion(BaseModel):
5959
model: str
6060
"""The model used for the chat completion."""
6161

62+
service_tier: Optional[Literal["auto", "default"]]
63+
"""Specifies the latency tier to use for processing the request.
64+
65+
This parameter is relevant for customers subscribed to the scale tier service:
66+
67+
- If set to 'auto', and the endpoint is Scale tier enabled, the system will
68+
utilize scale tier credits until they are exhausted.
69+
- If set to 'auto', and the endpoint is not Scale tier enabled, the request will
70+
be processed using the default service tier with a lower uptime SLA and no
71+
latency guarentee.
72+
- If set to 'default', the request will be processed using the default service
73+
tier with a lower uptime SLA and no latency guarentee.
74+
- When not set, the default behavior is 'auto'.
75+
76+
When this parameter is set, the response body will include the `service_tier`
77+
utilized.
78+
"""
79+
6280
object: Literal["chat.completion"]
6381
"""The object type, which is always `chat.completion`."""
6482

volcenginesdkarkruntime/types/chat/chat_completion_assistant_message_param.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ class ChatCompletionAssistantMessageParam(TypedDict, total=False):
3131
Required unless `tool_calls` or `function_call` is specified.
3232
"""
3333

34+
name: Optional[str]
35+
"""An optional name for the participant.
36+
37+
Provides the model information to differentiate between participants of the same
38+
role.
39+
"""
40+
3441
function_call: FunctionCall
3542
"""Deprecated and replaced by `tool_calls`.
3643

volcenginesdkarkruntime/types/chat/chat_completion_chunk.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ class ChatCompletionChunk(BaseModel):
123123
model: str
124124
"""The model to generate the completion."""
125125

126+
service_tier: Optional[Literal["auto", "default"]]
127+
"""Specifies the latency tier to use for processing the request.
128+
129+
This parameter is relevant for customers subscribed to the scale tier service:
130+
131+
- If set to 'auto', and the endpoint is Scale tier enabled, the system will
132+
utilize scale tier credits until they are exhausted.
133+
- If set to 'auto', and the endpoint is not Scale tier enabled, the request will
134+
be processed using the default service tier with a lower uptime SLA and no
135+
latency guarentee.
136+
- If set to 'default', the request will be processed using the default service
137+
tier with a lower uptime SLA and no latency guarentee.
138+
- When not set, the default behavior is 'auto'.
139+
140+
When this parameter is set, the response body will include the `service_tier`
141+
utilized.
142+
"""
143+
126144
object: Literal["chat.completion.chunk"]
127145
"""The object type, which is always `chat.completion.chunk`."""
128146

volcenginesdkarkruntime/types/chat/chat_completion_system_message_param.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from typing import Optional
4+
35
from typing_extensions import Literal, Required, TypedDict
46

57
__all__ = ["ChatCompletionSystemMessageParam"]
@@ -11,3 +13,10 @@ class ChatCompletionSystemMessageParam(TypedDict, total=False):
1113

1214
role: Required[Literal["system"]]
1315
"""The role of the messages author, in this case `system`."""
16+
17+
name: Optional[str]
18+
"""An optional name for the participant.
19+
20+
Provides the model information to differentiate between participants of the same
21+
role.
22+
"""

volcenginesdkarkruntime/types/chat/chat_completion_tool_message_param.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from typing import Optional
4+
35
from typing_extensions import Literal, Required, TypedDict
46

57
__all__ = ["ChatCompletionToolMessageParam"]
@@ -12,5 +14,12 @@ class ChatCompletionToolMessageParam(TypedDict, total=False):
1214
role: Required[Literal["tool"]]
1315
"""The role of the messages author, in this case `tool`."""
1416

17+
name: Optional[str]
18+
"""An optional name for the participant.
19+
20+
Provides the model information to differentiate between participants of the same
21+
role.
22+
"""
23+
1524
tool_call_id: Required[str]
1625
"""Tool call that this message is responding to."""

volcenginesdkarkruntime/types/chat/chat_completion_user_message_param.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Union, Iterable
3+
from typing import Union, Iterable, Optional
44
from typing_extensions import Literal, Required, TypedDict
55

66
from .chat_completion_content_part_param import ChatCompletionContentPartParam
@@ -14,3 +14,10 @@ class ChatCompletionUserMessageParam(TypedDict, total=False):
1414

1515
role: Required[Literal["user"]]
1616
"""The role of the messages author, in this case `user`."""
17+
18+
name: Optional[str]
19+
"""An optional name for the participant.
20+
21+
Provides the model information to differentiate between participants of the same
22+
role.
23+
"""

0 commit comments

Comments
 (0)