Project

General

Profile

Actions

Improvement #30414

open

Improvement #29635: Code Review, Upgrade and changes in Prompt of Email Boat

Feature: Implement Logging Service for ML Data Collection and Debugging

Added by Sachin Suresh 5 months ago. Updated 5 months ago.

Status:
Fixed not Tested
Priority:
Normal
Assignee:
Target version:
-
Start date:
11/25/2025
Due date:
11/27/2025 (about 5 months late)
% Done:

100%

Estimated time:
6:00 h
Spent time:
remarks:
DB Changes:
Keys & Permissions:
Areas Affected:
Files Changed:

Description

Description:We need to implement a robust logging service for the CaxiAIQuote application. The primary goal is to capture transaction data to debug current issues and build a dataset for fine-tuning our own AI model in the future.Functional Requirements:Non-Blocking Performance: The logging process must be asynchronous and must not slow down the main email processing loop (zero latency impact).Format: Logs must be stored in JSONL (JSON Lines) format. Each line must be a valid, self-contained JSON object. This is required for compatibility with Vertex AI / OpenAI fine-tuning tools.Separation of Data:Successful Transactions: Log to logs/training_data.jsonl. These represent "perfect" examples (Prompt $\rightarrow$ Correct Payload).Failed Transactions: Log to logs/failed_prompts.jsonl. These are for developer review to improve the system instructions.Auto-Initialization: The service must automatically create the logs directory and the .jsonl files if they do not exist when the application starts.Data to Capture (Schema):Each log entry should include:timestamp: ISO string.user: Sender email address.prompt: The original email body text.status: 'success' or 'failed'.rawAiParams: The raw JSON returned by Gemini (crucial for debugging hallucinations).standardizedParams: The validated parameters used for logic.finalPayload: The actual JSON sent to the Flight API (only for success).errorMessage: Reason for failure (only for failed).Technical Implementation:Service File: Create services/loggerService.js.Method: Use Node.js fs.createWriteStream with the 'a' (append) flag to keep file streams open for high performance.Integration: Update index.js (Main Worker) to call logTransaction() immediately after the AI processing step (Step 2).Deliverables:services/loggerService.jsUpdated index.jsLogs folder generated in root directory (/logs/*.jsonl)

Actions #1

Updated by Sachin Suresh 5 months ago

  • Status changed from New to Assigned
  • Assignee set to Sachin Suresh
Actions #2

Updated by Sachin Suresh 5 months ago

  • Status changed from Assigned to In Progress
Actions #3

Updated by Sachin Suresh 5 months ago

We need to implement a robust logging service for the CaxiAIQuote application. The primary goal is to capture transaction data to debug current issues and build a dataset for fine-tuning our own AI model in the future.

Functional Requirements:

1. Non-Blocking Performance: The logging process must be asynchronous and must not slow down the main email processing loop (zero latency impact).
2. Format: Logs must be stored in JSONL (JSON Lines) format. Each line must be a valid, self-contained JSON object. This is required for compatibility with Vertex AI / OpenAI fine-tuning tools.
3. Separation of Data: * Successful Transactions: Log to `logs/training_data.jsonl`. These represent "perfect" examples (Prompt $\rightarrow$ Correct Payload). * Failed Transactions: Log to `logs/failed_prompts.jsonl`. These are for developer review to improve the system instructions.
4. Auto-Initialization: The service must automatically create the `logs` directory and the `.jsonl` files if they do not exist when the application starts.

Data to Capture (Schema):

Each log entry should include:
  • `timestamp`: ISO string.
  • `user`: Sender email address.
  • `prompt`: The original email body text.
  • `status`: 'success' or 'failed'.
  • `rawAiParams`: The raw JSON returned by Gemini (crucial for debugging hallucinations).
  • `standardizedParams`: The validated parameters used for logic.
  • `finalPayload`: The actual JSON sent to the Flight API (only for success).
  • `errorMessage`: Reason for failure (only for failed).

Technical Implementation:

  • Service File: Create `services/loggerService.js`.
  • Method: Use Node.js `fs.createWriteStream` with the `'a'` (append) flag to keep file streams open for high performance.
  • Integration: Update `index.js` (Main Worker) to call `logTransaction()` immediately after the AI processing step (Step 2).
Deliverables:
  • `services/loggerService.js`
  • Updated `index.js`
  • Logs folder generated in root directory (`/logs/*.jsonl`)

Actions #4

Updated by Sachin Suresh 5 months ago

  • Status changed from In Progress to Fixed not Tested
  • % Done changed from 0 to 100
Actions #5

Updated by Sachin Suresh 5 months ago

  • Status changed from Fixed not Tested to In Progress
  • % Done changed from 100 to 80
Actions #6

Updated by Sachin Suresh 5 months ago

Need to implement a log clear functionality and archive functionality
for proper debugging

Actions #7

Updated by Sachin Suresh 5 months ago

  • Status changed from In Progress to Need more info
  • % Done changed from 80 to 100
Actions #8

Updated by Sachin Suresh 5 months ago

  • Status changed from Need more info to Fixed not Tested
Actions

Also available in: Atom PDF