diff --git a/README.md b/README.md index df64fcd..1b52c67 100644 --- a/README.md +++ b/README.md @@ -41,16 +41,14 @@ - **Web Search**: Integrated web search capabilities - **File Management**: Upload, download, and manage files - **Batch Operations**: Efficient batch processing for multiple requests -- **Knowledge Base**: Knowledge management and retrieval - **Content Moderation**: Built-in content safety and moderation - **Image Generation**: AI-powered image creation -- **Fine-tuning**: Custom model training capabilities ## 📦 Installation ### Requirements -- **Python**: 3.9+ +- **Python**: 3.8+ - **Package Manager**: pip ### Install via pip diff --git a/README_CN.md b/README_CN.md index e0f3e5f..25a0937 100644 --- a/README_CN.md +++ b/README_CN.md @@ -41,10 +41,8 @@ - **网络搜索**: 集成的网络搜索功能 - **文件管理**: 上传、下载和管理文件 - **批量操作**: 多请求的高效批量处理 -- **知识库**: 知识管理和检索 - **内容审核**: 内置内容安全和审核 - **图像生成**: AI 驱动的图像创建 -- **模型微调**: 自定义模型训练功能 ## 📦 安装 diff --git a/tests/integration_tests/test_thinking.py b/tests/integration_tests/test_thinking.py new file mode 100644 index 0000000..ee00148 --- /dev/null +++ b/tests/integration_tests/test_thinking.py @@ -0,0 +1,59 @@ +import logging +import logging.config +import time + +import zai +from zai import ZaiClient + +def test_chat_completion_with_thinking(logging_conf): + logging.config.dictConfig(logging_conf) # type: ignore + client = ZaiClient() # Fill in your own API Key + try: + # Generate request_id + request_id = time.time() + print(f'request_id:{request_id}') + response = client.chat.completions.create( + request_id=request_id, + model='glm-4.5', + messages=[ + {'role': 'user', 'content': '请介绍一下Agent的原理,并给出详细的推理过程'} + ], + top_p=0.7, + temperature=0.9, + ) + print(response) + + except zai.core._errors.APIRequestFailedError as err: + print(err) + except zai.core._errors.APIInternalError as err: + print(err) + except zai.core._errors.APIStatusError as err: + print(err) + +def test_chat_completion_without_thinking(logging_conf): + logging.config.dictConfig(logging_conf) # type: ignore + client = ZaiClient() # Fill in your own API Key + try: + # Generate request_id + request_id = time.time() + print(f'request_id:{request_id}') + response = client.chat.completions.create( + request_id=request_id, + model='glm-4.5', + messages=[ + {'role': 'user', 'content': '请介绍一下Agent的原理'} + ], + top_p=0.7, + temperature=0.9, + thinking={ + "type": "disabled", + } + ) + print(response) + + except zai.core._errors.APIRequestFailedError as err: + print(err) + except zai.core._errors.APIInternalError as err: + print(err) + except zai.core._errors.APIStatusError as err: + print(err) \ No newline at end of file