LLM planner, not perfect but ok

This commit is contained in:
Steve Androulakis
2025-01-01 16:57:08 -08:00
parent 33af355363
commit 245d64fca9
8 changed files with 275 additions and 123 deletions

View File

@@ -102,16 +102,16 @@ def get_current_date_human_readable():
@activity.defn(dynamic=True)
def dynamic_tool_activity(args: Sequence[RawValue]) -> dict:
"""Invoked for an unknown activity type, delegates to the correct tool."""
from tools import get_handler # import the registry function
from tools import get_handler
tool_name = activity.info().activity_type # e.g. "SearchFlights"
tool_name = activity.info().activity_type # e.g. "FindEvents"
tool_args = activity.payload_converter().from_payload(args[0].payload, dict)
activity.logger.info(f"Running dynamic tool '{tool_name}' with args: {tool_args}")
activity.logger.info(f"Dynamic activity triggered for tool: {tool_name}")
handler_func = get_handler(tool_name)
# Delegate to the tool's function
result = handler_func(tool_args)
# Delegate to the relevant function
handler = get_handler(tool_name)
result = handler(tool_args)
# Optionally log or augment the result
activity.logger.info(f"Tool '{tool_name}' result: {result}")
return result