Skip to content

Commit 987d4df

Browse files
Xiaoaier-Z-Lzhenguo.li
andauthored
feat: add web search tool-specific ak/sk (#391)
Co-authored-by: zhenguo.li <[email protected]>
1 parent ab9c133 commit 987d4df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

veadk/tools/builtin_tools/web_search.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ def web_search(query: str, tool_context: ToolContext | None = None) -> list[str]
3838
"""
3939
ak = None
4040
sk = None
41-
if tool_context:
41+
# First try to get tool-specific AK/SK
42+
ak = os.getenv("TOOL_WEB_SEARCH_ACCESS_KEY")
43+
sk = os.getenv("TOOL_WEB_SEARCH_SECRET_KEY")
44+
if ak and sk:
45+
logger.debug("Successfully get tool-specific AK/SK.")
46+
elif tool_context:
4247
ak = tool_context.state.get("VOLCENGINE_ACCESS_KEY")
4348
sk = tool_context.state.get("VOLCENGINE_SECRET_KEY")
4449
session_token = ""

0 commit comments

Comments
 (0)