1. System Overview & Problem Statement
In contemporary enterprise software ecosystems, Large Language Model (LLM) agents and generative AI microservices process non-deterministic data payloads at high velocities. While modern data analysts traditionally analyze static relational datasets, production-grade AI operations require continuous data observability, telemetry aggregation, automated payload validation, and anomaly diagnosis across raw, unstructured outputs.
The Gayatri AI Bug Fixes platform was engineered during an intensive 60-day DBERT Fellowship sprint to solve a critical real-world problem: the lack of real-time analytical visibility into structural failures, unescaped string syntax errors, and schema drift occurring within automated AI output streams. When downstream analytical workflows ingest corrupted JSON blobs or silent statistical anomalies, core BI dashboards and operational pipelines fail unpredictably.
This project delivers an end-to-end telemetry analytics engine and diagnostic dashboard designed to ingest raw AI service logs, automatically flag and repair string payload malformations, compute statistical drift metrics, and render operational metrics for engineering leadership.
Verified Credential & Deployment Links - Production Source Code: https://github.com/nishantmak04/Gayatri-AI-Bug-Fixes - Interactive Live Deployment: https://gayatri-ai-bug-fixes.dbert.in - DBERT Verified Credential: https://dbert.in/verify/CERT-DBERT-2026-DA-044 - Pre-Screening Rubric Score: 75/100 (High Merit)
2. Architectural Blueprint & Technical Stack Decisions
The architecture follows a modular, low-latency data processing pipeline built using Python, FastAPI, Polars/DuckDB for high-throughput in-memory aggregation, Pydantic for analytical data validation, and Streamlit/React for operational observability.
+-----------------------------------------------------------------------------------+
| Client / Diagnostic UI |
| (Streamlit / Operational Dashboard) |
+-----------------------------------------------------------------------------------+
|
REST / HTTP API
v
+-----------------------------------------------------------------------------------+
| API Ingestion Gateway |
| (FastAPI Payload Receiver & Auth) |
+-----------------------------------------------------------------------------------+
|
+-----------------+-----------------+
| |
v v
+-----------------------------------+ +-------------------------------------------+
| Diagnostic & Repair Engine | | Time-Series Data Aggregator |
| (Unterminated String Fixer & AST) | | (Polars LazyFrames & Vector Analytics) |
+-----------------------------------+ +-------------------------------------------+
| |
+-----------------+-----------------+
|
v
+-----------------------------------------------------------------------------------+
| Analytical Storage Layer |
| (DuckDB Persistent Store & Redis Telemetry Cache) |
+-----------------------------------------------------------------------------------+Key Technical Stack Choices: 1. Polars & DuckDB: Chosen over Pandas due to vectorized parallel operations and zero-copy Memory Allocation, allowing real-time processing of over 100,000 log events per second. 2. Pydantic V2: Implemented for strict schema validation of raw JSON streams to guarantee downstream analytical consistency. 3. Regex-AST Hybrid Parser: Designed specifically to intercept malformed string tokens (e.g., unterminated quotes, missing commas) emitted by non-deterministic generative AI models prior to analytical storage.
3. Core Implementation & Engineering Highlights
To achieve production-grade data analyst standards, Nishant implemented resilient ingestion pipelines capable of dealing with dirty unstructured input logs. Below are three key components highlighting the implementation rigor.
3.1 Unclosed Payload Repair & Diagnostic Ingestion
The diagnostic engine intercepts corrupted JSON log outputs—such as unescaped newline characters and unclosed quote strings—recursively repairing them before passing cleaned frames to the telemetry store.
import json
import re
from typing import Dict, Any, Tuple
from pydantic import BaseModel, ValidationErrorclass TelemetryLogEntry(BaseModel): timestamp: float service_id: str status_code: int raw_payload: Dict[str, Any] repair_applied: bool = False
def repair_unterminated_json(raw_str: str) -> Tuple[Dict[str, Any], bool]: """ Cleans and repairs malformed raw log payloads containing unterminated string literals typical in streaming LLM diagnostic outputs. """ try: # Standard parsing attempt return json.loads(raw_str), False except json.JSONDecodeError as e: # Intercept string termination errors specifically (e.g., Char position errors) pattern = r'Unterminated string starting at: line (\d+) column (\d+) \(char (\d+)\)' match = re.search(pattern, str(e))
if match: char_idx = int(match.group(3)) truncated = raw_str[:char_idx].rstrip() # Close any dangling quote and open JSON container safely if truncated.count('"') % 2 == 1: truncated += '"' repaired_candidate = truncated + "}" try: return json.loads(repaired_candidate), True except json.JSONDecodeError: return {"raw_error": str(e), "truncated_at": char_idx}, True return {"raw_error": str(e)}, True ```
4. Observability & Engineering Takeaways
- Defensive Ingestion: Streaming LLM diagnostics can emit partial JSON under network pressure; deterministic repair and Pydantic validation prevent downstream pipeline crashes.
- Auditability: Tracking
repair_appliedflags lets data engineers monitor upstream truncation rates and tune token budgets proactively.
Interested in building production AI & Full Stack systems with 1:1 mentorship and verified credentials? Explore the [DBERT AI Fellowship](https://lms.dbert.in).