Interface WatsonxRestApi
@Path("/ml/v1")
@Consumes("application/json")
@Produces("application/json")
@ClientHeaderParam(name="Authorization",
value="Bearer {token}")
public interface WatsonxRestApi
This Microprofile REST client is used as the building block of all the API calls to watsonx. The implementation is provided
by
the Reactive REST Client in Quarkus.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classIntroduce a custom logger as the stock one logs at the DEBUG level by default... -
Method Summary
Modifier and TypeMethodDescriptionchat(TextGenerationRequest request, String token, String version) io.smallrye.mutiny.Multi<String>chatStreaming(TextGenerationRequest request, String token, String version) embeddings(EmbeddingRequest request, String token, String version) static com.fasterxml.jackson.databind.ObjectMapperobjectMapper(com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper) static WatsonxExceptiontoException(jakarta.ws.rs.core.Response response) tokenization(TokenizationRequest request, String token, String version)
-
Method Details
-
chat
@POST @Path("text/generation") TextGenerationResponse chat(TextGenerationRequest request, @NotBody String token, @QueryParam("version") String version) throws WatsonxException - Throws:
WatsonxException
-
chatStreaming
@POST @Path("text/generation_stream") @RestStreamElementType("text/plain") io.smallrye.mutiny.Multi<String> chatStreaming(TextGenerationRequest request, @NotBody String token, @QueryParam("version") String version) -
tokenization
@POST @Path("text/tokenization") TokenizationResponse tokenization(TokenizationRequest request, @NotBody String token, @QueryParam("version") String version) -
embeddings
@POST @Path("/text/embeddings") EmbeddingResponse embeddings(EmbeddingRequest request, @NotBody String token, @QueryParam("version") String version) -
toException
-
objectMapper
static com.fasterxml.jackson.databind.ObjectMapper objectMapper(com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper)
-