(This blog post follows this article focusing on ZurichGPT and its Lausanne version)
Now, you can ask GenevaGPT any question about the Republic and Canton of Geneva, and you'll get a direct answer to your question, not just a collection of potentially relevant page links.
Most of the time, the bot returns useful answers, as long as the content on the site can cover the query. You're not confined to asking in French either - other languages work too, with the bot replying in the same language.
Wondering what sort of questions you can ask? Here are a few examples:
- How many people live in Geneva?
- Is the Eaux-Vives beach open all year long?
- When are the school holidays in 2024?
- How can I get a new passport?
- How high is the Geneva jet d'eau?
- How can i recycle my tires?
- What does Geneva do to fight climate change?
- When did Rousseau live in Geneva?
- How does Geneva act to promote cycling and soft mobility?
- What does Geneva do to be more welcoming to pedestrians?
- Does Geneva produce renewable energies?
- Is there a bike-sharing service?
And, of course, there are many more questions you can pose.
The bot isn't infallible, so we strongly advise verifying your answers with the provided official pages if accuracy is essential.
The Tech Stuff: How GenevaGPT came to be
Inspired by a blog post from Supabase shared in our AI Slack channels, here's a look at what we did:
Getting and indexing the content:
- For the backend, we used NestJS.
- The frontend is a very simple React app, which sends the question to the backend and displays the result.
- We set up a database using PostgreSQL and the pgvector extension.
- We responsibly crawled the entire website using SimpleCrawler and input the data into the database.
- We extracted the relevant content with Cheerio and inserted it into the database.
- We then sent these text snippets to OpenAI's embedding APIs and stored the received embeddings in the database.
Querying the content:
- Upon receiving a question, we send it to OpenAIās embedding API to obtain an embedding vector.
- We use this vector to search the database, extracting text snippets and URLs.
- A prompt is created, including the snippets until the maximum token limit is reached.
- These tokens are sent to OpenAIās createChatCompletion API and the result is streamed back to the browser with Server Sent Events.
- All related links found in our database are also returned for reference and proper sources.
We've made some tweaks for improvement lately. We now only use the first few content snippets for the prompt, filling the end with links and title only. This gives some more context to ChatGPT, but apparently not as good as the whole content. Initially, we tried sending only links, but this didn't always give satisfactory results and even led to "hallucinated" answers, since gpt-3.5 doesn't actually resolve all those links.
Remember, this tool is not affiliated with the Republic of Geneva and serves mainly as a proof of concept.
However, we're excited about the potential of this technology in enhancing public information access, and we hope you enjoy exploring Geneva with GenevaGPT! And if you're looking for information on the canton of Zurich, we've also set up ZueriCantonGPT.
Photo by Lukas Blaskevicius on Unsplash