Sample code to demonstrate the usage of the SAP AI SDK. Also used as basis for running E2E tests.
Before running the application, ensure the following prerequisites are met:
- Java 17 or higher
- Maven 3.8 or higher
- Credentials for SAP AI Core service configured
- Deployments of the following models in the
defaultresource group:gpt-4o-minitext-embedding-3-small
To set up credentials for the AI Core service:
- Follow the instruction at Connecting to AI Core to create a service key for the AI Core service.
- Add the service key content either to a
.envfile in the sample app directory or directly to theAI_CORE_SERVICE_KEYenvironment variable.
To deploy gpt-4o-mini and text-embedding-3-small models, follow the instructions at:
Create a Deployment for a Generative AI Model
Before you can run the sample app, you need to install the AI SDK into your local Maven repository:
- Run
mvn install -DskipTestsfrom the root directory of the repository.
Note
The sample app uses the latest state of the SDK, so make sure to install the SDK after pulling a new version via Git.
Alternatively, you check out one of the release tags of the repository, e.g. git fetch --all --tags && git checkout rel/1.1.0.
Start the sample app:
- Run
mvn spring-boot:runfrom the sample app directory.
Head to http://localhost:8080 in your browser to see all available endpoints.
To test the MCP integration, run with mvn spring-boot:run -Dspring-boot.run.arguments="--spring.profiles.active=mcp":
Trigger the GitHub Action.