Creating a car analyser AI
Source: Dev.to
Introduction
I’ve become interested in building a car‑analysis AI. The goal is to help users quickly understand a vehicle’s condition and history without manually scrolling through multiple sites.
Data Source
The vehicle inspection data is available from a free government API. By querying a licence plate, we can retrieve a range of information such as MOT results, registration details, and more.
Architecture Overview
- User Input – The user enters a licence plate number on the front‑end.
- Cache Check – The back‑end checks whether the same licence plate has already been requested (by the same or another user).
- If a cached result exists, it is returned immediately, saving API calls and token usage.
- If it’s a cache miss, the system proceeds to fetch fresh data.
- Data Retrieval – Query the free government API with the licence plate.
- Data Normalisation – Structure the raw response into a single vehicle analysis object.
- Prompt Construction – Serialise the object to JSON and embed it in a concise prompt for the AI model.
- AI Processing – The model generates a response that is also formatted as JSON, making it easy to deserialise and use.
- Result Transformation – Convert the AI output into a front‑end‑friendly format.
- Caching – Store the final result in the cache with an appropriate expiry time.
Caching Strategy
- Purpose – Reduce redundant calls to both the free data API and the AI model, lowering latency and cost.
- Expiry Considerations –
- Vehicle listings can change quickly (often within 1–2 days).
- To avoid stale data and excessive memory usage, a starting expiry of 6 hours is proposed, with adjustments based on monitoring.
- Monitoring – Track request volume to the free API and cache hit/miss rates to fine‑tune the expiry policy.
Next Steps
- Explore the free API documentation in depth.
- Define the schema for the vehicle analysis object.
- Implement the cache layer and set up monitoring.
- Integrate the AI model, ensuring the prompt and response are JSON‑based.
Thanks for reading – stay tuned for the next installment! 🙌