All SEL work

Systems & tools · APEx

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.

Existing testing framework

From a TCS action line to executable test code.

  • TCS action lineWritten by an engineer in the version-controlled specification app.
  1. Regex matchMatch the action line to its Python class.
  2. Python classCall the corresponding extension.
  3. ExtensionConnect to the required test functionality.
  4. 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.

APEx ingestion

Prepare documentation for keyword and vector search.

  • Confluence documentationReference material for the testing framework.
  1. IngestRead the framework documentation.
  2. ChunkSplit documents into searchable passages.
  3. 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.

APEx retrieval

From a documentation question to an answer with sources.

  1. QuestionAn engineer asks about the testing framework.
  2. Hybrid retrievalSearch keywords and vectors with document-permission checks.
  3. RerankRank the retrieved passages for the question.
  4. 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.

APEx serving

Client → authenticated gateway → self-hosted inference.

  • Web workspaceAsk a question in APEx.
  • Chrome MV3 extensionAccess APEx from the browser extension.
  1. FastAPI gatewayAuthenticate requests with SSO.
  2. Retrieval contextSupply the selected documentation passages.
  3. Inference APIUse an OpenAI-compatible interface.
  4. 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

APEx · Original product recordingOpen recording

Tools behind the work

RAG · Hybrid retrieval · Reranking · Document permissions · FastAPI · SSO · OpenAI-compatible API · Self-hosted inference · ChromaDB

Continue exploring

MCP-Wireshark