Class WatsonxAiApi
java.lang.Object
org.springframework.ai.watsonx.api.WatsonxAiApi
Java Client for the watsonx.ai API. https://www.ibm.com/products/watsonx-ai
- Since:
- 1.0.0
- Author:
- John Jairo Moreno Rojas, Pablo Sanchidrian Herrera
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<WatsonxAiEmbeddingResponse>
embeddings
(WatsonxAiEmbeddingRequest request) org.springframework.http.ResponseEntity<WatsonxAiChatResponse>
generate
(WatsonxAiChatRequest watsonxAiChatRequest) reactor.core.publisher.Flux<WatsonxAiChatResponse>
generateStreaming
(WatsonxAiChatRequest watsonxAiChatRequest)
-
Field Details
-
WATSONX_REQUEST_CANNOT_BE_NULL
- See Also:
-
-
Constructor Details
-
WatsonxAiApi
public WatsonxAiApi(String baseUrl, String streamEndpoint, String textEndpoint, String embeddingEndpoint, String projectId, String IAMToken, org.springframework.web.client.RestClient.Builder restClientBuilder) Create a new chat api.- Parameters:
baseUrl
- api base URL.streamEndpoint
- streaming generation.textEndpoint
- text generation.embeddingEndpoint
- embedding generationprojectId
- watsonx.ai project identifier.IAMToken
- IBM Cloud IAM token.restClientBuilder
- rest client builder.
-
-
Method Details
-
generate
@Retryable(retryFor=java.lang.Exception.class, maxAttempts=3, backoff=@Backoff(random=true,delay=1200L,maxDelay=7000L,multiplier=2.5)) public org.springframework.http.ResponseEntity<WatsonxAiChatResponse> generate(WatsonxAiChatRequest watsonxAiChatRequest) -
generateStreaming
@Retryable(retryFor=java.lang.Exception.class, maxAttempts=3, backoff=@Backoff(random=true,delay=1200L,maxDelay=7000L,multiplier=2.5)) public reactor.core.publisher.Flux<WatsonxAiChatResponse> generateStreaming(WatsonxAiChatRequest watsonxAiChatRequest) -
embeddings
@Retryable(retryFor=java.lang.Exception.class, maxAttempts=3, backoff=@Backoff(random=true,delay=1200L,maxDelay=7000L,multiplier=2.5)) public org.springframework.http.ResponseEntity<WatsonxAiEmbeddingResponse> embeddings(WatsonxAiEmbeddingRequest request)
-