-
Notifications
You must be signed in to change notification settings - Fork 4
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
Added deployment cache #53
Conversation
# Conflicts: # core/src/test/java/com/sap/ai/sdk/core/WireMockTestServer.java # core/src/test/java/com/sap/ai/sdk/core/client/ScenarioUnitTest.java # foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java # orchestration/src/test/java/com/sap/ai/sdk/orchestration/client/OrchestrationUnitTest.java # sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ConfigurationController.java
# Conflicts: # core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java # core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java
# Conflicts: # core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java # core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java
# Conflicts: # core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java
class Application { | ||
public class Application { | ||
/** The API client connected to the AI Core service. */ | ||
public static final ApiClient API_CLIENT = new AiCoreService().client(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Minor)
I'm not a fan of this implementation/declaration as it's unusual for SpringBoot application development.
More common approach would be to define a @Bean
here and @Autowired
it when using in controller classes.
@Bean
public ApiClient getApiCoreClient() {
return new AiCoreService().client();
}
But we can also do this in a separate PR. That'll be fine.
# Conflicts: # core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java # core/src/test/java/com/sap/ai/sdk/core/client/WireMockTestServer.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can call
DeploymentCache.resetCache
Currently, they can't and shouldn't (?).
* intermediate * ready-to-discuss state * Fix merge; Format * Add javadoc * Fix PMD warnings * Initial change of draft * Initial API change * Fix merge conflicts * Update readme * Fix PMD * Formatting * Apply suggestions from code review Co-authored-by: Charles Dubois <[email protected]> * Defuse functions * Update core/src/main/java/com/sap/ai/sdk/core/AiCoreServiceWithDeployment.java Co-authored-by: Charles Dubois <[email protected]> * Make service binding accessor changeable, e.g. for future testing * Rename methods and types; Fix merge * Formatting * Fix code, tests are working * Fix header provisioning * Add tests; Move stuff around * make base class extensible * work in progress * refine work in progress * Fix tests * Update test * Add annotations * Format * Format; JavaDoc * Restructure code * Fix PMD * Fix PMD * Fix test * Fix test * Apply review comments * Apply review comments * Add assertion on AI-Client-Type header * Minor JavaDoc fix * Formatting * Added deployment cache (#53) * Added query filters for Orchestration and OpenAI deployments * Added deployment cache * Added cache reset * Added unit tests * Fixed unit tests * PMD * Refactor to fix tests * fix tests for real * PMD + added clearCache and loadCache * PMD again * Added query filters for Orchestration and OpenAI deployments * Added deployment cache * Added cache reset * Added unit tests * Fixed unit tests * PMD * Refactor to fix tests * fix tests for real * PMD + added clearCache and loadCache * PMD again * WiP * Delete Core * Formatting * Fixed tests * Single cache * Added clearCache test * Fix tests * Added resetCache * Merged * spotless * Reduced code * Added throws * Added API client to application startup * Make DeploymentCache package private and an instance * Merged main * Changed cache to a Set --------- Co-authored-by: SAP Cloud SDK Bot <[email protected]> --------- Co-authored-by: Alexander Dümont <[email protected]> Co-authored-by: SAP Cloud SDK Bot <[email protected]> Co-authored-by: Charles Dubois <[email protected]>
Context
AI/ai-sdk-java-backlog#54.
The lookup of deployments should be more efficient & resilient.
Note for reviewers:
The filter for Orchestration and OpenAI deployments has been removed since the new
AiCoreService
allows to fetch all deploymentsFeature scope:
new AiCoreService().forDeployment...
DeploymentCache.resetCache()
whenever they delete a deploymentDefinition of Done
Documentation updatedRelease notes updated