APEx: RAG for engineers writing relay tests
I built APEx to help SEL engineers write TCS tests without digging through 1,000+ Confluence documents. It makes the testing framework’s documentation searchable through a RAG system, with hybrid retrieval, reranking, permission checks, and source citations.
01 · Problem
Your memory shouldn’t have to be the documentation index.
Using our automated testing framework means navigating 1,000+ Confluence documents to find the right action lines and use them correctly. Experienced engineers memorize the actions. New engineers spend a lot of time finding them. I built APEx to help with that lookup, with citations engineers can follow back to the docs.
02 · Testing framework
How an action line becomes a relay test.
Our testing platform uses a BDD-style workflow. Engineers write TCS tests as action lines in a version-controlled specification app. Regex maps each line to a Python class, which calls an extension that runs the corresponding test or simulation. The framework covers generic testing, IEC 61850, DNP, and more.
From a TCS action line to executable test code.
- TCS action lineWritten by an engineer in the version-controlled specification app.
- Regex matchMatch the action line to its Python class.
- Python classCall the corresponding extension.
- ExtensionConnect to the required test functionality.
- Test / simulationRun generic or protocol-specific functionality.
This is the testing framework’s execution path. APEx helps engineers find the documentation they need to write these tests.
03 · Ingestion
Make the documentation searchable.
I built the ingestion and chunking pipeline and the keyword/vector retrieval indexes, using ChromaDB for vectors. I also handled document permissions so retrieval accounts for what each engineer is allowed to access.
Prepare documentation for keyword and vector search.
- Confluence documentationReference material for the testing framework.
- IngestRead the framework documentation.
- ChunkSplit documents into searchable passages.
- IndexBuild keyword and vector indexes.
- Searchable passagesContext to retrieve when an engineer asks a question.
04 · Retrieval
Find the relevant passages. Keep the sources attached.
APEx combines keyword and vector search, reranks the retrieved passages, and uses the selected context to answer with source citations. I also built retrieval evaluation, insufficient-evidence handling, and caching for users. A confident answer is nice. Being able to check it is better.
From a documentation question to an answer with sources.
- QuestionAn engineer asks about the testing framework.
- Hybrid retrievalSearch keywords and vectors with document-permission checks.
- RerankRank the retrieved passages for the question.
- GenerateUse the selected passages as context.
- Answer + citationsFollow the sources back to the documentation.
05 · Serving
Multiple models, one inference API.
Requests pass through an SSO-authenticated FastAPI gateway before reaching an OpenAI-compatible inference API. APEx supports multiple self-hosted models behind that interface.
Client → authenticated gateway → self-hosted inference.
- Web workspaceAsk a question in APEx.
- Chrome MV3 extensionAccess APEx from the browser extension.
- FastAPI gatewayAuthenticate requests with SSO.
- Retrieval contextSupply the selected documentation passages.
- Inference APIUse an OpenAI-compatible interface.
- Selected modelChoose among supported self-hosted models.
- Cited responseReturn the answer and its sources to the client.
06 · Product
See APEx in use.
The original product recording shows APEx’s engineering documentation workflow and interface.
Evidence & measurements
- Engineers reached
- 120+Internal engineering rollout
- Protocol documentation
- 6,000+ pagesIndexed engineering material
Original product recording
Tools behind the work
RAG · Hybrid retrieval · Reranking · Document permissions · FastAPI · SSO · OpenAI-compatible API · Self-hosted inference · ChromaDB
Continue exploring
MCP-Wireshark