# sap-samples/sap-btp-ai-best-practices architecture

> Architecture diagram of the GitHub repository sap-samples/sap-btp-ai-best-practices, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sap-samples/sap-btp-ai-best-practices
- Repository: https://github.com/sap-samples/sap-btp-ai-best-practices

## Overview

SAP BTP AI Best Practices is a portfolio of independent AI examples and end-to-end use cases, not one deployable application. Developers select a sample and follow that sample’s setup and implementation; the README highlights secure model access, filtering, masking, prompt techniques, and RAG. Use-case examples span document processing, recommendations, optimization, and evaluation. The excerpts show orchestration within some workflows, but not a repository-wide runtime or wiring between samples; those boundaries are kept explicit.

Main entry points: [`use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py) (Document pipeline), [`best-practices/generative-ai/access-to-generative-ai-models`](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/access-to-generative-ai-models) (Model access), [`best-practices/generative-ai/content-filtering`](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/content-filtering) (Content filtering), [`best-practices/generative-ai/data-masking`](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/data-masking) (Data masking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portfolio["Best-practice samples"]
  node_samples["Sample catalog"]
  node_model_access["Model access"]
  node_content_filter["Content filtering"]
  node_data_masking["Data masking"]
  node_prompt_registry["Prompt registry"]
  node_prompt_templates["Prompt templates"]
  node_rag["RAG examples"]
end

subgraph group_documents["Document workflows"]
  node_doc_pipeline["Document pipeline<br/>[pipeline.py]"]
  node_pdf_detection["PDF detection"]
  node_free_extraction["Free extraction"]
  node_template_discovery["Template discovery"]
  node_template_creation["Template creation"]
  node_rfq_llm["RFQ analysis<br/>[llm_client.py]"]
  node_kg_pipeline["Knowledge graph<br/>[kg_pipeline.py]"]
end

subgraph group_decision["Decision workflows"]
  node_offer_engine["Offer decisions<br/>[decision_engine.py]"]
  node_eligibility_optimizer["Eligibility optimizer<br/>[pipeline_runner.py]"]
  node_vendor_pipeline["Vendor optimization<br/>[pipeline_runner.py]"]
  node_anomaly_training["Anomaly training"]
end

subgraph group_evaluation["Evaluation workflows"]
  node_quote_benchmark["Quote comparison<br/>[pipeline.py]"]
  node_review_worker["AI review worker"]
end

node_developer(("Developer"))
node_sap_ai_core{{"SAP AI Core"}}

node_developer -->|"explores examples"| node_samples
node_samples -->|"selects sample"| node_model_access
node_samples -->|"selects sample"| node_content_filter
node_samples -->|"selects sample"| node_data_masking
node_samples -->|"selects sample"| node_prompt_registry
node_samples -->|"selects sample"| node_prompt_templates
node_samples -->|"selects sample"| node_rag
node_model_access -.->|"requires access"| node_sap_ai_core
node_doc_pipeline -->|"detects type"| node_pdf_detection
node_doc_pipeline -->|"extracts fields"| node_free_extraction
node_doc_pipeline -->|"finds template"| node_template_discovery
node_doc_pipeline -->|"creates template"| node_template_creation
node_developer -.->|"uses workflow"| node_doc_pipeline
node_developer -.->|"uses analysis"| node_rfq_llm
node_developer -.->|"uses workflow"| node_kg_pipeline
node_developer -.->|"uses decisions"| node_offer_engine
node_developer -.->|"runs planning"| node_eligibility_optimizer
node_developer -.->|"runs optimization"| node_vendor_pipeline
node_developer -.->|"trains model"| node_anomaly_training
node_developer -.->|"runs comparison"| node_quote_benchmark
node_developer -.->|"runs review"| node_review_worker

click node_model_access "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/access-to-generative-ai-models"
click node_content_filter "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/content-filtering"
click node_data_masking "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/data-masking"
click node_prompt_registry "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/prompt-registry"
click node_prompt_templates "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/prompt-templating"
click node_rag "https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/vector-rag-query"
click node_doc_pipeline "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py"
click node_pdf_detection "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pdf_detection_service.py"
click node_free_extraction "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/free_prompt_extraction_service.py"
click node_template_discovery "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_discovery_service.py"
click node_template_creation "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_creation_service.py"
click node_rfq_llm "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/rfqx-doc-analysis-utilities/llm_client.py"
click node_kg_pipeline "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/intelligent-negotiation-assistant-procurement/api/app/core/kg_creation/kg_pipeline.py"
click node_offer_engine "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/Offer-recommender/api/app/nbo/decision_engine.py"
click node_eligibility_optimizer "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/eligibility-analysis/api/app/services/optimizer/pipeline_runner.py"
click node_vendor_pipeline "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/vendor-selection-optimization/api/services/pipeline_runner.py"
click node_anomaly_training "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/anomaly-detection/backend/app/training_pipeline.py"
click node_quote_benchmark "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/quote_to_pr_btp/api/benchmark_lab/pipeline.py"
click node_review_worker "https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/autoevaluation-assistant/api/app/workers/ai_review_worker.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_samples,node_model_access,node_content_filter,node_data_masking,node_prompt_registry,node_prompt_templates,node_rag toneBlue
class node_doc_pipeline,node_pdf_detection,node_free_extraction,node_template_discovery,node_template_creation,node_rfq_llm,node_kg_pipeline toneAmber
class node_offer_engine,node_eligibility_optimizer,node_vendor_pipeline,node_anomaly_training toneMint
class node_quote_benchmark,node_review_worker toneRose
class node_developer,node_sap_ai_core toneIndigo
```

## Components

### Best-practice samples

- **Sample catalog**
- [Model access](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/access-to-generative-ai-models): `best-practices/generative-ai/access-to-generative-ai-models`
- [Content filtering](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/content-filtering): `best-practices/generative-ai/content-filtering`
- [Data masking](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/data-masking): `best-practices/generative-ai/data-masking`
- [Prompt registry](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/prompt-registry): `best-practices/generative-ai/prompt-registry`
- [Prompt templates](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/prompt-templating): `best-practices/generative-ai/prompt-templating`
- [RAG examples](https://github.com/sap-samples/sap-btp-ai-best-practices/tree/main/best-practices/generative-ai/vector-rag-query): `best-practices/generative-ai/vector-rag-query`

### Document workflows

- [Document pipeline](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py): `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`
- [PDF detection](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pdf_detection_service.py): `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pdf_detection_service.py`
- [Free extraction](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/free_prompt_extraction_service.py): `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/free_prompt_extraction_service.py`
- [Template discovery](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_discovery_service.py): `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_discovery_service.py`
- [Template creation](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_creation_service.py): `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/template_creation_service.py`
- [RFQ analysis](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/rfqx-doc-analysis-utilities/llm_client.py): `use-cases/rfqx-doc-analysis-utilities/llm_client.py`
- [Knowledge graph](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/intelligent-negotiation-assistant-procurement/api/app/core/kg_creation/kg_pipeline.py): `use-cases/intelligent-negotiation-assistant-procurement/api/app/core/kg_creation/kg_pipeline.py`

### Decision workflows

- [Offer decisions](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/Offer-recommender/api/app/nbo/decision_engine.py): `use-cases/Offer-recommender/api/app/nbo/decision_engine.py`
- [Eligibility optimizer](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/eligibility-analysis/api/app/services/optimizer/pipeline_runner.py): `use-cases/eligibility-analysis/api/app/services/optimizer/pipeline_runner.py`
- [Vendor optimization](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/vendor-selection-optimization/api/services/pipeline_runner.py): `use-cases/vendor-selection-optimization/api/services/pipeline_runner.py`
- [Anomaly training](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/anomaly-detection/backend/app/training_pipeline.py): `use-cases/anomaly-detection/backend/app/training_pipeline.py`

### Evaluation workflows

- [Quote comparison](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/quote_to_pr_btp/api/benchmark_lab/pipeline.py): `use-cases/quote_to_pr_btp/api/benchmark_lab/pipeline.py`
- [AI review worker](https://github.com/sap-samples/sap-btp-ai-best-practices/blob/main/use-cases/autoevaluation-assistant/api/app/workers/ai_review_worker.py): `use-cases/autoevaluation-assistant/api/app/workers/ai_review_worker.py`

### Other components

- **Developer**
- **SAP AI Core**

## Connections

- Developer → Sample catalog: explores examples (evidence: `README.md`)
- Sample catalog → Model access: selects sample (evidence: `README.md`)
- Sample catalog → Content filtering: selects sample (evidence: `README.md`)
- Sample catalog → Data masking: selects sample (evidence: `README.md`)
- Sample catalog → Prompt registry: selects sample (evidence: `README.md`)
- Sample catalog → Prompt templates: selects sample (evidence: `README.md`)
- Sample catalog → RAG examples: selects sample (evidence: `README.md`)
- Model access → SAP AI Core: requires access (evidence: `README.md`)
- Document pipeline → PDF detection: detects type (evidence: `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`)
- Document pipeline → Free extraction: extracts fields (evidence: `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`)
- Document pipeline → Template discovery: finds template (evidence: `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`)
- Document pipeline → Template creation: creates template (evidence: `use-cases/DocumentAI-LLM-Agent/backend/modules/docai_new/pipeline.py`)
- Developer → Document pipeline: uses workflow
- Developer → RFQ analysis: uses analysis
- Developer → Knowledge graph: uses workflow
- Developer → Offer decisions: uses decisions
- Developer → Eligibility optimizer: runs planning
- Developer → Vendor optimization: runs optimization
- Developer → Anomaly training: trains model
- Developer → Quote comparison: runs comparison
- Developer → AI review worker: runs review
