Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the
Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to
Reports should be directed to *Weijun Zheng ([email protected])*, the
Project Steward(s) for *zhipuai-sdk-python-v4*. It is the Project Steward’s duty to
receive and address reported violations of the code of conduct. They will then
work with a committee consisting of representatives from the Open Source
Programs Office and the Z.ai Open Source Strategy team.
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ from zhipuai import ZhipuAI

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

client = ZhipuAI(api_key="your-api-key")
response = client.videos.generations(
model="cogvideo",
model="cogvideox-2",
prompt="A beautiful sunset beach scene",
quality="quality", # Output mode: use "quality" for higher quality, "speed" for faster generation
with_audio=True, # Generate video with background audio
size="1920x1080", # Video resolution (up to 4K, e.g. "3840x2160")
fps=30, # Frames per second (choose 30 fps or 60 fps)
user_id="user_12345"
)
print(response)

# Generation may take some time
result = client.videos.retrieve_videos_result(id=response.id)
print(result)
```

## 🚨 Error Handling
Expand Down
18 changes: 12 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ from zhipuai import ZhipuAI
client = ZhipuAI() # 请填写您自己的APIKey

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

client = ZhipuAI() # 请填写您自己的APIKey

client = ZhipuAI(api_key="your-api-key")
response = client.videos.generations(
model="cogvideo",
prompt="一个美丽的日落海滩场景",
model="cogvideox-2",
prompt="一个美丽的日落海滩场景", # 生成内容的提示词
quality="quality", # 输出模式:'quality' 表示质量优先,'speed' 表示速度优先
with_audio=True, # 生成带背景音频的视频
size="1920x1080", # 视频分辨率(最高支持 4K,例如 "3840x2160")
fps=30, # 帧率(可选 30 或 60)
user_id="user_12345"
)
print(response)

# 生成过程可能需要一些时间
result = client.videos.retrieve_videos_result(id=response.id)
print(result)
```

## 🚨 异常处理
Expand Down