Skip to content

Commit d0878f3

Browse files
committed
Merge 'integration_2024-12-23_644381953026' into 'master'
merge branch integration_2024-12-23_644381953026 into master See merge request: !461
2 parents 3a381ca + 4419856 commit d0878f3

File tree

112 files changed

+14494
-1232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+14494
-1232
lines changed

meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"lasted": "1.0.116",
3-
"meta_commit": "a8e26faf0844df58acde265bda1bb8a840c66f23"
2+
"lasted": "1.0.117",
3+
"meta_commit": "2210833c30450b487401a215db24501634363c42"
44
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages # noqa: H301
44

55
NAME = "volcengine-python-sdk"
6-
VERSION = "1.0.116"
6+
VERSION = "1.0.117"
77
# To install the library, run the following
88
#
99
# python setup.py install

volcenginesdkarkruntime/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def _load_cert_by_ak_sk(self, ep: str) -> str:
325325
resp: volcenginesdkark.GetEndpointCertificateResponse = self.api_instance.get_endpoint_certificate(
326326
get_endpoint_certificate_request)
327327
except ApiException as e:
328-
raise ArkAPIError("Getting Certificate failed: %s\n" % e)
328+
raise ArkAPIError("Getting model vendor encryption certificate failed: %s\n" % e)
329329

330330
return resp.pca_instance_certificate
331331

volcenginesdkarkruntime/resources/chat/completions.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Dict, List, Union, Iterable, Optional, Callable, Iterator, AsyncIterator
44

55
import httpx
6+
import warnings
67
from typing_extensions import Literal
78

89
from ..._types import Body, Query, Headers
@@ -32,7 +33,6 @@
3233

3334
__all__ = ["Completions", "AsyncCompletions"]
3435

