All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.theokanning.openai.OpenAiApi Maven / Gradle / Ivy

package com.theokanning.openai;

import com.theokanning.openai.answer.AnswerRequest;
import com.theokanning.openai.answer.AnswerResult;
import com.theokanning.openai.classification.ClassificationRequest;
import com.theokanning.openai.classification.ClassificationResult;
import com.theokanning.openai.completion.CompletionRequest;
import com.theokanning.openai.completion.CompletionResult;
import com.theokanning.openai.edit.EditRequest;
import com.theokanning.openai.edit.EditResult;
import com.theokanning.openai.embedding.EmbeddingRequest;
import com.theokanning.openai.embedding.EmbeddingResult;
import com.theokanning.openai.engine.Engine;
import com.theokanning.openai.file.File;
import com.theokanning.openai.finetune.FineTuneEvent;
import com.theokanning.openai.finetune.FineTuneRequest;
import com.theokanning.openai.finetune.FineTuneResult;
import com.theokanning.openai.model.Model;
import com.theokanning.openai.moderation.ModerationRequest;
import com.theokanning.openai.moderation.ModerationResult;
import com.theokanning.openai.search.SearchRequest;
import com.theokanning.openai.search.SearchResult;
import io.reactivex.Single;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.*;

public interface OpenAiApi {

    @GET("v1/models")
    Single> listModels();

    @GET("/v1/models/{model_id}")
    Single getModel(@Path("model_id") String modelId);

    @POST("/v1/completions")
    Single createCompletion(@Body CompletionRequest request);

    @Deprecated
    @POST("/v1/engines/{engine_id}/completions")
    Single createCompletion(@Path("engine_id") String engineId, @Body CompletionRequest request);

    @POST("/v1/edits")
    Single createEdit(@Body EditRequest request);

    @Deprecated
    @POST("/v1/engines/{engine_id}/edits")
    Single createEdit(@Path("engine_id") String engineId, @Body EditRequest request);

    @POST("/v1/embeddings")
    Single createEmbeddings(@Body EmbeddingRequest request);

    @Deprecated
    @POST("/v1/engines/{engine_id}/embeddings")
    Single createEmbeddings(@Path("engine_id") String engineId, @Body EmbeddingRequest request);

    @GET("/v1/files")
    Single> listFiles();

    @Multipart
    @POST("/v1/files")
    Single uploadFile(@Part("purpose") RequestBody purpose, @Part MultipartBody.Part file);

    @DELETE("/v1/files/{file_id}")
    Single deleteFile(@Path("file_id") String fileId);

    @GET("/v1/files/{file_id}")
    Single retrieveFile(@Path("file_id") String fileId);

    @POST("/v1/fine-tunes")
    Single createFineTune(@Body FineTuneRequest request);

    @POST("/v1/completions")
    Single createFineTuneCompletion(@Body CompletionRequest request);

    @GET("/v1/fine-tunes")
    Single> listFineTunes();

    @GET("/v1/fine-tunes/{fine_tune_id}")
    Single retrieveFineTune(@Path("fine_tune_id") String fineTuneId);

    @POST("/v1/fine-tunes/{fine_tune_id}/cancel")
    Single cancelFineTune(@Path("fine_tune_id") String fineTuneId);

    @GET("/v1/fine-tunes/{fine_tune_id}/events")
    Single> listFineTuneEvents(@Path("fine_tune_id") String fineTuneId);

    @DELETE("/v1/models/{fine_tune_id}")
    Single deleteFineTune(@Path("fine_tune_id") String fineTuneId);

    @POST("/v1/moderations")
    Single createModeration(@Body ModerationRequest request);

    @Deprecated
    @GET("v1/engines")
    Single> getEngines();

    @Deprecated
    @GET("/v1/engines/{engine_id}")
    Single getEngine(@Path("engine_id") String engineId);

    @Deprecated
    @POST("v1/answers")
    Single createAnswer(@Body AnswerRequest request);

    @Deprecated
    @POST("v1/classifications")
    Single createClassification(@Body ClassificationRequest request);

    @Deprecated
    @POST("/v1/engines/{engine_id}/search")
    Single> search(@Path("engine_id") String engineId, @Body SearchRequest request);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy