Ai4
Separating query parsing from extraction and using an independent scoring model guarantees deterministic answer reproducibility while preventing enterprise language models from validating their own errors.
AI-assisted summary of Building Self-Evaluating OpenAI Agents for Profiles & Documents with Panasonic Avionics Corporation — original source. Check the original for full context.
Source published:
Detailed notes
## Background Published on YouTube by Ai4 on August 16, 2026, this presentation features Vijay Panwar, Staff Engineer at Panasonic Avionics Corporation, discussing the development of self-evaluating OpenAI agents for enterprise documents and profiles. The talk outlines production-grade design patterns—including chunking, embeddings, retrieval-augmented generation (RAG), and evaluation controls—to eliminate hallucinations and establish auditable accuracy in document-centric AI workflows.
## TL;DR Vijay Panwar presents the Doc QA Agent, a patent-pending system engineered to provide deterministic, verifiable answers from complex enterprise files such as legal contracts, medical reports, and candidate résumés. Powered by a FastAPI backend on AWS and vector databases like Chroma and OpenSearch, the architecture uses GPT-4o-mini solely for query normalization while relying on the CAT LLM to achieve 96% accuracy with independent judge scoring. The solution prioritizes inspectable citations down to paragraph-level references, strict multi-tenant data isolation, and explicit 'insufficient evidence' fallbacks when documents lack requested facts. Originating from Panwar's personal experience deciphering accident and legal paperwork, the tool targets enterprise applications across HR, legal compliance, and research literature analysis.
## Atmosphere & style The presentation carries a pragmatic, engineer-driven tone focused squarely on verifiable truth rather than generative AI hype. Panwar's narrative feels authentic and grounded, pivoting from a vulnerable personal anecdote about navigating chaotic accident paperwork to confident architectural deep dives. The live demo and subsequent Q&A create an engaged, collegial atmosphere where the speaker candidly discusses model boundaries, error handling, and roadmap features like multimodal extraction.
## Key takeaways - [00:04](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=4s) Vijay Panwar introduces the Doc QA Agent to solve the issue of inconsistent, non-deterministic answers and hallucinations in standard AI chatbots when querying enterprise documents. - [01:50](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=110s) The system is engineered for deterministic reproducibility, ensuring that asking the same query against an unchanged document produces identical results across 100 runs. - [01:50](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=110s) An independent evaluation layer scores generated answers directly against source text without retrieval bias, pairing with the CAT LLM to deliver a 96% accuracy rate. - [04:55](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=295s) OpenAI GPT-4o-mini is strictly isolated to query parsing and normalization, preventing confidential enterprise document content from being sent to external public model endpoints. - [04:55](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=295s) The backend architecture is built with FastAPI on Python 3.13 and AWS cloud infrastructure, utilizing page-aware chunking, token cost controls, and automated PII redaction prior to S3 storage. - [07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) Enterprise security and compliance are maintained through OAuth/RBAC, 60-minute session tokens, tenant data isolation, and comprehensive query tracing via AWS CloudTrail and X-Ray. - [07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) The agent operates on four core design pillars: Grounded (confidence is scored, not asserted), Inspectable, Self-Aware (explicitly reporting 'insufficient evidence' when data is missing), and Trustworthy. - [10:20](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=620s) Interactive citations pinpoint exact page numbers, sections, and paragraphs so human reviewers can perform immediate side-by-side verification against the original files. - [10:20](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=620s) Key enterprise use cases include legal contract analysis, HR résumé screening against job descriptions, financial compliance audits, and dense scientific literature extraction. - [13:09](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=789s) The platform ingests unstructured documents directly without manual data massaging and can connect natively to existing governed enterprise repositories like OneDrive and SharePoint.
## Detailed walkthrough ### [00:04](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=4s) Introduction and Speaker Background
Vijay Panwar, Staff Engineer (Member of Technical Staff IV) at Panasonic Avionics Corporation, introduces his presentation on building a "Doc QA Agent" — a self-evaluating OpenAI agent designed for enterprise profiles and documents. Organizations routinely deal with complex, high-stakes paperwork such as résumés, legal contracts, medical files, or 100-page reports where crucial information is buried. When users query conventional AI chatbots with such documents, they often encounter inconsistent answers: "First time is give you A, second time is give you B, third time give you A and B combined." The Doc QA Agent addresses this lack of consistency and verifiable ground truth.
Panwar shares his technical background, which includes over 12 years of software engineering experience and three years dedicated to artificial intelligence. He is a Senior Member of IEEE and a Full Member of Sigma Xi, actively reviewing research papers and contributing to AI model developments. He has authored around 12 research papers focusing primarily on AI-driven query optimization and leveraging web APIs. In addition to being an AWS Certified Cloud Practitioner and AWS Certified AI Practitioner, he was a winner at the MIT Global AI Hackathon (2025), where his team developed a model to evaluate system accuracy.
- **IEEE & Sigma Xi**: Senior Member / Full Member contributing to AI research and peer reviews. - **Publications**: ~12 research papers on AI query optimization and web API integration. - **Certifications**: AWS Certified Cloud Practitioner, AWS Certified AI Practitioner. - **Hackathon Achievement**: Winner of the MIT Global AI Hackathon 2025 for accuracy evaluation models.
---
[01:50](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=110s) The Problem with Overconfident Chat Models and Document Q&A
Modern chat models respond with high confidence, but Panwar emphasizes: "The chat models are confident, but that's not the same as correct." In domain-specific documents across legal, financial, and recruitment sectors, inconsistent responses create operational risk. Panwar's system (currently with a patent pending) guarantees deterministic reproducibility: asking the same question 100 times against an unchanged document will produce the exact same response every single time.
The backend is built with FastAPI running on Python 3.13 and hosted in the AWS cloud. Future feature iterations incorporate automated redaction of sensitive and personally identifiable information (PII) before documents are persisted into Amazon S3 storage.
Retrieval-Augmented Generation (RAG) forms the backbone of the agent. Instead of passively waiting for an unguided generation, RAG dynamically captures and extracts relevant chunks from uploaded documents in real time. To ensure reliability, the system incorporates an independent evaluation mechanism: a secondary model call that evaluates the generated answer against the source text without having seen the intermediate retrieval steps, scoring the output and guarding against the tendency of models to simply agree with themselves. Running alongside the pipeline is the CAT model (LLM), which achieves a 96% accuracy rate.
```mermaid flowchart TD accTitle: System Architecture and Processing Pipeline subgraph Client ["Client Layer"] UI["Web Browser Interface"] end
subgraph Backend ["FastAPI Backend (Python 3.13)"] API["API Gateway / ECS Fargate"] NLP["OpenAI GPT-4o-mini (Query Parsing Only)"] end
subgraph StorageAI ["Data & AI Infrastructure"] S3["AWS S3 (Document Store with PII Redaction)"] VEC["Chroma / OpenSearch (Vector Index)"] SQL["SQLite Database (Metadata Mapping)"] CAT["CAT LLM (96% Accuracy Engine & Scoring)"] end
UI -->|"User Query / File Upload"| API API -->|"Sanitized Parsing"| NLP API -->|"Store Raw / Redacted Docs"| S3 API -->|"Document Chunks & Embeddings"| VEC API -->|"Index Metadata & Tracking"| SQL VEC -->|"Context Retrieval"| CAT CAT -->|"Scored & Grounded Answer"| API API -->|"Response with Citations & Scores"| UI ```
---
[04:55](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=295s) System Architecture and AWS Production Hardening
The end-to-end architecture is structured into clear functional layers:
1. **Browser / Frontend**: Provides the user interface to upload documents, issue queries, view citations, and inspect confidence scores. 2. **Backend**: Powered by FastAPI running Python 3.13 to handle business logic, request routing, and system orchestration. 3. **Data and AI Storage**: - **Chroma / OpenSearch**: Vector index database storing chunked page embeddings for fast similarity retrieval. - **SQLite**: Local metadata store tracking document mapping and cloud storage locations (such as Amazon S3). - **OpenAI GPT-4o-mini**: A constrained NLP agent used solely to parse and normalize messy or colloquial user queries into structured English prompts. No confidential document data is sent to external public model endpoints.
For enterprise production hardening, the pipeline implements page-aware chunking with overlapping boundaries and a three-tier engineering retrieval strategy that decouples evaluation from extraction. Cost controls are embedded to avoid token runaway. The cloud deployment road map integrates Amazon S3 for storage, Amazon OpenSearch for scalable vector search, Amazon ECS Fargate for compute, and AWS API Gateway for endpoint management.
---
[07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) Enterprise Security, Multi-Tenancy, and Core Pillars
Enterprise adoption requires strict data security and compliance safeguards:
- **Authentication & RBAC**: Secure login with OAuth and Role-Based Access Control (RBAC) ensuring users only view authorized documents. - **Short-Lived Session Tokens**: Default token lifespan of 60 minutes, configurable per enterprise customer requirements. - **Encryption & Tenant Isolation**: Full data encryption in transit and at rest. Strict per-tenant data isolation ensures multi-tenant deployments never suffer cross-tenant data leakage or document collisions when identical filenames are uploaded. - **Auditability & Observability**: Every query is logged and traceable through AWS X-Ray, supported by comprehensive audit trails via AWS CloudTrail.
The execution workflow is straightforward: documents are uploaded, chunked, and embedded into the vector index regardless of size (tested from single-page résumés up to 3,000-page books). When a user submits a query, the system retrieves relevant chunks, generates a constrained response, and passes the output to an independent judge model for scoring.
Panwar frames the system around four core design pillars: 1. **Grounded**: Output confidence is "scored, not asserted." 2. **Inspectable**: Users can directly inspect extracted citations and validate responses against original source text. 3. **Self-Aware ("Knows what it knows and what it doesn't know")**: When queried on information absent from the uploaded text, the agent explicitly returns `"insufficient evidence"` instead of hallucinating answers. 4. **Trustworthy**: Builds verifiable trust for high-stakes enterprise workflows.
---
[10:20](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=620s) Live Demo, Use Cases, and Personal Genesis
Demonstrating the live application interface, Panwar highlights the interactive citation feature. When a grounded question is answered, clicking on the source citation opens a granular reference showing the exact page number, section, and paragraph from which the data was pulled. If a query falls outside the uploaded scope, the agent responds with a clear "insufficient evidence" notice.
Panwar shares the personal event that inspired this project: following an accident the prior year, he was overwhelmed by stacks of complex police reports, legal paperwork, and conflicting statements from different attorneys. Unsure of how to navigate the documents, he built this system to analyze the files and determine liability objectively: "I'm checking what is my lawyer is saying, what is the other team lawyer is saying, what is going on, who is the fault party."
Key enterprise application areas include: - **Legal Teams**: Reviewing NDAs, litigation filings, and complex contracts. - **Finance & Compliance**: Inspecting financial disclosures and compliance audits with automated PII redaction prior to cloud storage. - **Recruitment & HR**: Screening large volumes of candidate résumés against target job profiles, surfacing best matches with specific qualification citations. - **Research & Development**: Parsing dense scientific literature to pull out key metrics, novel contributions, specific tables, and column data across multi-page research papers.
---
[13:09](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=789s) Q&A: Judge Scoring, Data Ingestion, and Multimodal Capabilities
During the post-presentation Q&A session, audience members ask about evaluation logic, ingestion constraints, storage integration, and data types:
- **Independent Judge & Scoring Workflow**: An attendee asks whether a separate AI agent judges the output. Panwar clarifies that the OpenAI layer only handles initial query translation/NLP, while the backend CAT LLM performs the extraction and scoring against the vector store. The interface displays confidence scores alongside the specific page citations (e.g., showing matches on page 2, paragraphs 1 and 3) so users can perform an "apple-to-apple comparison" between the model's output and the raw document. - **Unstructured Data Handling**: An attendee asks whether raw documents require pre-processing or structuring before RAG ingestion. Panwar explains that documents are ingested directly without manual data massaging: "RAG is work like a newspaper. It's like it will capture all the missing pieces... available in the data." The vector database handles matching whether the content resides on page 1 or page 20. - **Model Accuracy Comparison**: When asked if other LLMs could replace the CAT model, Panwar notes that CAT delivers ~96% accuracy, whereas alternative models drop to 93–94%, leaving the choice dependent on required precision. - **Multimodal & Inline Diagram Support**: An attendee who builds similar client systems asks if the tool handles inline images or architecture diagrams within PDFs. Panwar explains that the current release supports text-based PDF and DOCX files only, with multimodal image extraction planned on the future development road map. - **Direct Enterprise Storage Integration (SSO/SharePoint/OneDrive)**: An attendee asks whether existing governed document repositories (OneDrive, Google Drive, Egnyte) must be migrated to the agent's storage. Panwar notes that if the Doc QA agent is integrated directly into the company's existing environment with database/storage access permissions, it can pull and vectorize the documents in place without requiring external document migration. - **Handling the 4% Error Margin**: A participant inquires how the remaining 4% error/hallucination gap in the 96% accuracy metric is handled. Panwar reiterates that side-by-side source extraction allows human reviewers to verify claims instantly. Demonstrating on his own résumé, he shows how the system confirms his 12 years of experience and staff engineer title with exact page references, preventing the agent from "making some response by itself to making you happy."
## Notable quotes > [00:04](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=4s) First time is give you A, second time is give you B, third time give you A and B combined. — Vijay Panwar
> [01:50](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=110s) The chat models are confident, but that's not the same as correct. — Vijay Panwar
> [07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) scored, not asserted — Vijay Panwar
> [07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) Knows what it knows and what it doesn't know — Vijay Panwar
> [07:36](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=456s) insufficient evidence — Vijay Panwar
> [10:20](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=620s) I'm checking what is my lawyer is saying, what is the other team lawyer is saying, what is going on, who is the fault party. — Vijay Panwar
> [13:09](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=789s) apple-to-apple comparison — Vijay Panwar
> [13:09](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=789s) RAG is work like a newspaper. It's like it will capture all the missing pieces... available in the data. — Vijay Panwar
> [13:09](https://www.youtube.com/watch?v=gmOXbNJiqpY&t=789s) making some response by itself to making you happy. — Vijay Panwar
## Mentioned Vijay Panwar, Panasonic Avionics Corporation, Ai4, IEEE, Sigma Xi, MIT Global AI Hackathon, OpenAI, GPT-4o-mini, FastAPI, Python, AWS, Amazon S3, Amazon OpenSearch, Amazon ECS Fargate, AWS API Gateway, AWS X-Ray, AWS CloudTrail, Chroma, SQLite, OneDrive, Google Drive, Egnyte, SharePoint
## Video description Vijay Panwar - Member of Technical Staff IV (Staff Engineer), Panasonic Avionics Corporation
The talk will demonstrate how an OpenAI-powered AI agent can read PDFs and enterprise documents and answer user questions with verifiable, source-grounded accuracy. As organizations struggle to extract insights from large volumes of legal, financial, and recruitment documents, this session will address the practical challenges of hallucinations, scalability, and trust in document-centric AI systems. The talk will include production-grade design patterns such as document ingestion pipelines, chunking and embeddings, retrieval-augmented generation (RAG), and response constraints using an application-level OpenAI API key. Attendees will learn how to implement evaluation controls, grounding strategies, and failure handling to ensure reliable, auditable answers in enterprise environments. This session is designed for practitioners who want to move beyond demos and deploy responsible, scalable document Q&A agents that deliver measurable business value.
[Source](https://www.youtube.com/watch?v=gmOXbNJiqpY)