I Talk to the Treeeeessss… with a ChatGPT API Call

I Talk to the Treeeeessss… with a ChatGPT API Call

I’ve learned enough since last October that I can revisit my project of having Raleigh’s trees act as tour guides for surrounding areas. 

The city of Raleigh offers an open dataset of city trees. Not every last tree in the city, of course, mostly trees on city property. My old program searched the tree database, used Wikipedia to find sites of interest nearby, and then used a ChatGPT API call to have the tree “talk” and describe the nearby locations. If I give ChatGPT a specific set of data to summarize and specify in the prompt that it is to refer to no external data, I find it’s a lot less likely to hallucinate.

I added some additional data to the new version. The first thing I did was add a function that searched nearby streets for trees if the street you specified didn’t have any. This made finding trees outside major roadways a lot less frustrating. Once I did that I could attach more info.

A screenshot of a program-doodle I'm calling Raleigh Tree Chatter. The top of the screen shows a static image from Mapbox, with the tree denoted via a tree-shaped marker (instead of the usual teardop peg.)

Beneath that is information about where the tree is located, and beneath that is description of the surrounding area and the weather, written in the tree's "voice" via a ChatGPT call.

The new version integrates current weather conditions into the description, which gives it a more lively, realistic feeling. It also adds a map with a little tree marker so you can get a sense of where the tree lives.

Now that I’ve got the tree’s basic data hooked up, I’m going to add more options for tree conversation — getting information on nearby businesses, checking on construction permits, and even asking for local news! When it comes to passing along hyperlocal happenings, seems like a tree would be the perfect option…

Back To Top