mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 22:18:09 +01:00
LLM planner, not perfect but ok
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
from .find_events import find_events
|
||||
from .search_flights import search_flights
|
||||
from .create_invoice import create_invoice
|
||||
|
||||
|
||||
def get_handler(tool_name: str):
|
||||
"""
|
||||
Return a function reference for the given tool.
|
||||
You can add more tools here, e.g. "BookHotel", etc.
|
||||
"""
|
||||
if tool_name == "FindEvents":
|
||||
return find_events
|
||||
if tool_name == "SearchFlights":
|
||||
return search_flights
|
||||
if tool_name == "CreateInvoice":
|
||||
return create_invoice
|
||||
|
||||
# Or raise if not recognized
|
||||
raise ValueError(f"No handler found for tool '{tool_name}'")
|
||||
raise ValueError(f"Unknown tool: {tool_name}")
|
||||
|
||||
7
tools/create_invoice.py
Normal file
7
tools/create_invoice.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def create_invoice(args: dict) -> dict:
|
||||
# e.g. amount, flight details, etc.
|
||||
print("[CreateInvoice] Creating invoice with:", args)
|
||||
return {
|
||||
"invoiceStatus": "generated",
|
||||
"invoiceURL": "https://pay.example.com/invoice/12345",
|
||||
}
|
||||
17
tools/find_events.py
Normal file
17
tools/find_events.py
Normal file
@@ -0,0 +1,17 @@
|
||||
def find_events(args: dict) -> dict:
|
||||
# Example: continent="Oceania", month="April"
|
||||
continent = args.get("continent")
|
||||
month = args.get("month")
|
||||
print(f"[FindEvents] Searching events in {continent} for {month} ...")
|
||||
|
||||
# Stub result
|
||||
return {
|
||||
"eventsFound": [
|
||||
{
|
||||
"city": "Melbourne",
|
||||
"eventName": "Melbourne International Comedy Festival",
|
||||
"dates": "2025-03-26 to 2025-04-20",
|
||||
},
|
||||
],
|
||||
"status": "found-events",
|
||||
}
|
||||
Reference in New Issue
Block a user