mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
dynamic activity to call tool
This commit is contained in:
@@ -5,7 +5,7 @@ import logging
|
||||
from temporalio.client import Client
|
||||
from temporalio.worker import Worker
|
||||
|
||||
from activities.tool_activities import ToolActivities
|
||||
from activities.tool_activities import ToolActivities, dynamic_tool_activity
|
||||
from workflows.tool_workflow import ToolWorkflow
|
||||
from workflows.parent_workflow import ParentWorkflow
|
||||
|
||||
@@ -21,7 +21,12 @@ async def main():
|
||||
client,
|
||||
task_queue="ollama-task-queue",
|
||||
workflows=[ToolWorkflow, ParentWorkflow],
|
||||
activities=[activities.prompt_llm, activities.parse_tool_data],
|
||||
activities=[
|
||||
activities.prompt_llm,
|
||||
activities.parse_tool_data,
|
||||
activities.validate_and_parse_json,
|
||||
dynamic_tool_activity,
|
||||
],
|
||||
activity_executor=activity_executor,
|
||||
)
|
||||
await worker.run()
|
||||
|
||||
@@ -12,7 +12,7 @@ async def main(prompt):
|
||||
# Construct your tool definitions in code
|
||||
search_flights_tool = ToolDefinition(
|
||||
name="SearchFlights",
|
||||
description="Search for return flights from an origin to a destination within a date range",
|
||||
description="Search for return flights from an origin to a destination within a date range (dateDepart, dateReturn)",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="origin",
|
||||
@@ -27,12 +27,12 @@ async def main(prompt):
|
||||
ToolArgument(
|
||||
name="dateDepart",
|
||||
type="ISO8601",
|
||||
description="Start of date range in human readable format",
|
||||
description="Start of date range in human readable format, when you want to depart",
|
||||
),
|
||||
ToolArgument(
|
||||
name="dateReturn",
|
||||
type="ISO8601",
|
||||
description="End of date range in human readable format",
|
||||
description="End of date range in human readable format, when you want to return",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user