Skip to content

Commit b20509d

Browse files
authored
chore: update documentation for clarity and consistency (#79)
1 parent 8254c5b commit b20509d

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

CODE_OF_CONDUCT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ dispute. If you are unable to resolve the matter for any reason, or if the
6969
behavior is threatening or harassing, report it. We are dedicated to providing
7070
an environment where participants feel welcome and safe.
7171

72-
Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the
73-
Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to
72+
Reports should be directed to *Weijun Zheng ([email protected])*, the
73+
Project Steward(s) for *zhipuai-sdk-python-v4*. It is the Project Steward’s duty to
7474
receive and address reported violations of the code of conduct. They will then
7575
work with a committee consisting of representatives from the Open Source
7676
Programs Office and the Z.ai Open Source Strategy team.

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ from zhipuai import ZhipuAI
211211

212212
client = ZhipuAI(api_key="your-api-key")
213213
response = client.assistant.conversation(
214-
assistant_id="your_assistant_id",
214+
assistant_id="your_assistant_id", # You can use 65940acff94777010aa6b796 for testing
215215
model="glm-4-assistant",
216216
messages=[
217217
{
@@ -240,11 +240,18 @@ from zhipuai import ZhipuAI
240240

241241
client = ZhipuAI(api_key="your-api-key")
242242
response = client.videos.generations(
243-
model="cogvideo",
243+
model="cogvideox-2",
244244
prompt="A beautiful sunset beach scene",
245+
quality="quality", # Output mode: use "quality" for higher quality, "speed" for faster generation
246+
with_audio=True, # Generate video with background audio
247+
size="1920x1080", # Video resolution (up to 4K, e.g. "3840x2160")
248+
fps=30, # Frames per second (choose 30 fps or 60 fps)
245249
user_id="user_12345"
246250
)
247-
print(response)
251+
252+
# Generation may take some time
253+
result = client.videos.retrieve_videos_result(id=response.id)
254+
print(result)
248255
```
249256

250257
## 🚨 Error Handling

README_CN.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ from zhipuai import ZhipuAI
205205
client = ZhipuAI() # 请填写您自己的APIKey
206206

207207
response = client.assistant.conversation(
208-
assistant_id="your_assistant_id", # 智能体ID
208+
assistant_id="your_assistant_id", # 智能体ID,可用 65940acff94777010aa6b796 进行测试
209209
model="glm-4-assistant",
210210
messages=[
211211
{
@@ -232,14 +232,20 @@ for chunk in response:
232232
```python
233233
from zhipuai import ZhipuAI
234234

235-
client = ZhipuAI() # 请填写您自己的APIKey
236-
235+
client = ZhipuAI(api_key="your-api-key")
237236
response = client.videos.generations(
238-
model="cogvideo",
239-
prompt="一个美丽的日落海滩场景",
237+
model="cogvideox-2",
238+
prompt="一个美丽的日落海滩场景", # 生成内容的提示词
239+
quality="quality", # 输出模式:'quality' 表示质量优先,'speed' 表示速度优先
240+
with_audio=True, # 生成带背景音频的视频
241+
size="1920x1080", # 视频分辨率(最高支持 4K,例如 "3840x2160")
242+
fps=30, # 帧率(可选 30 或 60)
240243
user_id="user_12345"
241244
)
242-
print(response)
245+
246+
# 生成过程可能需要一些时间
247+
result = client.videos.retrieve_videos_result(id=response.id)
248+
print(result)
243249
```
244250

245251
## 🚨 异常处理

0 commit comments

Comments
 (0)