interactive-chat / engine /tools /state /update_trust.py
Junhoee's picture
Upload 98 files
f646e0b verified
Raw
History Blame Contribute Delete
1.07 kB
"""update_trust โ€” ์‹ ๋ขฐ์ถ• ์ด๋™ (1ํŒŒ์ผ = 1ํ•จ์ˆ˜, FunctionTool).
session.state์˜ ์ˆจ์€ ๊ฐ’๋งŒ ์›€์ง์ธ๋‹ค. ์˜์† ์ปค๋ฐ‹์€ ํฌ์ผ“ ์ข…๋ฃŒ ์‹œ
services/pocket.py โ†’ services/state.py ๊ฒฝ๋กœ๊ฐ€ ๋‹ด๋‹น (์ด์ค‘ ๊ฐฑ์‹  ๊ธˆ์ง€).
"""
from google.adk.tools import ToolContext
from engine.services.state import AXIS_DELTA
def update_trust(direction: str, tool_context: ToolContext) -> dict:
"""์œ ์ € ๋ฐœํ™” ํƒœ๋„ ํŒ์ •์— ๋”ฐ๋ผ ์‹ ๋ขฐ์ถ•์„ ๋ฏผ๋‹ค.
Args:
direction: "trust" | "doubt" | "neutral"
"""
if direction == "trust":
tool_context.state["hidden_trust"] = tool_context.state.get("hidden_trust", 0) + AXIS_DELTA
elif direction == "doubt":
tool_context.state["hidden_doubt"] = tool_context.state.get("hidden_doubt", 0) + AXIS_DELTA
elif direction != "neutral":
return {"status": "error", "message": f"unknown direction: {direction}"}
turns = tool_context.state.get("pocket_axis_calls", 0) + 1
tool_context.state["pocket_axis_calls"] = turns
return {"status": "ok", "direction": direction}