https://medium.com/@gisjohnecs/geospatial-function-calling-with-chatgpt-7cd57cc4a341
Top highlight
·
11 min read
·
Feb 10, 2024
Most of the code in this example is based directly from this cookbook and has been adapted to work as a python terminal assistant executing basic geospatial functions for the sake of illustration.
Function calling with ChatGPT grants us the ability to write custom software and methods that we can have a large language model determine the appropriate function and the parameters needed based on natural language inputs by a user.
So take the basic idea for this tutorial — we want to build a geospatial chat bot with the capacity to repair a geodataframe geometry, and perform some simple geospatial algorithms (Buffer by a distance, and return the bounding box of the geodataframe). Now this is pretty simple but purely to demonstrate the concept of function calling — try to imagine calling a series of geospatial api’s that perform complex algorithms all by the flow of natural language!
Now the basic requirements here are that you have an OpenAI Developer key — HERE is a great article showing you how to get setup and I also have the full code to this project where you can clone and pip install -r requirements. txt
to get all the dependencies you’ll need.
You will need to update the geo_chat.py
file and replace the openai.api_key = “YOUR_API_KEY”
with your own OpenAI key