Improvement #30414
openImprovement #29635: Code Review, Upgrade and changes in Prompt of Email Boat
Feature: Implement Logging Service for ML Data Collection and Debugging
100%
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)
Updated by Sachin Suresh 5 months ago
- Status changed from New to Assigned
- Assignee set to Sachin Suresh
Updated by Sachin Suresh 5 months ago
- Status changed from Assigned to In Progress
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).
- `services/loggerService.js`
- Updated `index.js`
- Logs folder generated in root directory (`/logs/*.jsonl`)
Updated by Sachin Suresh 5 months ago
- Status changed from In Progress to Fixed not Tested
- % Done changed from 0 to 100
Updated by Sachin Suresh 5 months ago
- Status changed from Fixed not Tested to In Progress
- % Done changed from 100 to 80
Updated by Sachin Suresh 5 months ago
Need to implement a log clear functionality and archive functionality
for proper debugging
Updated by Sachin Suresh 5 months ago
- Status changed from In Progress to Need more info
- % Done changed from 80 to 100
Updated by Sachin Suresh 5 months ago
- Status changed from Need more info to Fixed not Tested