Class AiCoreOpenAiClient
java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.AiCoreOpenAiClient
Factory for creating OpenAI SDK clients configured for SAP AI Core deployments.
This class provides factory methods that return fully configured OpenAI SDK clients using SAP Cloud SDK's Apache HttpClient with automatic OAuth token refresh.
- Since:
- 1.21.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAsynchronous client factory for accessing OpenAI services with a pre-configured model and resource group. -
Method Summary
Modifier and TypeMethodDescriptionasync()Get an asynchronous client factory for the configured model and resource group.static AiCoreOpenAiClientforModel(OpenAiModel model) Create an OpenAI client for a deployment serving the specified model using the default resource group.static AiCoreOpenAiClientforModel(OpenAiModel model, String resourceGroup) Create an OpenAI client for a deployment serving the specified model in the given resource group.com.openai.services.blocking.ResponseServiceGet a synchronous ResponseService client for the configured model and resource group.
-
Method Details
-
forModel
Create an OpenAI client for a deployment serving the specified model using the default resource group.- Parameters:
model- The AI model to target.- Returns:
- A configured OpenAI client instance.
- Throws:
DeploymentResolutionException- If no running deployment is found for the model.
-
forModel
@Nonnull public static AiCoreOpenAiClient forModel(@Nonnull OpenAiModel model, @Nonnull String resourceGroup) Create an OpenAI client for a deployment serving the specified model in the given resource group.- Parameters:
model- The AI model to target.resourceGroup- The resource group containing the deployment.- Returns:
- A configured OpenAI client instance.
- Throws:
DeploymentResolutionException- If no running deployment is found for the model.
-
responses
@Nonnull public com.openai.services.blocking.ResponseService responses()Get a synchronous ResponseService client for the configured model and resource group.- Returns:
- A configured synchronous OpenAI ResponseService client.
-
async
Get an asynchronous client factory for the configured model and resource group.- Returns:
- An Async factory for creating asynchronous OpenAI clients.
-