API Reference
surf_spot_finder.cli
find_surf_spot(config_file=None)
async
Find the best surf spot based on the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_file
|
str | None
|
Path to a YAML config file. See Config |
None
|
Source code in src/surf_spot_finder/cli.py
surf_spot_finder.config.Config
Bases: BaseModel
Source code in src/surf_spot_finder/config.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
from_dict(data)
classmethod
Create a Config instance from a dictionary. Args: data (dict): A dictionary containing the configuration data.
Returns:
Name | Type | Description |
---|---|---|
Config |
Config
|
A new Config instance populated with values from the dictionary. |
Source code in src/surf_spot_finder/config.py
from_yaml(yaml_path)
classmethod
with open(yaml_path, "r") as f: data = yaml.safe_load(f) return cls(**data) yaml_path: Path to the YAML configuration file
Returns:
Name | Type | Description |
---|---|---|
Config |
Config
|
A new Config instance populated with values from the YAML file |
Source code in src/surf_spot_finder/config.py
surf_spot_finder.no_framework
find_surf_spot_no_framework(location, max_driving_hours, date, model_id)
Find the best surf spot based on the given location
and date
.
Uses the following tools:
- any_agent.tools.web_browsing
- surf_spot_finder.tools.openmeteo
- surf_spot_finder.tools.openstreetmap
To find nearby spots along with the forecast and recommended conditions for the spot.
Then, uses litellm
with the provided model_id
to score
each spot based on the available information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
str
|
The place of interest. |
required |
max_driving_hours
|
int
|
Used to limit the surf spots based on
the distance to |
required |
date
|
datetime
|
Used to filter the forecast results. |
required |
model_id
|
str
|
Can be any of the litellm providers. |
required |
Returns:
Type | Description |
---|---|
list[SpotScore]
|
A list of spot scores and reasons for the value. |
Source code in src/surf_spot_finder/no_framework.py
Tools
surf_spot_finder.tools.openmeteo
get_wave_forecast(lat, lon, date)
Get wave forecast for given location.
Forecast will include:
- wave_direction (degrees)
- wave_height (meters)
- wave_period (seconds)
- sea_level_height_msl (meters)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude of the location. |
required |
lon
|
float
|
Longitude of the location. |
required |
date
|
str
|
Date to filter by in any valid ISO 8601 format. |
required |
Returns:
Source code in src/surf_spot_finder/tools/openmeteo.py
get_wind_forecast(lat, lon, date)
Get wind forecast for given location.
Forecast will include:
- wind_direction (degrees)
- wind_speed (meters per second)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude of the location. |
required |
lon
|
float
|
Longitude of the location. |
required |
date
|
str
|
Date to filter by in any valid ISO 8601 format. |
required |
Returns:
Type | Description |
---|---|
list[dict]
|
Source code in src/surf_spot_finder/tools/openmeteo.py
surf_spot_finder.tools.openstreetmap
driving_hours_to_meters(driving_hours)
Convert driving hours to meters assuming a 70 km/h average speed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
driving_hours
|
int
|
The driving hours. |
required |
Returns:
Type | Description |
---|---|
int
|
The distance in meters. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_area_lat_lon(area_name)
Get the latitude and longitude of an area from Nominatim.
Uses the Nominatim API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area_name
|
str
|
The name of the area. |
required |
Returns:
Type | Description |
---|---|
tuple[float, float]
|
The area found. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_lat_lon_center(bounds)
Get the latitude and longitude of the center of a bounding box.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bounds
|
dict
|
required |
Returns:
Type | Description |
---|---|
tuple[float, float]
|
The latitude and longitude of the center. |
Source code in src/surf_spot_finder/tools/openstreetmap.py
get_surfing_spots(lat, lon, radius)
Get surfing spots around a given latitude and longitude.
Uses the Overpass API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
The latitude. |
required |
lon
|
float
|
The longitude. |
required |
radius
|
int
|
The radius in meters. |
required |
Returns:
Type | Description |
---|---|
list[tuple[str, tuple[float, float]]]
|
The surfing places found. |