Inspiration
I love traveling and visiting historical places, but planning cultural tours always took forever. I would spend hours researching which sites to visit, finding good restaurants nearby, and figuring out the best walking routes. I thought there had to be a better way to get personalized historical tours quickly, so I decided to build something that could do this automatically.
What it does
CulturalTrace generates custom historical and cultural tours based on what you ask for. You can request tours for specific cities like "historical sites in Rome" or broader themes like "medieval castles in Europe". The system finds relevant historical places, adds traditional restaurants nearby, suggests walking routes, and includes cultural stories and practical visitor information. The service adapts to different request types - if you ask for a specific monument, it gives you fewer places with more detail. If you ask for a whole country, it provides more sites with efficient coverage. Everything is returned as structured data that can be used by travel apps or websites.
How we built it
I built this as a Python FastAPI backend service. The core uses Google's Gemini LLM to generate historical tour data, but I had to solve the problem of the AI sometimes generating responses that were too long or had formatting issues. My solution was to create a smart request splitting system. The service analyzes how complex your request is and decides whether to handle it as one query or split it into smaller focused requests. It tries simpler prompts with fewer places. The system dynamically adjusts how many places to include based on the request type and complexity. To make the data richer, I integrated with the Qloo API to add real business information like ratings, hours, and photos for the places. I added Redis caching so repeated requests are fast, and included input sanitization for security.
Challenges we ran into
The biggest challenge was dealing with unreliable LLM responses. Sometimes the AI would generate JSON that was cut off, had syntax errors, or was just too long. I spent a lot of time building robust parsing logic that could handle malformed responses and fix common JSON issues. Another challenge was figuring out the right balance for how many places to include. Too many places and the response would get truncated. Too few and users would not get enough options. I solved this by making the system adaptive - it now chooses the optimal number based on the specific request type. Getting the request splitting logic right took several iterations. I had to learn which types of queries needed to be broken down and how to recombine the results into a coherent tour.
Accomplishments that we're proud of
I am proud that the system almost never fails completely.The dynamic place counting system turned out really well. Instead of always generating the same number of places, it intelligently adapts - specific monuments get 3-4 places with lots of detail, while country-level requests get 12-15 places with broader coverage. The request splitting works smoothly and users do not even know it is happening. Complex requests just work and return comprehensive results.
What we learned
I learned a lot about working with LLMs and handling their unpredictable outputs. Building robust error handling and fallback systems is crucial when working with AI APIs. I also learned about the importance of prompt engineering. Small changes in how you ask the AI to format responses can make a huge difference in reliability. Working with external APIs taught me about timeout handling, rate limiting, and graceful degradation when services are unavailable.
What's next for CulturalTrace
I want to add support for more specialized tour types like food tours, architecture tours, or family-friendly tours. The system is flexible enough to handle these with some prompt adjustments. Adding real-time data like current opening hours, crowd levels, and special events would make the tours more practical for immediate use. I am also considering adding a simple web interface so people can try it directly instead of just using the API. The caching system could be smarter - instead of just caching exact matches, it could learn from similar requests and provide suggestions for related tours.
Log in or sign up for Devpost to join the conversation.