AI-Generated Technical Service Bulletins for EVs

Iftekhar

Iftekhar Ahmed

๐Ÿ”ง AI-Generated Technical Service Bulletins (TSBs) for EVs

This project uses local LLMs to automatically generate Technical Service Bulletins (TSBs) from electric vehicle (EV) repair logs. It includes clustering similar logs, generating markdown TSBs, and a user-friendly Streamlit interface.

๐Ÿš€ Features

โš™๏ธ TSB Generation using local LLMs (e.g. Mistral via Ollama)
๐Ÿง  Unsupervised Clustering of similar repair logs
๐Ÿ“„ Markdown Export of generated TSBs
๐ŸŽ›๏ธ Streamlit Web App for interactive use
๐Ÿ”Œ Offline Compatible โ€“ no API calls or internet required
๐Ÿ—ƒ๏ธ Organized project structure with extensible modules

๐Ÿ“ Project Structure

AI-Generated-TSBs-for-Evs/
โ”‚
โ”œโ”€โ”€ app/ # App logic & modules
โ”‚ โ”œโ”€โ”€ __init__.py # (optional for now)
โ”‚ โ”œโ”€โ”€ tsb_generator.py # Core logic for TSB generation with Ollama
โ”‚ โ”œโ”€โ”€ clustering.py # (optional: for clustering logic)
โ”‚ โ”œโ”€โ”€ utils.py # (optional: helper functions)
โ”‚
โ”œโ”€โ”€ data/ # Input data files
โ”‚ โ”œโ”€โ”€ repair_logs_sample.txt # Sample repair logs
โ”‚ โ”œโ”€โ”€ tsb_prompt.txt # Prompt template for TSB generation
โ”‚ โ””โ”€โ”€ clustered_logs/ # Logs grouped by similarity
โ”‚ โ”œโ”€โ”€ cluster_1.txt
โ”‚ โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ outputs/ # Final generated outputs
โ”‚ โ”œโ”€โ”€ Tsbs/ # Markdown TSBs
โ”‚ โ””โ”€โ”€ generated_tsb_clusters/ # Clustered summaries
โ”‚
โ”œโ”€โ”€ scripts/ # Python scripts for generation & clustering
โ”‚ โ”œโ”€โ”€ generate_tsb.py
โ”‚ โ”œโ”€โ”€ cluster_logs.py
โ”‚ โ”œโ”€โ”€ generate_cluster_tsbs.py
โ”‚ โ””โ”€โ”€ batch_generate.py
โ”‚
โ”œโ”€โ”€ streamlit_app.py # Streamlit interface for generating TSBs
โ”œโ”€โ”€ requirements.txt # Python dependencies
โ”œโ”€โ”€ README.md # You're here
โ””โ”€โ”€ venv/ # Virtual environment (excluded from version control)

๐Ÿ› ๏ธ Requirements

Python 3.8+
Ollama installed locally
A local LLM (e.g., mistral, llama3, phi3)
pip packages:
streamlit
scikit-learn
numpy
pandas
ollama

To install and start Ollama:

Install Ollama:
brew install ollama
Download and run a model (e.g. Mistral):
ollama run mistral
Make sure the model is running before launching the app or scripts.

๐Ÿ“ฆ Installation

Clone and set up the project:
git clone https://github.com/your-username/AI-Generated-TSBs-for-Evs.git
cd AI-Generated-TSBs-for-Evs
Create a virtual environment:
python3 -m venv venv
source venv/bin/activate
Install Python dependencies:
pip install -r requirements.txt

โš™๏ธ How to Run the Scripts

1. Generate TSBs from Raw Logs

python3 scripts/generate_tsb.py
๐Ÿ“‚ Output: outputs/Tsbs/tsb_1.md, tsb_2.md, etc.

2. Cluster Logs into Groups

python3 scripts/cluster_logs.py
๐Ÿ“‚ Output: data/clustered_logs/cluster_1.txt, cluster_2.txt, etc.

3. Generate TSBs from Clustered Logs

python3 scripts/generate_cluster_tsbs.py
๐Ÿ“‚ Output: outputs/Tsbs/cluster_1.md, etc.

4. Launch the Streamlit App

streamlit run streamlit_app.py
Then open http://localhost:8501 in your browser.

๐Ÿงช Sample File Format

repair_logs_sample.txt example:
Vehicle Model X shuts down randomly while charging.
Charging port light flashes red, indicating failure.
---

Battery temperature spikes above 70ยฐC under low load.
Frequent system reboots observed after power drain.

Each log is separated by either a double newline or ---.

๐Ÿง  Model & Prompt

The prompt used for TSB generation is stored in:
data/tsb_prompt.txt

It provides instructions to the LLM for generating concise, technical, and standardized service bulletins based on the input logs.
You can customize the prompt to match your formatting preferences or tone of voice.

โœ… Current Status

โœ… Offline TSB generation using Ollama
โœ… Clustering of logs for grouped TSBs
โœ… Markdown file generation for each TSB
โœ… Streamlit UI for manual upload and generation
โœ… Export to PDF
๐Ÿ”„ Add quality evaluation & ranking (Planned)
๐Ÿ“Š Multi-log summarization via embedding clustering (Planned)

๐Ÿ™Œ Acknowledgments

Ollama โ€“ local LLM orchestration
scikit-learn โ€“ clustering engine
Streamlit โ€“ web app UI

โœ๏ธ Author

Iftekhar Ahmed, Berlin, Germany AI | ML | Automation | Sustainability
Like this project

Posted Aug 5, 2025

Automates TSB creation from repair logs using local LLMs, Python, and Streamlit for EV maintenance insights.

Likes

0

Views

2

Timeline

Jul 1, 2025 - Jul 30, 2025

Clients

Open Source Initiative