feat: tool stream param (#40)
Co-authored-by: Tomsun28 <tomsun28@outlook.com>
This commit is contained in:
parent
ed4c6233c4
commit
b0fe0fc11e
4 changed files with 5 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "zai-sdk"
|
||||
version = "0.0.3.7"
|
||||
version = "0.0.4"
|
||||
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.7'
|
||||
__version__ = '0.0.4'
|
||||
|
|
|
|||
|
|
@ -88,25 +88,6 @@ class AsyncCompletions(BaseAPI):
|
|||
watermark_enabled (Optional[bool]): Whether to enable watermark on generated audio
|
||||
"""
|
||||
_cast_type = AsyncTaskStatus
|
||||
logger.debug(f'temperature:{temperature}, top_p:{top_p}')
|
||||
if temperature is not None and temperature != NOT_GIVEN:
|
||||
if temperature <= 0:
|
||||
do_sample = False
|
||||
temperature = 0.01
|
||||
# logger.warning("temperature: value range is (0.0, 1.0) open interval,"
|
||||
# "do_sample rewritten as false (parameters top_p temperature do not take effect)")
|
||||
if temperature >= 1:
|
||||
temperature = 0.99
|
||||
# logger.warning("temperature: value range is (0.0, 1.0) open interval")
|
||||
if top_p is not None and top_p != NOT_GIVEN:
|
||||
if top_p >= 1:
|
||||
top_p = 0.99
|
||||
# logger.warning("top_p: value range is (0.0, 1.0) open interval, cannot equal 0 or 1")
|
||||
if top_p <= 0:
|
||||
top_p = 0.01
|
||||
# logger.warning("top_p: value range is (0.0, 1.0) open interval, cannot equal 0 or 1")
|
||||
|
||||
logger.debug(f'temperature:{temperature}, top_p:{top_p}')
|
||||
if isinstance(messages, List):
|
||||
for item in messages:
|
||||
if item.get('content'):
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class Completions(BaseAPI):
|
|||
response_format: object | None = None,
|
||||
thinking: object | None = None,
|
||||
watermark_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
||||
tool_stream: bool | NotGiven = NOT_GIVEN,
|
||||
) -> Completion | StreamResponse[ChatCompletionChunk]:
|
||||
"""
|
||||
Create a chat completion
|
||||
|
|
@ -93,6 +94,7 @@ class Completions(BaseAPI):
|
|||
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
|
||||
tool_stream (Optional[bool]): Whether to enable tool streaming
|
||||
"""
|
||||
logger.debug(f'temperature:{temperature}, top_p:{top_p}')
|
||||
if temperature is not None and temperature != NOT_GIVEN:
|
||||
|
|
@ -141,6 +143,7 @@ class Completions(BaseAPI):
|
|||
'response_format': response_format,
|
||||
'thinking': thinking,
|
||||
'watermark_enabled': watermark_enabled,
|
||||
'tool_stream': tool_stream,
|
||||
}
|
||||
)
|
||||
return self._post(
|
||||
|
|
|
|||
Loading…
Reference in a new issue