tools functions

This commit is contained in:
Steve Androulakis
2025-01-01 15:30:39 -08:00
parent dbc9ea7688
commit 33af355363
3 changed files with 45 additions and 18 deletions

13
tools/__init__.py Normal file
View File

@@ -0,0 +1,13 @@
from .search_flights import search_flights
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 == "SearchFlights":
return search_flights
# Or raise if not recognized
raise ValueError(f"No handler found for tool '{tool_name}'")

24
tools/search_flights.py Normal file
View File

@@ -0,0 +1,24 @@
def search_flights(args: dict) -> dict:
"""
Example function for searching flights.
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")
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": [
"Mock flight 1",
"Mock flight 2",
],
"status": "search-complete",
"args": args,
}