35-
3636
class Completions(SyncAPIResource):
3737
@cached_property
3838
def with_raw_response(self) -> CompletionsWithRawResponse:
@@ -50,10 +50,20 @@ def _process_messages(self, messages: Iterable[ChatCompletionMessageParam],
5050
if isinstance(current_content, str):
5151
message["content"] = f(current_content)
5252
elif isinstance(current_content, Iterable):
53-
raise TypeError("content type {} is not supported end-to-end encryption".
54-
format(type(message.get('content'))))
53+
for part in current_content:
54+
if part.get("type", None) == "text":
55+
part["text"] = f(part["text"])
56+
elif part.get("type", None) == "image_url":
57+
if part["image_url"]["url"].startswith('data:'):
58+
part["image_url"]["url"] = f(part["image_url"]["url"])
59+
else:
60+
warnings.warn("encryption is not supported for image url, "
61+
"please use base64 image if you want encryption")
62+
else:
63+
raise TypeError("encryption is not supported for content type {}".
64+
format(type(part)))
5565
else:
56-
raise TypeError("content type {} is not supported end-to-end encryption".
66+
raise TypeError("encryption is not supported for content type {}".
5767
format(type(message.get('content'))))
5868

5969
def _encrypt(self, model: str, messages: Iterable[ChatCompletionMessageParam], extra_headers: Headers
@@ -177,8 +187,21 @@ def _process_messages(self, messages: Iterable[ChatCompletionMessageParam],
177187
current_content = message.get("content")
178188
if isinstance(current_content, str):
179189
message["content"] = f(current_content)
190+
elif isinstance(current_content, Iterable):
191+
for part in current_content:
192+
if part.get("type", None) == "text":
193+
part["text"] = f(part["text"])
194+
elif part.get("type", None) == "image_url":
195+
if part["image_url"]["url"].startswith('data:'):
196+
part["image_url"]["url"] = f(part["image_url"]["url"])
197+
else:
198+
warnings.warn("encryption is not supported for image url, "
199+
"please use base64 image if you want encryption")
200+
else:
201+
raise TypeError("encryption is not supported for content type {}".
202+
format(type(part)))
180203
else:
181-
raise TypeError("content type {} is not supported end-to-end encryption".
204+
raise TypeError("encryption is not supported for content type {}".
182205
format(type(message.get('content'))))
183206

184207
def _encrypt(self, model: str, messages: Iterable[ChatCompletionMessageParam], extra_headers: Headers
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from ..._models import BaseModel
2+
3+
__all__ = ["ChatCompletionAudio"]
4+
5+
6+
class ChatCompletionAudio(BaseModel):
7+
id: str
8+
"""Unique identifier for this audio response."""
9+
10+
data: str
11+
"""
12+
Base64 encoded audio bytes generated by the model.
13+
"""
14+
15+
expires_at: int
16+
"""
17+
The Unix timestamp (in seconds) for when this audio response will no longer be
18+
accessible on the server for use in multi-turn conversations.
19+
"""
20+
21+
transcript: str
22+
"""Transcript of the audio generated by the model."""

volcenginesdkarkruntime/types/chat/chat_completion_message.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from ..._models import BaseModel
55
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall
6+
from .chat_completion_audio import ChatCompletionAudio
67

78
__all__ = ["ChatCompletionMessage", "FunctionCall"]
89

@@ -36,3 +37,6 @@ class ChatCompletionMessage(BaseModel):
3637

3738
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
3839
"""The tool calls generated by the model, such as function calls."""
40+
41+
audio: Optional[ChatCompletionAudio] = None
42+
"""Audio response from the model."""

volcenginesdkclb/models/create_listener_request.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class CreateListenerRequest(object):
3737
'acl_status': 'str',
3838
'acl_type': 'str',
3939
'bandwidth': 'int',
40+
'cert_center_certificate_id': 'str',
4041
'certificate_id': 'str',
42+
'certificate_source': 'str',
4143
'client_body_timeout': 'int',
4244
'client_header_timeout': 'int',
4345
'connection_drain_enabled': 'str',
@@ -73,7 +75,9 @@ class CreateListenerRequest(object):
7375
'acl_status': 'AclStatus',
7476
'acl_type': 'AclType',
7577
'bandwidth': 'Bandwidth',
78+
'cert_center_certificate_id': 'CertCenterCertificateId',
7679
'certificate_id': 'CertificateId',
80+
'certificate_source': 'CertificateSource',
7781
'client_body_timeout': 'ClientBodyTimeout',
7882
'client_header_timeout': 'ClientHeaderTimeout',
7983
'connection_drain_enabled': 'ConnectionDrainEnabled',
@@ -104,7 +108,7 @@ class CreateListenerRequest(object):
104108
'tags': 'Tags'
105109
}
106110

107-
def __init__(self, acl_ids=None, acl_status=None, acl_type=None, bandwidth=None, certificate_id=None, client_body_timeout=None, client_header_timeout=None, connection_drain_enabled=None, connection_drain_timeout=None, cookie=None, description=None, enabled=None, end_port=None, established_timeout=None, health_check=None, http2_enabled=None, keepalive_timeout=None, listener_name=None, load_balancer_id=None, persistence_timeout=None, persistence_type=None, port=None, protocol=None, proxy_connect_timeout=None, proxy_protocol_type=None, proxy_read_timeout=None, proxy_send_timeout=None, scheduler=None, security_policy_id=None, send_timeout=None, server_group_id=None, start_port=None, tags=None, _configuration=None): # noqa: E501
111+
def __init__(self, acl_ids=None, acl_status=None, acl_type=None, bandwidth=None, cert_center_certificate_id=None, certificate_id=None, certificate_source=None, client_body_timeout=None, client_header_timeout=None, connection_drain_enabled=None, connection_drain_timeout=None, cookie=None, description=None, enabled=None, end_port=None, established_timeout=None, health_check=None, http2_enabled=None, keepalive_timeout=None, listener_name=None, load_balancer_id=None, persistence_timeout=None, persistence_type=None, port=None, protocol=None, proxy_connect_timeout=None, proxy_protocol_type=None, proxy_read_timeout=None, proxy_send_timeout=None, scheduler=None, security_policy_id=None, send_timeout=None, server_group_id=None, start_port=None, tags=None, _configuration=None): # noqa: E501
108112
"""CreateListenerRequest - a model defined in Swagger""" # noqa: E501
109113
if _configuration is None:
110114
_configuration = Configuration()
@@ -114,7 +118,9 @@ def __init__(self, acl_ids=None, acl_status=None, acl_type=None, bandwidth=None,
114118
self._acl_status = None
115119
self._acl_type = None
116120
self._bandwidth = None
121+
self._cert_center_certificate_id = None
117122
self._certificate_id = None
123+
self._certificate_source = None
118124
self._client_body_timeout = None
119125
self._client_header_timeout = None
120126
self._connection_drain_enabled = None
@@ -153,8 +159,12 @@ def __init__(self, acl_ids=None, acl_status=None, acl_type=None, bandwidth=None,
153159
self.acl_type = acl_type
154160
if bandwidth is not None:
155161
self.bandwidth = bandwidth
162+
if cert_center_certificate_id is not None:
163+
self.cert_center_certificate_id = cert_center_certificate_id
156164
if certificate_id is not None:
157165
self.certificate_id = certificate_id
166+
if certificate_source is not None:
167+
self.certificate_source = certificate_source
158168
if client_body_timeout is not None:
159169
self.client_body_timeout = client_body_timeout
160170
if client_header_timeout is not None:
@@ -292,6 +302,27 @@ def bandwidth(self, bandwidth):
292302

293303
self._bandwidth = bandwidth
294304

305+
@property
306+
def cert_center_certificate_id(self):
307+
"""Gets the cert_center_certificate_id of this CreateListenerRequest. # noqa: E501
308+
309+
310+
:return: The cert_center_certificate_id of this CreateListenerRequest. # noqa: E501
311+
:rtype: str
312+
"""
313+
return self._cert_center_certificate_id
314+
315+
@cert_center_certificate_id.setter
316+
def cert_center_certificate_id(self, cert_center_certificate_id):
317+
"""Sets the cert_center_certificate_id of this CreateListenerRequest.
318+
319+
320+
:param cert_center_certificate_id: The cert_center_certificate_id of this CreateListenerRequest. # noqa: E501
321+
:type: str
322+
"""
323+
324+
self._cert_center_certificate_id = cert_center_certificate_id
325+
295326
@property
296327
def certificate_id(self):
297328
"""Gets the certificate_id of this CreateListenerRequest. # noqa: E501
@@ -313,6 +344,27 @@ def certificate_id(self, certificate_id):
313344

314345
self._certificate_id = certificate_id
315346

347+
@property
348+
def certificate_source(self):
349+
"""Gets the certificate_source of this CreateListenerRequest. # noqa: E501
350+
351+
352+
:return: The certificate_source of this CreateListenerRequest. # noqa: E501
353+
:rtype: str
354+
"""
355+
return self._certificate_source
356+
357+
@certificate_source.setter
358+
def certificate_source(self, certificate_source):
359+
"""Sets the certificate_source of this CreateListenerRequest.
360+
361+
362+
:param certificate_source: The certificate_source of this CreateListenerRequest. # noqa: E501
363+
:type: str
364+
"""
365+
366+
self._certificate_source = certificate_source
367+
316368
@property
317369
def client_body_timeout(self):
318370
"""Gets the client_body_timeout of this CreateListenerRequest. # noqa: E501

0 commit comments

Comments
 (0)