diff --git a/pyproject.toml b/pyproject.toml index 1bfc308..cfdac2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/zai/_version.py b/src/zai/_version.py index 7e67b3e..6f1fe34 100644 --- a/src/zai/_version.py +++ b/src/zai/_version.py @@ -1,2 +1,2 @@ __title__ = 'Z.ai' -__version__ = '0.0.3.7' +__version__ = '0.0.4' diff --git a/src/zai/api_resource/chat/async_completions.py b/src/zai/api_resource/chat/async_completions.py index 6d0c6a7..d4dc00e 100644 --- a/src/zai/api_resource/chat/async_completions.py +++ b/src/zai/api_resource/chat/async_completions.py @@ -88,25 +88,6 @@ def create( 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'): diff --git a/src/zai/api_resource/chat/completions.py b/src/zai/api_resource/chat/completions.py index 95d9ad8..7c8f6c6 100644 --- a/src/zai/api_resource/chat/completions.py +++ b/src/zai/api_resource/chat/completions.py @@ -66,6 +66,7 @@ def create( 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 @@ def create( 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 @@ def create( 'response_format': response_format, 'thinking': thinking, 'watermark_enabled': watermark_enabled, + 'tool_stream': tool_stream, } ) return self._post(