SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Starting point

SAP-samples/btp-cap-genai-rag

A CAP reference application on SAP BTP for GenAI email support, built on SAP AI Core's Generative AI Hub and retrieval-augmented generation over SAP HANA Cloud's Vector Engine.

Analyses incoming customer-support emails with large language models through SAP AI Core's Generative AI Hub: categorising them, scoring sentiment and urgency, and extracting configurable fields such as location. It uses LangChain inside CAP for output parsing against a custom schema and retrieval-augmented generation over embeddings stored in SAP HANA Cloud's Vector Engine, matching a new email against similar past ones to inform the reply it drafts. The sample ships single-tenant and multitenant versions, and a separate branch, cap-genaihub-vectorengine-sample, strips it down to a backend-only boilerplate of the same architecture.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Retrieval-augmented generationCAPRetrieval-augmented generationcapabilityGrounding a model's answer in data retrieved at question time: text split into chunks, each chunk embedded as a vector, and the chunks nearest to the question placed into the prompt. Semantic search is the same retrieval with a person reading the matches, and fine-tuning changes the model's weights, not its input.LLM integrationCAPLLM integrationcapabilityCalling a language model from application code with the tenant, destination and credential handling already solved instead using an SDK call with a hand-rolled key.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerIkko Eltociear AshiminePersonContributes to this
In the atlas: contributes to 2
@eltociear
Iyad-AlhafezPersonContributes to this
In the atlas: contributes to 2
@Iyad-Alhafez
Kay SchmitteckertPersonContributes to this
In the atlas: contributes to 6
@kay-schmitteckert
Martin FrickPersonContributes to this
In the atlas: contributes to 2
@martinfrick
Mauricio LaufferPersonContributes to this
In the atlas: maintains 16, contributes to 41, wrote 4
@mauriciolauffer
SteffenPersonContributes to this
In the atlas: contributes to 1
@sk31337
6 contributors

What it declares

Every artifact

Type
Sample
Origin
By SAP

As a sample

Form
A reference application

Connections2

SAP-samples/btp-cap-genai-rag connectionsSAP-samples/btp-cap-genai-ragPROVIDES→ demonstrates2demonstrates authoredLLM integrationdemonstrates authoredRetrieval-augmented generation

README

quoted from SAP-samples/btp-cap-genai-rag under Apache-2.0, read
SAP-samples/btp-cap-genai-rag/README.mdOn GitHub

GenAI Mail Insights - Develop a CAP-based application using GenAI and RAG on SAP BTP

REUSE status

Welcome to our dedicated GitHub repository, designed to provide valuable support to developers, partners and customers aiming to create advanced GenAI solutions on SAP Business Technology Platform (SAP BTP) following the Reference Architecture. Inside, you'll find a carefully crafted example that follows SAP BTP's respected Golden Path development approach. Discover how to smoothly integrate different Foundation Models and Large Language Models (LLMs) via Generative AI Hub by SAP AI Core, make the most of LangChain in CAP and use advanced techniques like output parsing according a custom schema or Retrieval Augmented Generation (RAG) through embeddings and SAP HANA Cloud's Vector Engine to achieve even higher value for your use case.

We encourage you to check out our accompanying Discovery Center Mission Develop a CAP-based application using GenAI and RAG along with the corresponding reference architecture guidance for Retrieval Augmented Generation with GenAI on SAP BTP. To learn more about Generative AI at SAP, we highly recommend to visit this openSAP course.

Basic Sample: For a more lightweight, basic backend-only sample of this Reference Architecture including CAP, generative AI hub and SAP HANA Cloud's Vector Engine, please check out the separate branch specifically dedicated to the basic boilerplate sample: cap-genaihub-vectorengine-sample.


Single-tenant Architecture Architecture: GenAI application with RAG on SAP BTP

Business Use Case of the Reference Application

The provided code sample presents an application crafted by a potential SAP partner or customer, tailored for SAP Business Technology Platform (SAP BTP). This scenario presents a comprehensive solution for enhancing customer support within a travel agency, utilizing advanced email insights and automation. The system analyzes incoming emails using Large Language Models (LLMs) to offer core insights such as categorization, sentiment analysis and urgency assessment. It goes beyond basic analysis by extracting key facts and customizable fields like location, managed through a dedicated configuration page.

One innovative feature involves utilizing email embeddings to identify similar historical emails, aiding in understanding how similar requests were handled previously. This fosters consistent and efficient customer service. The code also demonstrates the capabilities of summarizing and translating both email subject and body, enabling streamlined comprehension across languages.

Furthermore, the system takes automation to the next level by generating potential responses for customer inquiries. This response generation is influenced by configurable actions and services, enhancing response accuracy and speed. The flexibility to connect with SAP systems like SAP Concur adds an enterprise dimension, allowing seamless integration of processes and data.

Though initially tailored for a travel agency, the code can be adapted to suit various industries, making it a versatile solution for augmenting customer support with data-driven insights and automation.

The business scenario can also be enhanced to become a multitenant SaaS solution.

Insight: If the concept of multitenancy in SAP BTP is new to you, we strongly suggest perusing the following GitHub repository to gain a deeper understanding of deploying a CAP-based multitenant application in the SAP BTP, Kyma Runtime, as well as the SAP BTP, Cloud Foundry Runtime.
Explore the development of a multitenant Software as a Service application in SAP BTP using CAP

Impressions of the Reference Application

Getting started

This sample scenario comes with a step-by-step tutorial for a deployment in your own SAP BTP landscape. Check the following chapters and setup the scenario step-by-step in your own environment. The guide covers the deployment of the single-tenant as well as the multitenant version of the application.

  1. Scenario Introduction
  2. Landscape Setup
  3. Scenario Deployment
  4. Application Testing
  5. Extend the solution

How to obtain support

Create an issue in this repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Known Issues, Open Tasks and Additional Details

  • Error during paketo build process
    • Description: The cap-js/sqlite package is currently not part of the dependencies as it causes issues during the paketo build process.
    • Workaround: Install the cap-js/sqlite package manually without saving it in your package dependencies by running - npm i @cap-js/sqlite --no-save in the /(multi/single)-tenant/code directory.

Contributing

Thanks to all collaborators to make this application real!

If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.

License

Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/btp-cap-genai-ragtree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domaincap, ai-and-agents
Contributors6
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-btp-cap-genai-rag
JSON
/artifacts/sap-samples-btp-cap-genai-rag.json
MCP
Connecting an agent