mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
works a lot better with 4o!
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
def find_events(args: dict) -> dict:
|
||||
# Example: continent="Oceania", month="April"
|
||||
continent = args.get("continent")
|
||||
region = args.get("region")
|
||||
month = args.get("month")
|
||||
print(f"[FindEvents] Searching events in {continent} for {month} ...")
|
||||
print(f"[FindEvents] Searching events in {region} for {month} ...")
|
||||
|
||||
# Stub result
|
||||
return {
|
||||
"eventsFound": [
|
||||
"events": [
|
||||
{
|
||||
"city": "Melbourne",
|
||||
"eventName": "Melbourne International Comedy Festival",
|
||||
"dates": "2025-03-26 to 2025-04-20",
|
||||
"dateFrom": "2025-03-26",
|
||||
"dateTo": "2025-04-20",
|
||||
},
|
||||
],
|
||||
"status": "found-events",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,21 +4,20 @@ def search_flights(args: dict) -> dict:
|
||||
Currently just prints/returns the passed args,
|
||||
but you can add real flight search logic later.
|
||||
"""
|
||||
date_depart = args.get("dateDepart")
|
||||
date_return = args.get("dateReturn")
|
||||
# date_depart = args.get("dateDepart")
|
||||
# date_return = args.get("dateReturn")
|
||||
origin = args.get("origin")
|
||||
destination = args.get("destination")
|
||||
|
||||
print(f"Searching flights from {origin} to {destination}")
|
||||
print(f"Depart: {date_depart}, Return: {date_return}")
|
||||
|
||||
# Return a mock result so you can verify it
|
||||
return {
|
||||
"tool": "SearchFlights",
|
||||
"searchResults": [
|
||||
"QF123: $1200",
|
||||
"VA456: $1000",
|
||||
flight_search_results = {
|
||||
"origin": f"{origin}",
|
||||
"destination": f"{destination}",
|
||||
"currency": "USD",
|
||||
"results": [
|
||||
{"flight_number": "CX101", "return_flight_number": "CX102", "price": 850.0},
|
||||
{"flight_number": "QF30", "return_flight_number": "QF29", "price": 920.0},
|
||||
{"flight_number": "MH129", "return_flight_number": "MH128", "price": 780.0},
|
||||
],
|
||||
"status": "search-complete",
|
||||
"args": args,
|
||||
}
|
||||
|
||||
return flight_search_results
|
||||
|
||||
@@ -2,12 +2,12 @@ from models.tool_definitions import ToolDefinition, ToolArgument
|
||||
|
||||
find_events_tool = ToolDefinition(
|
||||
name="FindEvents",
|
||||
description="Find upcoming events given a location or region (e.g., 'Oceania') and a date or month",
|
||||
description="Find upcoming events to travel to given a location or region (e.g., 'Oceania') and a date or month",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="continent",
|
||||
name="region",
|
||||
type="string",
|
||||
description="Which continent or region to search for events",
|
||||
description="Which region to search for events",
|
||||
),
|
||||
ToolArgument(
|
||||
name="month",
|
||||
@@ -20,7 +20,7 @@ find_events_tool = ToolDefinition(
|
||||
# 2) Define the SearchFlights tool
|
||||
search_flights_tool = ToolDefinition(
|
||||
name="SearchFlights",
|
||||
description="Search for return flights from an origin to a destination within a date range (dateDepart, dateReturn)",
|
||||
description="Search for return flights from an origin to a destination within a date range (dateDepart, dateReturn).",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="origin",
|
||||
@@ -48,7 +48,7 @@ search_flights_tool = ToolDefinition(
|
||||
# 3) Define the CreateInvoice tool
|
||||
create_invoice_tool = ToolDefinition(
|
||||
name="CreateInvoice",
|
||||
description="Generate an invoice with flight information.",
|
||||
description="Generate an invoice for the items described for the amount provided",
|
||||
arguments=[
|
||||
ToolArgument(
|
||||
name="amount",
|
||||
@@ -58,9 +58,7 @@ create_invoice_tool = ToolDefinition(
|
||||
ToolArgument(
|
||||
name="flightDetails",
|
||||
type="string",
|
||||
description="A summary of the flights, e.g., flight number and airport codes",
|
||||
description="A description of the item details to be invoiced",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
all_tools = [find_events_tool, search_flights_tool, create_invoice_tool]
|
||||
|
||||
Reference in New Issue
Block a user