generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 16
feat: (Grounding) Initial client classes with generated API and model #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
80089ca
Initial
a-d b959d0e
intermediate
a-d f46b313
Remove hashmap extension
a-d 14a461d
Refine; Add test code
a-d 90c7924
Fix thresholds; Add missing test class
a-d d922bae
Update pom.xml
newtork 3a9f057
Merge remote-tracking branch 'origin/main' into grounding-client
a-d 3fb8af0
Fix merge conflict
a-d 9964613
Merge remote-tracking branch 'origin/main' into grounding-client
a-d 53a5ad1
Update generated code
a-d 65f6dca
Mark the module for release
a-d 939cd79
Extract service and destination to test root
a-d 648a0b0
Formatting
bot-sdk-js 7f2393f
Rename client class
a-d 804428a
add test app controller and unit test
a-d 8abc5e8
Merge branch 'main' into grounding-client
newtork 73d7425
Merge remote-tracking branch 'origin/main' into grounding-client
a-d 2806fdf
format
a-d 2987e92
Remove Beta annotation on client
a-d affa192
Fix E2E tests
a-d a84ab71
Merge remote-tracking branch 'origin/grounding-client' into grounding…
a-d 2f4bcc7
Merge remote-tracking branch 'origin/main' into grounding-client
a-d dcad8a1
Add extended test case for documents
a-d f9b8ab0
Update tests
a-d 0a2ce03
Format, Syntax, checks
a-d 1bda813
Add some frontend links
a-d 08810c1
Migrate from public static factory method to constructor
a-d 1bdf622
Merge branch 'main' into grounding-client
newtork eb7a00a
small changes
CharlesDuboisSAP f1132c8
Merge branch 'main' into grounding-client
newtork a96b058
Update thresholds
a-d bfab7e0
Update grounding/src/test/java/com/sap/ai/sdk/grounding/GroundingClie…
newtork 4e73e29
Formatting
bot-sdk-js 5430c52
Fix JavaDoc
a-d 801c706
Update grounding/pom.xml
newtork 10c715b
Fix test method name
a-d 461e0e4
Merge remote-tracking branch 'origin/grounding-client' into grounding…
a-d af877e8
Add doc
a-d fce7127
Merge remote-tracking branch 'origin/main' into grounding-client
a-d a255bd5
Update docs/guides/GROUNDING.md
newtork c2951d5
Update docs/guides/GROUNDING.md
newtork 8e927ae
Fix doc
a-d 5b3ebd8
Update docs/guides/GROUNDING.md
newtork fb6252a
Merge branch 'grounding-client' of https://github.com/SAP/ai-sdk-java…
a-d 4e20287
Migrate files from "api" namespace to "client" namespace
a-d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.sap.ai.sdk</groupId> | ||
| <artifactId>sdk-parent</artifactId> | ||
| <version>1.3.0-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>grounding</artifactId> | ||
| <name>Grounding client</name> | ||
| <description>SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service. This is the client for the Orchestration Service.</description> | ||
|
|
||
| <url>https://github.com/SAP/ai-sdk-java?tab=readme-ov-file#documentation</url> | ||
| <organization> | ||
| <name>SAP SE</name> | ||
| <url>https://www.sap.com</url> | ||
| </organization> | ||
| <licenses> | ||
| <license> | ||
| <name>The Apache Software License, Version 2.0</name> | ||
| <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
| </license> | ||
| </licenses> | ||
| <developers> | ||
| <developer> | ||
| <name>SAP</name> | ||
| <email>cloudsdk@sap.com</email> | ||
| <organization>SAP SE</organization> | ||
| <organizationUrl>https://www.sap.com</organizationUrl> | ||
| </developer> | ||
| </developers> | ||
| <properties> | ||
| <project.rootdir>${project.basedir}/../</project.rootdir> | ||
| <coverage.complexity>76%</coverage.complexity> | ||
| <coverage.line>83%</coverage.line> | ||
| <coverage.instruction>88%</coverage.instruction> | ||
| <coverage.branch>100%</coverage.branch> | ||
| <coverage.method>83%</coverage.method> | ||
| <coverage.class>100%</coverage.class> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <!-- used by generated API classes --> | ||
| <dependency> | ||
| <groupId>org.springframework</groupId> | ||
| <artifactId>spring-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework</groupId> | ||
| <artifactId>spring-web</artifactId> | ||
| </dependency> | ||
| <!-- scope "compile" --> | ||
| <dependency> | ||
| <groupId>com.sap.ai.sdk</groupId> | ||
| <artifactId>core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.sap.cloud.sdk.cloudplatform</groupId> | ||
| <artifactId>cloudplatform-connectivity</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.sap.cloud.sdk.datamodel</groupId> | ||
| <artifactId>openapi-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.code.findbugs</groupId> | ||
| <artifactId>jsr305</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-api</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
| <!-- scope "provided" --> | ||
| <dependency> | ||
| <groupId>org.projectlombok</groupId> | ||
| <artifactId>lombok</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <!-- scope "test" --> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.wiremock</groupId> | ||
| <artifactId>wiremock</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.assertj</groupId> | ||
| <artifactId>assertj-core</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <profiles> | ||
| <profile> | ||
| <id>generate</id> | ||
| <activation> | ||
| <activeByDefault>true</activeByDefault> | ||
| <property> | ||
| <name>generate</name> | ||
| </property> | ||
| </activation> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>com.sap.cloud.sdk.datamodel</groupId> | ||
| <artifactId>openapi-generator-maven-plugin</artifactId> | ||
| <configuration> | ||
| <outputDirectory>${project.basedir}/src/main/java</outputDirectory> | ||
| <apiMaturity>beta</apiMaturity> | ||
| <enableOneOfAnyOfGeneration>true</enableOneOfAnyOfGeneration> | ||
| <compileScope>COMPILE</compileScope> | ||
| <deleteOutputDirectory>true</deleteOutputDirectory> | ||
| <skip>true</skip> | ||
| </configuration> | ||
| <executions> | ||
| <execution> | ||
| <id>orchestration</id> | ||
| <goals> | ||
| <goal>generate</goal> | ||
| </goals> | ||
| <phase>generate-sources</phase> | ||
| <configuration> | ||
| <inputSpec>${project.basedir}/src/main/resources/spec/grounding.yaml</inputSpec> | ||
| <apiPackage>com.sap.ai.sdk.grounding.api</apiPackage> | ||
newtork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <generateApis>true</generateApis> | ||
| <!-- TODO will change --> | ||
newtork marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <modelPackage>com.sap.ai.sdk.grounding.model</modelPackage> | ||
| <additionalProperties> | ||
| <pojoBuilderMethodName>create</pojoBuilderMethodName> | ||
| <pojoBuildMethodName/> | ||
| <pojoConstructorVisibility>protected</pojoConstructorVisibility> | ||
| <enumUnknownDefaultCase>true</enumUnknownDefaultCase> | ||
| <useOneOfInterfaces>true</useOneOfInterfaces> | ||
| </additionalProperties> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </profile> | ||
| </profiles> | ||
| </project> | ||
89 changes: 89 additions & 0 deletions
89
grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| package com.sap.ai.sdk.grounding; | ||
|
|
||
| import com.google.common.annotations.Beta; | ||
| import com.sap.ai.sdk.core.AiCoreService; | ||
| import com.sap.ai.sdk.grounding.api.PipelinesApi; | ||
| import com.sap.ai.sdk.grounding.api.RetrievalApi; | ||
| import com.sap.ai.sdk.grounding.api.VectorApi; | ||
| import javax.annotation.Nonnull; | ||
| import lombok.AccessLevel; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| /** | ||
| * Service class for the Grounding APIs. | ||
| * | ||
| * @since 1.3.0 | ||
| */ | ||
| @Beta | ||
| @RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class GroundingService { | ||
|
|
||
| final AiCoreService aiCoreService; | ||
| final String basePath; | ||
|
|
||
| static final String DEFAULT_BASE_PATH = "lm/document-grounding/"; | ||
|
|
||
| /** | ||
| * Create a new instance of the GroundingService. | ||
| * | ||
| * @return A new instance of the GroundingService. | ||
| */ | ||
| @Nonnull | ||
| public static GroundingService create() { | ||
| return create(new AiCoreService()); | ||
| } | ||
|
|
||
| /** | ||
| * Create a new instance of the GroundingService. | ||
| * | ||
| * @param aiCoreService The AiCoreService instance to use. | ||
| * @return A new instance of the GroundingService. | ||
| */ | ||
| @Nonnull | ||
| public static GroundingService create(@Nonnull final AiCoreService aiCoreService) { | ||
| return create(aiCoreService, DEFAULT_BASE_PATH); | ||
| } | ||
|
|
||
| /** | ||
| * Create a new instance of the GroundingService. | ||
| * | ||
| * @param aiCoreService The AiCoreService instance to use. | ||
| * @param basePath The base path to use for the API calls. | ||
| * @return A new instance of the GroundingService. | ||
| */ | ||
| @Nonnull | ||
| public static GroundingService create( | ||
| @Nonnull final AiCoreService aiCoreService, @Nonnull final String basePath) { | ||
| return new GroundingService(aiCoreService, basePath); | ||
| } | ||
|
|
||
| /** | ||
| * Get the Pipelines API. | ||
| * | ||
| * @return The Pipelines API. | ||
| */ | ||
| @Nonnull | ||
| public PipelinesApi pipelines() { | ||
| return new PipelinesApi(aiCoreService.getApiClient().setBasePath(basePath)); | ||
| } | ||
|
|
||
| /** | ||
| * Get the Vector API. | ||
| * | ||
| * @return The Vector API. | ||
| */ | ||
| @Nonnull | ||
| public VectorApi vector() { | ||
| return new VectorApi(aiCoreService.getApiClient().setBasePath(basePath)); | ||
| } | ||
|
|
||
| /** | ||
| * Get the Retrieval API. | ||
| * | ||
| * @return The Retrieval API. | ||
| */ | ||
| @Nonnull | ||
| public RetrievalApi retrieval() { | ||
| return new RetrievalApi(aiCoreService.getApiClient().setBasePath(basePath)); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.