generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce duplication of ResponseHandlers (#244)
* Orchestration streaming first version * Added unit tests * Formatting * Added documentation * Added tests * Release notes * Applied Alex's review comments * Reduce duplication of ResponseHandlers * OpenAiStreamingHandler * fix spotbugs * Apply suggestions from code review * Formatting * Add Beta annotation to new public API * Minor code reduction * Formatting * Minor change --------- Co-authored-by: SAP Cloud SDK Bot <cloudsdk@sap.com> Co-authored-by: Alexander Dümont <22489773+newtork@users.noreply.github.com> Co-authored-by: Alexander Dümont <alexander_duemont@web.de>
- Loading branch information
1 parent
b183e81
commit e173db5
Showing
17 changed files
with
211 additions
and
211 deletions.
There are no files selected for viewing
This file contains 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
21 changes: 21 additions & 0 deletions
21
core/src/main/java/com/sap/ai/sdk/core/commons/ClientError.java
This file contains 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,21 @@ | ||
package com.sap.ai.sdk.core.commons; | ||
|
||
import com.google.common.annotations.Beta; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Generic class that contains a JSON error response. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
@Beta | ||
@FunctionalInterface | ||
public interface ClientError { | ||
/** | ||
* Get the error message. | ||
* | ||
* @return The error message | ||
*/ | ||
@Nullable | ||
String getMessage(); | ||
} |
13 changes: 13 additions & 0 deletions
13
core/src/main/java/com/sap/ai/sdk/core/commons/ClientException.java
This file contains 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,13 @@ | ||
package com.sap.ai.sdk.core.commons; | ||
|
||
import com.google.common.annotations.Beta; | ||
import lombok.experimental.StandardException; | ||
|
||
/** | ||
* Generic exception for errors occurring when using AI SDK clients. | ||
* | ||
* @since 1.1.0 | ||
*/ | ||
@Beta | ||
@StandardException | ||
public class ClientException extends RuntimeException {} |
This file contains 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 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 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
3 changes: 2 additions & 1 deletion
3
...ls/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java
This file contains 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package com.sap.ai.sdk.foundationmodels.openai; | ||
|
||
import com.sap.ai.sdk.core.commons.ClientException; | ||
import lombok.experimental.StandardException; | ||
|
||
/** Generic exception for errors occurring when using OpenAI foundation models. */ | ||
@StandardException | ||
public class OpenAiClientException extends RuntimeException {} | ||
public class OpenAiClientException extends ClientException {} |
Oops, something went wrong.