diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b01039c..e89e6ca 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -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 (weijun.zheng@aminer.cn)*, 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. diff --git a/README.md b/README.md index afb7b4d..3755466 100644 --- a/README.md +++ b/README.md @@ -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=[ { @@ -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 diff --git a/README_CN.md b/README_CN.md index bc73ec2..0e569c5 100644 --- a/README_CN.md +++ b/README_CN.md @@ -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=[ { @@ -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) ``` ## 🚨 异常处理