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

@@ -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
View 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
View 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",
}