Documentation Index
Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
Use this file to discover all available pages before exploring further.
handle_googlemaps_exceptions
def handle_googlemaps_exceptions(func: Callable[..., Any]):
Decorator to catch and handle exceptions raised by Google Maps API
calls.
Parameters:
- func (Callable): The function to be wrapped by the decorator.
Returns:
Callable: A wrapper function that calls the wrapped function and
handles exceptions.
def _format_offset_to_natural_language(offset: int):
Converts a time offset in seconds to a more natural language
description using hours as the unit, with decimal places to represent
minutes and seconds.
Parameters:
- offset (int): The time offset in seconds. Can be positive, negative, or zero.
Returns:
str: A string representing the offset in hours, such as
“+2.50 hours” or “-3.75 hours”.
class GoogleMapsToolkit(BaseToolkit):
A class representing a toolkit for interacting with GoogleMaps API.
This class provides methods for validating addresses, retrieving elevation,
and fetching timezone information using the Google Maps API.
init
def __init__(self, timeout: Optional[float] = None):
get_address_description
def get_address_description(
self,
address: Union[str, List[str]],
region_code: Optional[str] = None,
locality: Optional[str] = None
):
Validates an address via Google Maps API, returns a descriptive
summary. Validates an address using Google Maps API, returning a
summary that includes information on address completion, formatted
address, location coordinates, and metadata types that are true for
the given address.
Parameters:
- address (Union[str, List[str]]): The address or components to validate. Can be a single string or a list representing different parts.
- region_code (str, optional): Country code for regional restriction, helps narrow down results. (default: :obj:
None)
- locality (str, optional): Restricts validation to a specific locality, e.g., “Mountain View”. (default: :obj:
None)
Returns:
str: Summary of the address validation results, including
information on address completion, formatted address,
geographical coordinates (latitude and longitude), and metadata
types true for the address.
get_elevation
def get_elevation(self, lat: float, lng: float):
Retrieves elevation data for a given latitude and longitude.
Uses the Google Maps API to fetch elevation data for the specified
latitude and longitude. It handles exceptions gracefully and returns a
description of the elevation, including its value in meters and the
data resolution.
Parameters:
- lat (float): The latitude of the location to query.
- lng (float): The longitude of the location to query.
Returns:
str: A description of the elevation at the specified location(s),
including the elevation in meters and the data resolution. If
elevation data is not available, a message indicating this is
returned.
get_timezone
def get_timezone(self, lat: float, lng: float):
Retrieves timezone information for a given latitude and longitude.
This function uses the Google Maps Timezone API to fetch timezone
data for the specified latitude and longitude. It returns a natural
language description of the timezone, including the timezone ID, name,
standard time offset, daylight saving time offset, and the total
offset from Coordinated Universal Time (UTC).
Parameters:
- lat (float): The latitude of the location to query.
- lng (float): The longitude of the location to query.
Returns:
str: A descriptive string of the timezone information,
including the timezone ID and name, standard time offset,
daylight saving time offset, and total offset from UTC.
Returns:
List[FunctionTool]: A list of FunctionTool objects
representing the functions in the toolkit.