Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ runs:
maven-version: ${{ inputs.maven-version }}

- name: Build dependencies for integration tests
run: mvn clean install -ntp -B -pl cds-feature-ai-core,cds-feature-recommendations,cds-starter-ai -am -DskipTests -Dcds.install-node.skip
run: mvn clean install -ntp -B -pl cds-feature-ai-core,cds-feature-recommendations,cds-starter-ai -am -DskipTests
shell: bash

- name: Integration Tests (spring)
env:
CDS_AICORE_TEST_RESOURCE_GROUP: itest-${{ github.run_id }}-${{ github.run_attempt }}-j${{ inputs.java-version }}
run: cds bind --exec -- mvn clean verify -ntp -B -f pom.xml -Dcds.install-node.skip
run: cds bind --exec -- mvn clean verify -ntp -B -f pom.xml
working-directory: integration-tests
shell: bash
6 changes: 3 additions & 3 deletions .github/actions/scan-with-sonar/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ runs:
shell: bash

- name: Build and test main modules
run: mvn clean install -ntp -B -pl cds-feature-ai-core,cds-feature-recommendations,cds-starter-ai -am -Dcds.install-node.skip
run: mvn clean install -ntp -B -pl cds-feature-ai-core,cds-feature-recommendations,cds-starter-ai -am
shell: bash

- name: Run integration tests
env:
CDS_AICORE_TEST_RESOURCE_GROUP: sonar-${{ github.run_id }}-${{ github.run_attempt }}
run: cds bind --exec -- mvn clean verify install -ntp -B -Dcds.install-node.skip
run: cds bind --exec -- mvn clean verify install -ntp -B
working-directory: integration-tests
shell: bash

- name: Generate aggregate coverage report
run: mvn verify -ntp -B -pl coverage-report -am -DskipTests -Dcds.install-node.skip
run: mvn verify -ntp -B -pl coverage-report -am -DskipTests
shell: bash

- name: Verify JaCoCo reports exist
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ jobs:
with:
maven-version: ${{ env.MAVEN_VERSION }}

- name: Install @sap/cds-dk
run: npm i -g @sap/cds-dk@9.9.1
shell: bash

- name: Run Tests
run: mvn test -ntp -B -P '!with-integration-tests' -Dcds.install-node.skip
run: mvn test -ntp -B -P '!with-integration-tests'

integration-tests:
name: Integration Tests (Java ${{ matrix.java-version }})
Expand Down Expand Up @@ -156,12 +152,8 @@ jobs:
with:
maven-version: ${{ env.MAVEN_VERSION }}

- name: Install @sap/cds-dk
run: npm i -g @sap/cds-dk@9.9.1
shell: bash

- name: Run Local MTX Tests
run: mvn clean verify -ntp -B -pl integration-tests/mtx-local/srv -am -P mtx-integration-tests -Dcds.install-node.skip
run: mvn clean verify -ntp -B -pl integration-tests/mtx-local/srv -am -P mtx-integration-tests

sonarqube-scan:
name: SonarQube Scan
Expand Down
19 changes: 12 additions & 7 deletions cds-feature-ai-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Bridges CAP Java applications to [SAP AI Core](https://help.sap.com/docs/sap-ai-

- **`AICore` CDS Service** - Exposes resource groups, deployments, and configurations as CDS entities with full CRUD support
- **Multi-Tenancy** - Automatic per-tenant resource group creation/deletion on subscribe/unsubscribe
- **RPT-1 Deployment Management** - Auto-creates configurations and deployments for the SAP-RPT-1 model
- **Prediction Client** - `AIClient` interface for calling the RPT-1 prediction API with retry and backoff
- **Deployment Management** - Auto-creates configurations and deployments for AI Core models with retry and backoff
- **Inference Client Factory** - Provides ready-to-use `ApiClient` instances scoped to a deployment for downstream foundation-model SDKs
- **Mock Fallback** - When no AI Core binding is detected, a mock implementation enables local development

## Setup
Expand Down Expand Up @@ -67,8 +67,8 @@ The plugin registers a CAP service named `AICore` that proxies AI Core REST APIs
// Get the resource group ID for a CDS tenant
String rgId = aiCoreService.resourceGroupForTenant(tenantId);

// Get (or auto-create) the RPT-1 deployment ID for a resource group
String deploymentId = aiCoreService.rpt1DeploymentId(resourceGroupId);
// Get (or auto-create) a deployment ID for a model spec in the given resource group
String deploymentId = aiCoreService.deploymentId(rgId, RptModelSpec.rpt1());
```

## Multi-Tenancy
Expand All @@ -91,11 +91,16 @@ AICoreService aiCore = runtime.getServiceCatalog()
// Use for entity operations (AICoreService extends CqnService)
Result rgs = aiCore.run(Select.from("AICore.resourceGroups"));

// Use the prediction client
AIClient client = new AICoreClient(aiCore, runtime);
List<CdsData> predictions = client.fetchPredictions(rows, targetColumns, indexColumn);
// Resolve a deployment and obtain a configured ApiClient for it
String resourceGroupId = aiCore.resourceGroupForTenant(tenantId);
String deploymentId = aiCore.deploymentId(resourceGroupId, RptModelSpec.rpt1());
ApiClient client = aiCore.inferenceClient(resourceGroupId, deploymentId);
```

The `ApiClient` returned by `inferenceClient` is preconfigured with the AI Core
destination and the deployment URL; use it to construct foundation-model SDK
clients (for example `RptInferenceClient` from `cds-feature-recommendations`).

## Related

- [SAP AI Core Documentation](https://help.sap.com/docs/sap-ai-core)
Expand Down
Loading
Loading