mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-16 22:48:09 +01:00
LLM planner, not perfect but ok
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user