Interface WorkersAiApi
public interface WorkersAiApi
Public interface to interact with the WorkerAI API.
-
Method Summary
Modifier and TypeMethodDescriptionretrofit2.Call
<WorkersAiEmbeddingResponse> embed
(WorkersAiEmbeddingRequest apiRequest, String accountIdentifier, String modelName) Generate embeddings.retrofit2.Call
<WorkersAiChatCompletionResponse> generateChat
(WorkersAiChatCompletionRequest apiRequest, String accountIdentifier, String modelId) Generate chat.retrofit2.Call
<okhttp3.ResponseBody> generateImage
(WorkersAiImageGenerationRequest apiRequest, String accountIdentifier, String modelName) Generate image.retrofit2.Call
<WorkersAiTextCompletionResponse> generateText
(WorkersAiTextCompletionRequest apiRequest, String accountIdentifier, String modelName) Generate text.
-
Method Details
-
generateChat
@POST("client/v4/accounts/{accountIdentifier}/ai/run/{modelName}") retrofit2.Call<WorkersAiChatCompletionResponse> generateChat(@Body WorkersAiChatCompletionRequest apiRequest, @Path("accountIdentifier") String accountIdentifier, @Path(value="modelName",encoded=true) String modelId) Generate chat.- Parameters:
apiRequest
- request.accountIdentifier
- account identifier.modelId
- model id.- Returns:
- response.
-
generateText
@POST("client/v4/accounts/{accountIdentifier}/ai/run/{modelName}") retrofit2.Call<WorkersAiTextCompletionResponse> generateText(@Body WorkersAiTextCompletionRequest apiRequest, @Path("accountIdentifier") String accountIdentifier, @Path(value="modelName",encoded=true) String modelName) Generate text.- Parameters:
apiRequest
- request.accountIdentifier
- account identifier.modelName
- model name.- Returns:
- response.
-
generateImage
@POST("client/v4/accounts/{accountIdentifier}/ai/run/{modelName}") retrofit2.Call<okhttp3.ResponseBody> generateImage(@Body WorkersAiImageGenerationRequest apiRequest, @Path("accountIdentifier") String accountIdentifier, @Path(value="modelName",encoded=true) String modelName) Generate image.- Parameters:
apiRequest
- request.accountIdentifier
- account identifier.modelName
- model name.- Returns:
- response.
-
embed
@POST("client/v4/accounts/{accountIdentifier}/ai/run/{modelName}") retrofit2.Call<WorkersAiEmbeddingResponse> embed(@Body WorkersAiEmbeddingRequest apiRequest, @Path("accountIdentifier") String accountIdentifier, @Path(value="modelName",encoded=true) String modelName) Generate embeddings.- Parameters:
apiRequest
- request.accountIdentifier
- account identifier.modelName
- model name.- Returns:
- response.
-