tyrasd / overpass-turbo

A web based data mining tool for OpenStreetMap using the Overpass API.
https://overpass-turbo.eu
Other
920 stars 130 forks source link

Some testing with OpenAI and Overpass Turbo assistant #610

Open PanierAvide opened 1 year ago

PanierAvide commented 1 year ago

Hello,

I open this ticket to present and discuss a prototype of Overpass Turbo assistant being replaced by OpenAI code completion API. This started following a morning discussion with @overflorian about ChatGPT and OSM possible use cases.

The idea was to use OpenAI automatically generated code to transform Overpass Turbo assistant user input into an Overpass API request, in the hope of getting the right request and OSM tags according to free text input.

An online demo is made available here : https://overpass-ai.com

And code changes are here (not for a PR as it was made quick & dirty) : https://github.com/PanierAvide/overpass-turbo/tree/feature/openai

This is intended to be a demo and a start about the opportunity of using such AI to improve Overpass turbo assistant. There are technical limitations in the current version (particularly when user search for advanced queries). We may open discussions with OpenAI team to see if they would be willing to improve Overpass API requests results.

Best regards.

drolbr commented 1 year ago

To give you some feedback: it did not work for me.

First attempt has been: apotheke in wuppertal. This did never return from the progress bar.

Second attempt has been: pharmacy in Galway. Just in case that it has been a translation error. This did result in a red box with the (German) suggestion: did you mean Vorfeld in Galway? The word Vorfeld is unrelated to pharmacies in Germany.

Third attempt has been: apotheke in Galway if the translation error would be the other way round, i.e. the input rejecting English on the base that it has found a German locale somewhere. This resulted in a triple wrong query

[out:json];
node["amenity"="pharmacy"]["name"~"apotheke"]["is_in:city"="Galway"];
out center;

The query should be for nwr instead of node because pharmacies like all POIs can be any of the three base elements. Second, the conditional ["name"~"apotheke"] is harmful here as few to no pharmacies in Ireland would have a German name. Finally, the area search should be by (area) for a meaningful selection, the is_in:city tag is not used at all.

For the moment being, it would be so far from a usable solution that I would like to make an entirely different suggestion: why not send people by AI instead to probably relevant examples. There are quite a number of documentation resources and examples, and they are dispersed. So people that type a Something in Somewhere structure would benefit to be send to this page and a documentation of the Nominatim syntax to select an area.

PanierAvide commented 1 year ago

Thanks for your feedback. Tests done by @overflorian led to same issues that you're mentioning. So we can agree on the fact that this kind of IA doesn't work yet for this purpose, proven by this prototype :grin:

As I'm not sure this is the good issue to discuss about making current assistant more robust against all kind of user inputs, maybe we can close this one ?

JLZIMMERMANN commented 1 year ago

Maybe get some ideas using OSM-GPT https://osm-gpt.rohitgautam.com.np/ It can be used in different langages.