GooglePlacesAPIWrapper#

class langchain_community.utilities.google_places_api.GooglePlacesAPIWrapper[source]#

Bases: BaseModel

Deprecated since version 0.0.33: Use langchain_google_community.GooglePlacesAPIWrapper instead.

Wrapper around Google Places API.

To use, you should have the googlemaps python package installed,

an API key for the google maps platform, and the environment variable β€˜β€™GPLACES_API_KEY’’ set with your API key , or pass β€˜gplaces_api_key’ as a named parameter to the constructor.

By default, this will return the all the results on the input query.

You can use the top_k_results argument to limit the number of results.

Example

from langchain_community.utilities import GooglePlacesAPIWrapper
gplaceapi = GooglePlacesAPIWrapper()

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param gplaces_api_key: str | None = None#
param top_k_results: int | None = None#
fetch_place_details(place_id: str) β†’ str | None[source]#
Parameters:

place_id (str) –

Return type:

str | None

format_place_details(place_details: Dict[str, Any]) β†’ str | None[source]#
Parameters:

place_details (Dict[str, Any]) –

Return type:

str | None

run(query: str) β†’ str[source]#

Run Places search and get k number of places that exists that match.

Parameters:

query (str) –

Return type:

str