Skip to content

With AI Core as a proxy for Azure OpenAI Services, we are able to perform prompt engineering, e.g. to add more context in the form of (SAP) documents or to perform input validation. This repo serves as a starting point for such a raw proxy and shows how SAP BTP, AI Core can be consumed and exposed via a CAP API.

License

Notifications You must be signed in to change notification settings

SAP-samples/azure-openai-aicore-cap-api

Consume OpenAI services (GPT) through CAP & SAP AI Core

REUSE status

Important

Given the recommendation to utilize the generative AI hub (General Availability Q4/2023) for foundational model access, we kindly refer to btp-cap-genai-rag to understand the process of establishing a connection from CAP through the Generative AI Hub to Azure OpenAI

With AI Core as a proxy for Azure OpenAI Services, we are able to perform prompt engineering, e.g. to add more context in the form of (SAP) documents or to perform input validation. This sample implements parts of the Reference architecture of an SAP BTP CAP application using GPT Models of OpenAI and serves as a starting point for such a raw proxy and shows how SAP AI Core can be consumed and exposed via a CAP API.

Architectural Parts

Requirements

In order to be able to carry out the steps for setup and deployment, an SAP BTP Subaccount is required, as well as the necessary entitlements. Provision the infrastructure and set the entitlements on SAP BTP by performing the steps of setup Global Account and Subaccount in order to deploy the respected components.

Prerequisited services and accounts

  • SAP BTP Subaccount
  • SAP AI Core instance
  • SAP AI Launchpad subscription (recommended)
  • SAP BTP, Cloud Foundry Runtime
  • Destination Service
  • SAP Authorization and Trust Management Service
  • Azure OpenAI Service with Base URL (endpoint) and API Key
  • Docker Hub account (optional)

Setup & Deployment

This sample is divided into two sub-projects and implements parts of the Reference architecture of an SAP BTP CAP application using GPT Models of OpenAI as shown and mentioned in the overview. The first describes how a proxy can be created via AI Core to consume Azure OpenAI services and the second part shows how an AI Core inference service (the actual proxy) can be consumed via a CAP API and exposed via an endpoint.

1. SAP AI Core as Proxy for Azure OpenAI Services

  1. Getting started with AI at SAP: SAP AI Launchpad and SAP AI Core
  2. Setup Docker Hub account and build & push your Docker Image (optional)
  3. Register general artifacts on SAP AI Core and inspect in SAP AI Launchpad
  4. Deploy the Inference Service on SAP AI Core as Proxy for Azure OpenAI Services
  5. Test and play with deployed service

2. CAP API: Expose Azure OpenAI Services via SAP AI Core Proxy

  1. Prepare for CAP API (Cloud Application Programming) deployment
  2. Deploy the CAP API
  3. Attach SAP AI Core to CAP via Destination
  4. Test CAP Endpoint

Known Issues

No known issues.

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.

Contributing

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.

About

With AI Core as a proxy for Azure OpenAI Services, we are able to perform prompt engineering, e.g. to add more context in the form of (SAP) documents or to perform input validation. This repo serves as a starting point for such a raw proxy and shows how SAP BTP, AI Core can be consumed and exposed via a CAP API.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •