Skip to content

Commit b363c7f

Browse files
authored
Merge branch 'main' into feat/workshop
2 parents 768d409 + ac4521f commit b363c7f

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

02-use-cases/beginner/callback/callbacks/after_tool_callback.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ def replace_and_log(match):
7676
return f"[{pii_type}已隐藏]"
7777

7878
# 执行替换
79-
filtered_text = pattern.sub(replace_and_log, filtered_text)
79+
filtered_text = pattern.sub(
80+
replace_and_log, str(filtered_text) if filtered_text is not None else ""
81+
)
8082

8183
return filtered_text

02-use-cases/customer_support/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ async def after_agent_execution(callback_context: CallbackContext):
166166
after_sale_agent = Agent(
167167
name="after_sale_agent",
168168
model_name=model_name,
169-
description="售后Agent:根据客户的售后问题,帮助客户处理商品的售后问题(信息查询、商品报修等)",
169+
description=" 售后Agent:根据客户的售后问题,帮助客户处理商品的售后问题(信息查询、商品报修等)",
170170
instruction=after_sale_prompt,
171171
planner=BuiltInPlanner(
172172
thinking_config=ThinkingConfig(

02-use-cases/data_analysis_with_datalake/agent.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
from veadk import Agent, Runner # noqa: E402
1818
from veadk.auth.veauth.ark_veauth import get_ark_token # noqa: E402
1919
from veadk.memory.short_term_memory import ShortTermMemory # noqa: E402
20+
21+
# Check if MODEL_AGENT_API_KEY environment variable exists and is not empty
22+
if "MODEL_AGENT_API_KEY" not in os.environ or not os.environ["MODEL_AGENT_API_KEY"]:
23+
os.environ["MODEL_AGENT_API_KEY"] = get_ark_token()
24+
2025
from veadk.tools.builtin_tools.video_generate import video_generate # noqa: E402
2126
from agentkit.apps import AgentkitAgentServerApp # noqa: E402
2227

@@ -26,11 +31,6 @@
2631
from tools.lancedb_hybrid_execution import lancedb_hybrid_execution # noqa: E402
2732
from prompts import SYSTEM_PROMPT # noqa: E402
2833

29-
# Check if MODEL_AGENT_API_KEY environment variable exists and is not empty
30-
if "MODEL_AGENT_API_KEY" not in os.environ or not os.environ["MODEL_AGENT_API_KEY"]:
31-
os.environ["MODEL_AGENT_API_KEY"] = get_ark_token()
32-
# Optionally assign to a variable for easier use in the file
33-
MODEL_AGENT_API_KEY = os.environ["MODEL_AGENT_API_KEY"]
3434

3535
short_term_memory = ShortTermMemory(backend="local")
3636

@@ -55,7 +55,7 @@
5555
"MODEL_AGENT_NAME", "doubao-seed-1-6-251015"
5656
) # 默认使用更主流的豆包模型
5757
root_agent = Agent(
58-
description="基于LanceDB的数据检索Agent,支持结构化和向量查询。典型问题包括:1.你有哪些数据?2.给我一些样例数据?3.Ang Lee 评分超过7分的有哪些电影?4.Ang Lee 评分超过7分的电影中,有哪个电影海报中含有动物?5.Life of Pi 的电影海报,变成视频",
58+
description="基于LanceDB的数据检索Agent,支持结构化和向量查询。典型问题包括:1.你有哪些数据?2.给我一些样例数据?3.Ang Lee 评分超过7分的有哪些电影?4.Ang Lee 评分超过7分的电影中,有哪个电影海报中含有动物?5.Life of Pi 的电影海报,变成视频。 返回显示电影海报为![老虎](https://example.com/image1.png), 返回视频并显示成<video src='https://example.com/video1.mp4' width='640' controls>分镜视频1</video>",
5959
instruction=SYSTEM_PROMPT,
6060
model_name=model_name,
6161
tools=tools,

0 commit comments

Comments
 (0)