BYD Intelligent Charging Assistant
AI/ML
Backend
RAG
A RAG / Agent application built from public BYD Qin, Song, and Han vehicle manuals and charging-safety materials, combining vehicle knowledge Q&A, personal charging-data analysis, and initial charging-fault screening.
Tech Stack
Python
FastAPI
LangChain
LangGraph
DeepSeek
MySQL
Redis
Chroma
Next.js
Docker
Description
Built a RAG / Agent application with vehicle knowledge Q&A, personal charging analysis, and fault pre-screening modes using public BYD manuals and charging-safety materials, then completed a V2 upgrade focused on retrieval quality, multi-turn context, cache reliability, and high-risk response control.
- Parsed, cleaned, chunked, deduplicated, and idempotently ingested six DM-i / EV manuals for the Qin, Song, and Han series plus two charging-safety sources, writing 4,507 1024-dimensional vectors to Chroma.
- Used DeepSeek with recent dialogue and trusted vehicle context to generate structured standalone retrieval queries. Source grouping, candidate quotas, backfilling, and RRF fusion improved Hit@3 from 81.67% to 85.00% and MRR from 0.658 to 0.689 on a 60-question versioned evaluation set, with zero vehicle-boundary violations, alongside a Cross-Encoder reranking comparison.
- Uses MySQL as the complete conversation source of truth and Redis to cache the latest 10 turns across three business modes with a 30-minute TTL. Cache failures recover from MySQL, while final model history is limited to the latest six turns and 12,000 characters.
- Used LangGraph to orchestrate information extraction, missing-field follow-up, risk classification, retrieval, response generation, and safe fallback, with pre-generation high-risk blocking and post-generation review to restrict unsafe guidance.
- Built the charging-record analysis flow with FastAPI, Pydantic, SQLAlchemy, MySQL, and Decimal, with DeepSeek identifying analytical intent, calling a read-only tool, and explaining deterministic statistics.
- Implemented streaming interaction, session recovery, and citation display with Next.js and SSE, and used Docker Compose to orchestrate the database, backend, frontend, and initialization flow.
Page Info
Intelligent Charging Assistant Interface
Shows the vehicle selector, consultation modes, and intelligent Q&A entry point for vehicle knowledge, personal charging-data analysis, and initial charging-fault screening.
