feat: add watermark param (#28)
Co-authored-by: cuijianmin <jianmin.cui@aminer.cn> Co-authored-by: wellenzheng <40078093+wellenzheng@users.noreply.github.com>
This commit is contained in:
parent
9c4860ac59
commit
ab6128d584
7 changed files with 17 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "zai-sdk"
|
||||
version = "0.0.3.2"
|
||||
version = "0.0.3.3"
|
||||
description = "A SDK library for accessing big model apis from Z.ai"
|
||||
authors = ["Z.ai"]
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
__title__ = 'Z.ai'
|
||||
__version__ = '0.0.3.2'
|
||||
__version__ = '0.0.3.3'
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ class Audio(BaseAPI):
|
|||
extra_headers: Headers | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
) -> HttpxBinaryResponseContent:
|
||||
"""
|
||||
Generate customized speech audio with voice cloning
|
||||
|
|
@ -119,6 +120,7 @@ class Audio(BaseAPI):
|
|||
extra_headers (Headers): Additional headers to send
|
||||
extra_body (Body): Additional body parameters
|
||||
timeout (float | httpx.Timeout): Request timeout
|
||||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated audio
|
||||
"""
|
||||
body = deepcopy_minimal(
|
||||
{
|
||||
|
|
@ -130,6 +132,7 @@ class Audio(BaseAPI):
|
|||
'sensitive_word_check': sensitive_word_check,
|
||||
'request_id': request_id,
|
||||
'user_id': user_id,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
}
|
||||
)
|
||||
files = extract_files(cast(Mapping[str, object], body), paths=[['voice_data']])
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class AsyncCompletions(BaseAPI):
|
|||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
response_format: object | None = None,
|
||||
thinking: object | None = None,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
) -> AsyncTaskStatus:
|
||||
"""
|
||||
Create an asynchronous chat completion task
|
||||
|
|
@ -84,6 +85,7 @@ class AsyncCompletions(BaseAPI):
|
|||
timeout (float | httpx.Timeout): Request timeout
|
||||
response_format (Optional[object]): Response format specification
|
||||
thinking (Optional[object]): Configuration parameters for model reasoning
|
||||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated audio
|
||||
"""
|
||||
_cast_type = AsyncTaskStatus
|
||||
logger.debug(f'temperature:{temperature}, top_p:{top_p}')
|
||||
|
|
@ -128,6 +130,7 @@ class AsyncCompletions(BaseAPI):
|
|||
'extra': maybe_transform(extra, code_geex_params.CodeGeexExtra),
|
||||
'response_format': response_format,
|
||||
'thinking': thinking,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
}
|
||||
return self._post(
|
||||
'/async/chat/completions',
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class Completions(BaseAPI):
|
|||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
response_format: object | None = None,
|
||||
thinking: object | None = None,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
) -> Completion | StreamResponse[ChatCompletionChunk]:
|
||||
"""
|
||||
Create a chat completion
|
||||
|
|
@ -91,6 +92,7 @@ class Completions(BaseAPI):
|
|||
timeout (float | httpx.Timeout): Request timeout
|
||||
response_format (object): Response format specification
|
||||
thinking (Optional[object]): Configuration parameters for model reasoning
|
||||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated audio
|
||||
"""
|
||||
logger.debug(f'temperature:{temperature}, top_p:{top_p}')
|
||||
if temperature is not None and temperature != NOT_GIVEN:
|
||||
|
|
@ -138,6 +140,7 @@ class Completions(BaseAPI):
|
|||
'extra': maybe_transform(extra, code_geex_params.CodeGeexExtra),
|
||||
'response_format': response_format,
|
||||
'thinking': thinking,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
}
|
||||
)
|
||||
return self._post(
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class Images(BaseAPI):
|
|||
extra_body: Body | None = None,
|
||||
disable_strict_validation: Optional[bool] | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
) -> ImagesResponded:
|
||||
"""
|
||||
Generate images from text prompts
|
||||
|
|
@ -58,6 +59,7 @@ class Images(BaseAPI):
|
|||
extra_body (Body): Additional body parameters
|
||||
disable_strict_validation (Optional[bool]): Whether to disable strict validation
|
||||
timeout (float | httpx.Timeout): Request timeout
|
||||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated images
|
||||
"""
|
||||
_cast_type = ImagesResponded
|
||||
if disable_strict_validation:
|
||||
|
|
@ -76,6 +78,7 @@ class Images(BaseAPI):
|
|||
'user': user,
|
||||
'user_id': user_id,
|
||||
'request_id': request_id,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
},
|
||||
options=make_request_options(extra_headers=extra_headers, extra_body=extra_body, timeout=timeout),
|
||||
cast_type=_cast_type,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class Videos(BaseAPI):
|
|||
extra_headers: Headers | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
) -> VideoObject:
|
||||
"""
|
||||
Generate videos from text prompts or images
|
||||
|
|
@ -71,6 +72,7 @@ class Videos(BaseAPI):
|
|||
extra_headers (Headers): Additional headers to send
|
||||
extra_body (Body): Additional body parameters
|
||||
timeout (float | httpx.Timeout): Request timeout
|
||||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated videos
|
||||
"""
|
||||
if not model:
|
||||
raise ValueError('`model` must be provided.')
|
||||
|
|
@ -90,6 +92,7 @@ class Videos(BaseAPI):
|
|||
'sensitive_word_check': sensitive_word_check,
|
||||
'request_id': request_id,
|
||||
'user_id': user_id,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
}
|
||||
)
|
||||
return self._post(
|
||||
|
|
|
|||
Loading…
Reference in a new issue