This workflow automates the process of reading EDI files generated by Sabre, parsing them using an AI Agent, and producing structured accounting reports like:
๐ Accounts Receivable (AR) Summary
๐ Tax and Surcharges Report
It also uses Retrieval-Augmented Generation (RAG) to vectorize the Sabre Interface User Record (IUR)โa 154-page technical documentโso that the AI agent can reference it when clarification is required while generating reports.
โ๏ธ Tools & Integrations Used
Component:Tool/Service:Purpose:Workflow Engine:n8n:Automation & orchestration
LLM Model:OpenAI GPT-4 / Chat Model:Natural language understanding and parsing
Embeddings Model:OpenAI Embeddings:Convert text into semantic vector format
Vector Database:Pinecone:Store and retrieve document chunks semantically
Storage:Google Drive:Source of raw EDI text files and PDF documentation
DataLoader + Splitter:n8n Node + Recursive Splitter:Loads and prepares documents for embedding
AI Agents:n8n AI Agent Node:Runs context-aware prompts and parses reports
๐งฑ Workflow Breakdown
๐ง 1. Vectorizing the Sabre IUR Document (RAG Setup)
๐ Objective: Enable the AI Agent to refer to the IUR document (154 pages) for detailed explanations of EDI terms, formats, and rules.
Flow Steps:
Google Drive Search + Download โ Find and pull the IUR PDF file.
Default Data Loader โ Load the file and preprocess it for semantic splitting.
Recursive Character Splitter โ Break down large pages into meaningful chunks.
OpenAI Embeddings โ Vectorize each chunk.
Pinecone Vector Store โ Save into a Pinecone namespace for future retrieval.
โ Result: The IUR is now searchable via semantic queries from the AI Agent.
๐ 2. Reading and Extracting Data from EDI Files
๐ Objective: Parse raw EDI files for financial records and summaries.
Flow Steps:
Trigger โ Manual or scheduled execution of the workflow.
Google Drive Search โ Finds all new .edi or .txt files.
Download File Contents โ Loads content of each file into memory.
Extract from File โ Raw text extraction.
๐ 3. Report Generation Using AI Agents
๐ Objective: AI Agents parse the extracted data to generate structured accounting reports.
a. Accounts Receivable Report Agent
The extracted text is passed to an AI Agent.
Model is connected to:
OpenAI Chat Model (LLM)
Pinecone Vector DB (IUR reference)
Outputs a structured AR Summary Report.
b. Tax and Surcharges Report Agent
Same steps as above.
Prompts adjusted to extract tax, fees, surcharges, and amounts.
โ Output Format: Can be mapped to columns and inserted into a Google Sheet or exported as a CSV/JSON.
๐ Sample Reports You Can Build
Already implemented:
โ Accounts Receivable (AR) Summary Report
โ Tax and Surcharges Report
Can be extended to:
3. Accounts Payable (AP)
4. Passenger Revenue
5. Daily Sales
6. Commission Report
7. Net Profit Margin (if supplier cost + commission is available)
๐ก Key Advantages
โ
No-code automation with n8n
โ Semantic reasoning using AI + Vector DB (RAG)
โ Can work with various Sabre outputs without manual parsing
โ Modular: Easy to add new report types
โ Cloud-integrated (Drive, Pinecone, OpenAI)
๐งช Potential Improvements
Area Suggestions
Testing Add a โPreviewโ step to validate extracted data before writing
Scalability Batch mode + Google Sheet batching for multiple reports
Audit Trail Log every file name, timestamp, report type in a Google Sheet
Notification Send Slack/Email when a new report is generated
Multi-model support Add Claude/Gemini fallback if OpenAI usage limit is hit


