diff --git a/python/02-use-cases/ad_video_gen_seq/README.md b/python/02-use-cases/ad_video_gen_seq/README.md
index 156fb45a..9e93e768 100644
--- a/python/02-use-cases/ad_video_gen_seq/README.md
+++ b/python/02-use-cases/ad_video_gen_seq/README.md
@@ -48,7 +48,7 @@
开始前,请确保您的开发环境满足以下要求:
- Python 3.12 或更高版本
-- veadk-python 0.5.5(见 `pyproject.toml`)
+- veadk-python 0.5.22(见 `pyproject.toml`)
- 推荐使用 `uv` 进行依赖管理
- 本地需要可用的 `ffmpeg`(用于 `moviepy` 合成视频)
- 获取火山方舟 API KEY
@@ -173,6 +173,7 @@ agentkit launch
## 示例提示词
以下是一些常用的提示词示例:
+
- `请生成一条巧克力的圣诞节营销视频。商品名:圣诞限定黑巧克力礼盒装。适用场景和人群:适合所有巧克力爱好者,特别是追求圣诞节极致口感、甜蜜分享与能量补充的消费者;适用于圣诞下午茶时光、节日亲友聚会、温馨赠礼或任何需要增添节日氛围的愉悦时刻。主要成分:精选可可豆、纯可可脂、优质牛奶、天然香草,无添加人工色素和防腐剂,富含抗氧化剂。口味/特点:入口即化,丝滑醇厚,浓郁可可香,微苦回甘中带有节日限定的暖心回味 http://lf3-static.bytednsdoc.com/obj/eden-cn/lm_sth/ljhwZthlaukjlkulzlp/ark/assistant/images/ad_chocolate.png`
- `请生成一条面包营销视频。商品名:奶香松软拉丝吐司;适用场景和人群:场景:早餐配餐、下午茶点、日常代餐,人群:上班族、学生党、家庭群体(偏好松软口感的面包爱好者);主要成分:高筋面粉、牛奶、鸡蛋、黄油、酵母、白砂糖;口味 / 特点:口味:浓郁奶香,搭配黄油 + 蜂蜜后口感香甜柔润,特点:面包质地松软、切面蜂窝气孔均匀,烤后表皮带焦脆斑点,兼具松软内里与香脆外皮的双重口感 http://lf3-static.bytednsdoc.com/obj/eden-cn/lm_sth/ljhwZthlaukjlkulzlp/ark/assistant/images/ad_bread.jpeg`
- `生成一条侘寂风香薰蜡烛的商品图电商营销视频。商品名:侘寂风香薰蜡烛;适用场景和人群:场景:居家客厅装饰、卧室助眠、书房放松、极简风空间氛围营造,人群:喜欢极简 / 侘寂美学的家居爱好者、追求松弛感的都市白领、香薰收藏者;主要成分:天然大豆蜡、植物精油、水泥罐身、纸质标识贴;气味 / 特点:气味:可选木质调(雪松 / 檀香)、草本调(鼠尾草 / 尤加利)等中性舒缓香型,特点:水泥罐身带原生肌理质感,搭配黑白极简花纹标识,烛火柔和不刺眼;罐身可重复利用,整体风格低调质朴,契合侘寂美学的调性 http://lf3-static.bytednsdoc.com/obj/eden-cn/lm_sth/ljhwZthlaukjlkulzlp/ark/assistant/images/ad_candle.jpeg`
diff --git a/python/02-use-cases/ad_video_gen_seq/README_en.md b/python/02-use-cases/ad_video_gen_seq/README_en.md
index ccf6c10c..165d871a 100644
--- a/python/02-use-cases/ad_video_gen_seq/README_en.md
+++ b/python/02-use-cases/ad_video_gen_seq/README_en.md
@@ -48,7 +48,7 @@ The system exposes one Root Agent and orchestrates the following sub-agents in s
Before starting, make sure your environment meets these requirements:
- Python 3.12 or later
-- veadk-python 0.5.5 (see `pyproject.toml`)
+- veadk-python 0.5.22 (see `pyproject.toml`)
- `uv` is recommended for dependency management
- `ffmpeg` available locally (used by `moviepy` for video composition)
- Get Volcengine Ark API KEY
@@ -197,4 +197,3 @@ FAQ list to be added.
## License
This project is open-sourced. See the LICENSE file in the repository root for details.
-
diff --git a/python/02-use-cases/ad_video_gen_seq/app/image/tools/image_generate_gather.py b/python/02-use-cases/ad_video_gen_seq/app/image/tools/image_generate_gather.py
index c674f43d..a01cdfce 100644
--- a/python/02-use-cases/ad_video_gen_seq/app/image/tools/image_generate_gather.py
+++ b/python/02-use-cases/ad_video_gen_seq/app/image/tools/image_generate_gather.py
@@ -20,11 +20,19 @@
image_generate as image_generate_builtin,
)
from veadk.utils.logger import get_logger
+from veadk.config import getenv
+from veadk.consts import DEFAULT_IMAGE_GENERATE_MODEL_NAME
+
logger = get_logger(__name__)
-async def image_generate(tasks: list[dict], tool_context: ToolContext) -> Dict:
+async def image_generate(
+ tasks: list[dict],
+ tool_context: ToolContext,
+ timeout: int = 600,
+ model_name: str = getenv("MODEL_IMAGE_NAME", DEFAULT_IMAGE_GENERATE_MODEL_NAME),
+) -> Dict:
"""Generate images with Seedream 4.5.
Commit batch image generation requests via tasks.
@@ -32,6 +40,15 @@ async def image_generate(tasks: list[dict], tool_context: ToolContext) -> Dict:
Args:
tasks (list[dict]):
A list of image-generation tasks. Each task is a dict.
+ timeout (int)
+ The timeout limit for the image generation task request, in seconds, with a default value of 600 seconds.
+ model_name (str):
+ Optional model name. If not specified, use the default model from environment.
+ If during execution, this tool encounters a model-related error (note that it must be a model-related error, otherwise do not perform this action), such as `ModelNotOpen`,
+ then after reminding about the relevant issue, you can execute this tool again and downgrade the model to the following models, passing this parameter:
+ - `doubao-seedream-5-0-260128`
+ - `doubao-seedream-4-5-251128`
+ - `doubao-seedream-4-0-250828`
Per-task schema
---------------
Required:
@@ -89,7 +106,7 @@ async def image_generate(tasks: list[dict], tool_context: ToolContext) -> Dict:
- 组图任务必须 sequential_image_generation="auto"。
- size 推荐使用 2048x2048 或表格里的标准比例,确保生成质量。
"""
- logger.debug(f"image_generate_gather tasks: {tasks}")
+ logger.error(f"image_generate_gather tasks: {tasks}")
new_tasks = []
task_origin_info = [] # Stores (original_task_index, sub_index_within_group)
@@ -146,7 +163,9 @@ async def image_generate(tasks: list[dict], tool_context: ToolContext) -> Dict:
# Call the underlying image_generate function with the flattened list of tasks
logger.debug(f"image_generate_gather new_tasks: {new_tasks}")
- raw_result = await image_generate_builtin(new_tasks, tool_context)
+ raw_result = await image_generate_builtin(
+ new_tasks, tool_context, timeout, model_name
+ )
logger.debug(f"image_generate_gather raw_result: {raw_result}")
# Remap the results to match the original task structure
@@ -166,6 +185,10 @@ async def image_generate(tasks: list[dict], tool_context: ToolContext) -> Dict:
original_idx, original_sub_idx = task_origin_info[new_task_idx]
new_key = f"task_{original_idx}_image_{original_sub_idx}"
+ logger.error(
+ f"image_generate_gather new_task_idx: {new_task_idx}, original_idx: {original_idx}, original_sub_idx: {original_sub_idx}"
+ )
+ logger.error(f"image_generate_gather new_key: {new_key}, url: {url}")
remapped_success.append({new_key: url})
for error_item in raw_result.get("error_list", []):
diff --git a/python/02-use-cases/ad_video_gen_seq/app/video/tools/video_generate_by_code.py b/python/02-use-cases/ad_video_gen_seq/app/video/tools/video_generate_by_code.py
index 337660d9..a8147c77 100644
--- a/python/02-use-cases/ad_video_gen_seq/app/video/tools/video_generate_by_code.py
+++ b/python/02-use-cases/ad_video_gen_seq/app/video/tools/video_generate_by_code.py
@@ -18,6 +18,8 @@
from veadk.tools.builtin_tools.video_generate import (
video_generate as video_generate_builtin,
)
+from veadk.config import getenv
+from veadk.consts import DEFAULT_VIDEO_MODEL_NAME
async def video_generate(
@@ -25,6 +27,7 @@ async def video_generate(
tool_context: ToolContext,
batch_size: int = 10,
max_wait_seconds: int = 1200,
+ model_name: str = getenv("MODEL_VIDEO_NAME", DEFAULT_VIDEO_MODEL_NAME),
) -> Dict:
"""
Generate videos in **batch** from text prompts, optionally guided by a first/last frame,
@@ -82,6 +85,13 @@ async def video_generate(
- Size: < 30 MB
- Base64 data URL example: `data:image/png;base64,`
+ Optional model_name(str):
+ If the user does not specify, do not pass this parameter and use the default value.
+ If during execution, this tool encounters a model-related error (note that it must be a model-related error, otherwise do not perform this action), such as `ModelNotOpen`,
+ then after reminding about the relevant issue, you can execute this tool again and downgrade the model to the following models, passing this parameter:
+ `doubao-seedance-1-5-pro-251215`
+ `doubao-seedance-1-0-pro-250528`
+
Model text commands (append after the prompt; unsupported keys are ignored by some models):
--rs / --resolution Video resolution. Common values: 480p, 720p, 1080p.
Default depends on model (e.g., doubao-seedance-1-0-pro: 1080p,
@@ -148,5 +158,5 @@ async def video_generate(
f"(可以有极其轻度的动作音,但禁止任何人声,禁止背景音乐,禁止音效,禁止旁白,禁止解说){item['prompt']}"
)
return await video_generate_builtin(
- params, tool_context, batch_size, max_wait_seconds
+ params, tool_context, batch_size, max_wait_seconds, model_name
)
diff --git a/python/02-use-cases/ad_video_gen_seq/pyproject.toml b/python/02-use-cases/ad_video_gen_seq/pyproject.toml
index b50291d5..40ced70d 100644
--- a/python/02-use-cases/ad_video_gen_seq/pyproject.toml
+++ b/python/02-use-cases/ad_video_gen_seq/pyproject.toml
@@ -5,7 +5,7 @@ description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
- "veadk-python==0.5.5",
+ "veadk-python==0.5.22",
"uvicorn>=0.38.0",
"moviepy>=2.2.1",
"requests>=2.32.5",
diff --git a/python/02-use-cases/ad_video_gen_seq/requirements.txt b/python/02-use-cases/ad_video_gen_seq/requirements.txt
index 8647556e..73cf9f61 100644
--- a/python/02-use-cases/ad_video_gen_seq/requirements.txt
+++ b/python/02-use-cases/ad_video_gen_seq/requirements.txt
@@ -245,7 +245,7 @@ uritemplate==4.2.0
urllib3==2.6.2
uv==0.9.21
uvicorn==0.40.0
-veadk-python==0.5.5
+veadk-python==0.5.22
vikingdb-python-sdk==0.1.3
volcengine==1.0.212
volcengine-python-sdk==5.0.3