Skip to content

Repository files navigation

Export Control RAG Checker

This repository packages a simple RAG application for checking products and related materials for export control signals across ITAR, EAR, and 10 CFR Part 810-style workflows.

The app is designed to:

  • accept free-text or uploaded documents
  • retrieve relevant regulatory context
  • generate a draft analysis with citations
  • expose metrics and review views in a lightweight dashboard

It is meant to assist human reviewers, not replace formal export control review.

What You Get

  • FastAPI backend for:
    • POST /chat
    • POST /upload
    • GET /metrics/recent
    • GET /metrics/summary
    • GET /demo
  • React dashboard served at /dashboard
  • GitHub Actions pipelines to:
    • create Azure infrastructure
    • build and deploy the app into your Azure environment

One-Click Fork Deployment

The repo is set up so someone can:

  1. fork the repo
  2. add their Azure and model configuration to GitHub
  3. click Deploy Infra
  4. click Deploy App
  5. get a working app in their own ACR and AKS

The deploy flow assumes:

  • you want Azure infrastructure created for this fork

Deployment Architecture

Deploy Infra creates:

  • Resource group
  • Azure Container Registry
  • Azure Kubernetes Service
  • Log Analytics workspace
  • Static public IP
  • Azure Cosmos DB account, database, and required containers
  • Azure OpenAI resource and deployment

Deploy App then:

  • builds the API image
  • builds the dashboard image
  • pushes both images to the ACR created for the fork
  • installs ingress-nginx on AKS
  • deploys the app manifests to AKS
  • points the app at the Cosmos DB and Azure OpenAI resources created by Deploy Infra

By default, the app comes up at:

  • http://<public-ip>.nip.io

That keeps first deployment simple and avoids requiring custom DNS before the app is running.

Fork And Deploy

1. Fork The Repository

Fork this repository into your own GitHub account or organization.

2. Create Azure Federated Access For GitHub Actions

Create or choose an Azure Entra application or service principal that GitHub Actions can use with OIDC.

That identity needs permissions to create and manage:

  • Resource groups
  • ACR
  • AKS
  • Public IPs
  • Role assignments
  • Deployments in the target subscription or resource group scope

You will use its values as GitHub secrets:

  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID
  • AZURE_SUBSCRIPTION_ID

3. Add GitHub Repository Secrets

In your fork, go to Settings -> Secrets and variables -> Actions and add:

Required:

  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID
  • AZURE_SUBSCRIPTION_ID

Optional:

  • OPENAI_API_KEY
    • only needed if you intentionally want to switch the app to generic OpenAI instead of the Azure OpenAI resource created by infra
  • VC_RPS_SECNO
  • VC_RPS_PASSWORD

4. Add GitHub Repository Variables

Add these variables for your environment:

Recommended for the default Azure deployment:

  • LLM_PROVIDER
  • AZURE_OPENAI_LOCATION
  • AZURE_OPENAI_API_VERSION
  • AZURE_OPENAI_DEPLOYMENT_NAME
  • AZURE_OPENAI_MODEL_NAME
  • AZURE_OPENAI_MODEL_VERSION
  • AZURE_OPENAI_MODEL_CAPACITY

If your Azure OpenAI region does not support the default model or version, override those values before running Deploy Infra.

Useful optional overrides:

  • AZURE_LOCATION
  • AKS_NODE_COUNT
  • AKS_VM_SIZE
  • KUBERNETES_VERSION
  • OPENAI_MODEL
  • OPENAI_BASE_URL
  • OPENAI_TIMEOUT_SECONDS
  • AZURE_OPENAI_TIMEOUT_SECONDS
  • ANALYSIS_MODE
  • CRAG_TOP_K
  • CRAG_DOC_CHARS
  • MAX_ANALYSIS_CHARS
  • ANALYSIS_TIMEOUT_SECONDS
  • ANALYSIS_REQUEST_LIMIT
  • ANALYSIS_TOTAL_TOKENS_LIMIT
  • DEEPEVAL_ENABLED
  • DEEPEVAL_USE_AZURE
  • DOCUMENT_STORE_BACKEND
  • COSMOS_DOCUMENT_DATABASE
  • COSMOS_DOCUMENT_CONTENT_CONTAINER
  • COSMOS_DOCUMENT_CHUNK_CONTAINER
  • COSMOS_DOCUMENT_REQUEST_CONTAINER
  • API_REPLICAS
  • DASHBOARD_REPLICAS

The full list is in infra/github-actions-config.md.

5. Run Deploy Infra

Open Actions in your fork and run:

This creates Azure resources with deterministic names based on the GitHub repository id, so forks do not need to hand-pick unique ACR names.

Default naming pattern:

  • Resource group: rg-ai4itar-<repo-id>
  • ACR: ai4itar<repo-id>
  • AKS: aks-ai4itar-<repo-id>
  • Public IP: pip-ai4itar-<repo-id>

6. Run Deploy App

After infra is complete, run:

This workflow will:

  • read the Azure outputs from Deploy Infra
  • build and push the images into your fork's ACR
  • get AKS credentials
  • install ingress
  • deploy the API and dashboard

7. Open The App

After Deploy App finishes, the app should be available at:

  • http://<public-ip>.nip.io

Endpoints:

  • / health check
  • /demo browser demo
  • /dashboard metrics dashboard
  • /chat analysis API
  • /upload file upload analysis API

Demo output example:

This is the browser-facing demo page after a product or document has been analyzed for export-control relevance.

Demo analysis output

GitHub Actions In This Repo

App Overview

High-level components:

Metrics dashboard example:

This dashboard shows recent evaluations and summary metrics for reviewing export-control checking activity.

Metrics dashboard

Local Development

If you want to run the app locally instead of deploying through GitHub Actions:

git clone git@github.com:your-org/AI4ITAR-gh.git
cd AI4ITAR-gh
uv venv
source .venv/bin/activate
uv sync --extra rag --extra metrics

Create a .env file from src/app/.env-example, then run:

ANALYSIS_MODE=direct ENABLE_RPS_ADDON=false uv run uvicorn main:app --app-dir src/app --reload --host 127.0.0.1 --port 8000

Useful local URLs:

  • http://127.0.0.1:8000/docs
  • http://127.0.0.1:8000/demo
  • http://127.0.0.1:8000/

To run the dashboard locally:

cd dashboard
npm install
VITE_AI4ITAR_API_BASE_URL=http://127.0.0.1:8000 npm run dev

Security And Compliance Notes

  • This app is an assistant, not a final decision-maker
  • Secrets must be stored in GitHub Actions secrets or another secret manager, never committed
  • Cosmos DB and model access should follow your organization's security controls
  • Uploaded documents and outputs may contain sensitive internal information

Supporting Docs

Contributing

  • Use feature branches and pull requests in GitHub
  • Add tests under tests/
  • Keep deployment docs aligned with the workflows when changing infra

About

This is a simple RAG application for checking products and related materials for export-control relevance, using retrieved policy and regulatory context to ground its responses. It also showcases LLM evaluations and metrics through built-in scoring, persistence, and a lightweight dashboard for reviewing recent runs and summary trends.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages