interactive-chat / engine /tools /state /mark_beat.py
Junhoee's picture
Upload 98 files
f646e0b verified
Raw
History Blame Contribute Delete
538 Bytes
"""mark_beat โ€” ๋ชฉํ‘œ ๋น„ํŠธ ๋‹ฌ์„ฑ ๊ธฐ๋ก (1ํŒŒ์ผ = 1ํ•จ์ˆ˜, FunctionTool)."""
from google.adk.tools import ToolContext
def mark_beat(beat: str, tool_context: ToolContext) -> dict:
"""์žฅ๋ฉด ๋ชฉํ‘œ ๋น„ํŠธ๊ฐ€ ๋‹ฌ์„ฑ๋˜์—ˆ์Œ์„ ๊ธฐ๋กํ•œ๋‹ค.
Args:
beat: ๋‹ฌ์„ฑ๋œ ๋น„ํŠธ์˜ ์งง์€ ์‹๋ณ„ ๋ฌธ๊ตฌ
"""
hits = list(tool_context.state.get("pocket_beats_hit", []))
if beat not in hits:
hits.append(beat)
tool_context.state["pocket_beats_hit"] = hits
return {"status": "ok", "beats_hit": hits}