No description
  • Python 94.7%
  • Makefile 2.9%
  • Shell 2.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Og Maciel 72b73bf101
AAP-83418: Bump pyasn1 to 0.6.4 (CVE-2026-59886) (#370)
Fixes a denial-of-service in pyasn1 (< 0.6.4) where a short BER/CER/DER
encoded REAL value can carry a very large exponent, causing excessive
CPU/memory during float conversion. Direct, pinned dependency; latest
patched release is 0.6.4.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 13:36:30 -04:00
.github/workflows Merge pull request #335 from ansible/TamiTakamiya/AAP-74445/ingest-technical-marketing-content 2026-06-02 11:03:12 -04:00
.tekton Update Konflux references 2025-07-12 05:20:28 +00:00
aap-product-docs-plaintext/red_hat_content/documentation Add document processing log and generated doc chunks 2026-06-23 15:31:34 -04:00
additional_docs Add AAP 2.7 Lifecycle Dates 2026-06-18 09:27:55 -04:00
byok AAP-63658: Exclude embedding model from BYOK image by default (#331) 2026-04-24 16:39:47 +02:00
embeddings_model Update download_embeddings_model.py 2025-04-29 13:17:04 -04:00
rag/vector_db/aap_product_docs/2.5 Restore /rag/vector_db for downstream build 2025-07-10 21:49:35 -04:00
red_hat_content/documentation Add document processing log and generated doc chunks 2026-06-23 15:31:34 -04:00
scripts Exclude main() from code coverage in parser scripts 2026-06-23 11:57:06 -04:00
solution-guides Implement Technical Marketing content ingestion (Assisted-by: Claude) 2026-06-01 10:41:32 -04:00
solution-guides-plaintext Fix linked-image stripping to prevent empty link artifacts 2026-06-01 10:41:33 -04:00
src/aap_rag_content Add document processing log and generated doc chunks 2026-06-23 15:31:34 -04:00
tests Add AEM TOC generator with tests and --keep-html option 2026-06-23 09:22:52 -04:00
.flake8 Add Lightspeed docs to RAG DB 2024-11-04 13:56:13 -05:00
.gitignore AAP-67112: BYOK examples (#298) 2026-03-31 17:16:27 +02:00
.gitleaks.toml Re-organize aap-rag-content 2025-07-02 12:28:07 -04:00
.pre-commit-config.yaml Simplify check-uv-lock pre-commit hook to use uv lock --check 2026-03-23 10:03:03 -04:00
.python-version Update llama-stack to 0.2.12 2025-06-27 11:24:41 -04:00
artifacts.lock.yaml Update output-image and add artifacts.lock.yaml 2025-07-02 22:46:37 -04:00
build.yaml Update llama-stack to 0.2.14 2025-07-08 22:16:24 -04:00
codecov.yml Add Codecov integration for code coverage tracking 2026-06-02 11:21:14 +02:00
Containerfile-aap Make test skips fatal in container builds via REQUIRE_VECTOR_DB flag 2026-06-15 11:49:01 -04:00
entrypoint.sh AAP-62955: Fix ansible-ai-connect-operator regression causing CrashLoopBackOff in downstream devel pipelines (#284) 2026-01-20 16:35:09 +01:00
LICENSE Initial content 2024-10-04 11:34:39 -04:00
Makefile Fix cross-platform hash verification with PyTorch CPU backend 2026-06-02 17:49:38 +02:00
pyproject.toml AAP-83418: Bump pyasn1 to 0.6.4 (CVE-2026-59886) (#370) 2026-07-20 13:36:30 -04:00
README.md Add AEM TOC generator with tests and --keep-html option 2026-06-23 09:22:52 -04:00
requirements.txt AAP-83418: Bump pyasn1 to 0.6.4 (CVE-2026-59886) (#370) 2026-07-20 13:36:30 -04:00
rpms.in.yaml Update rpms.lock.yaml for prefetch rpms 2025-06-06 19:17:25 -04:00
rpms.lock.yaml Update rpms.lock.yaml for prefetch rpms 2025-06-06 19:17:25 -04:00
run.yaml Fix embedding model configuration for sentence-transformers 2025-12-08 08:36:58 -05:00
sonar-project.properties Add SonarCloud integration 2026-05-25 12:15:51 +02:00
ubi.repo Update rpms.lock.yaml for prefetch rpms 2025-06-06 09:47:36 -04:00
uv.lock AAP-83418: Bump pyasn1 to 0.6.4 (CVE-2026-59886) (#370) 2026-07-20 13:36:30 -04:00

aap-rag-content

Overview

This repository contains files for building a RAG (Retrieval-Augmented Generation) vector DB, which is used with the Ansible Lightspeed Intelligent Assistant (ALIA).

The source documents saved here were extracted from the document archive built for Red Hat Offline Knowledge Portal (OKP), which provides off-line access to Red Hat product documentation. Copies of markdown files are stored in this repository.

For generating vector DB, we use the aap_rag_content Python package located in the src/ directory, which provides document processing and vector database generation capabilities. The custom_processor_aap.py script uses this package to process AAP documentation and build the vector database.

The aem-toc-generator script generates Mimir-compatible TOC JSON files from AEM-page HTML files. It is invoked automatically by mimir-parser.py during archive extraction.

Input files for Vector DBs

Input files that are used as the source of vector DBs are stored in the following directories:

  • /red_hat_content This directory stores the Markdown files extracted from the Mimir archive.
  • /aap-product-docs-plaintext This directory has Markdown files and their metadata files that are generated from the raw files under /red_hat_content. Metadata files are stored in the .metadata subdirectory with the same file name as its source and .json file extension.
  • /additional_docs This directory contains additional Markdown files that are used as the input for vector DB. Its .metadata subdirectory contains metadata JSON files.

Development Setup

Before running tests or working with the codebase, set up your development environment:

make setup

This command will:

  • Create a virtual environment (.venv/)
  • Install all project dependencies
  • Install development tools (pytest, black, mypy, ruff, etc.)

The project uses uv for dependency management, which provides fast and reliable package installation.

Running Unit Tests

To run the unit tests for the aap_rag_content package:

make unit-test

This will execute all tests in the tests/ directory using pytest with verbose output. The test suite includes tests for:

  • Metadata processing
  • Document processing
  • Vector database generation
  • Utility functions
  • Vector query round-trip validation
  • Solution guide query verification (requires a complete vector DB; see below)

Vector Query Tests

The test_vector_query.py file contains two test classes:

  • TestVectorQueryRoundTrip verifies basic FAISS operations (index creation, semantic relevance, result count, embedding dimensions) using the real sentence-transformers/all-mpnet-base-v2 model from the embeddings_model/ directory. These tests build a small in-memory index from sample documents and run automatically whenever the embedding model files are present.

  • TestSolutionGuidesQuery validates that the vector DB built by custom_processor_aap.py returns chunks from the correct solution guide documents. It loads the FAISS index from the built faiss_store.db and checks that:

    • A query mentioning "IBM Instana" returns chunks from the Instana solution guide
    • A query mentioning "AIOps with ServiceNow" returns chunks from the ServiceNow guide
    • A query mentioning "Red Hat AI Inference Server" returns chunks from the RHAIIS guide

    These tests require a vector DB that includes solution guide content. In the Konflux build, this happens automatically (tests run after custom_processor_aap.py). To run them locally, decompress the pre-built DB first:

    gzip -dk rag/llama_stack_vector_db/faiss_store.db.gz
    

    Then run only the solution guide tests:

    PYTHONPATH=src:$PYTHONPATH uv run pytest tests/tests/test_vector_query.py::TestSolutionGuidesQuery -v
    

    If the DB does not contain solution guide chunks, these tests skip automatically with a descriptive message.

Build a container image

Following command builds a container image, which includes the generated vector DB.

make build-image-aap

Push a container image to quay.io

podman login quay.io
podman push aap-rag-content quay.io/ansible/aap-rag-content